1 / 19

让 VS.NET 和 AD 在你的企业中发挥作用

让 VS.NET 和 AD 在你的企业中发挥作用. 世纪传人培训中心 技术总监 徐晓峰. 讲座目的. 企业的信息化建设. 企业信息化不只是 ERP/CRM 从小事做起,积小成大 管理为主,信息化为辅. 基于 Web 的应用. 容易部署 容易使用 容易升级和更新 能够随建随用,见效快. VS.NET 和 ASP.NET. VS.NET 的特点 面向企业应用的开发 提高开发的效率 ASP.NET 的优势 让 Web 应用开发变得容易 让更多的程序员或准程序员能够开发企业的应用. AD 在企业中的作用. 用户身份验证的机构 安全管理的核心部分

pisces
Télécharger la présentation

让 VS.NET 和 AD 在你的企业中发挥作用

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 让VS.NET和AD在你的企业中发挥作用 世纪传人培训中心 技术总监 徐晓峰

  2. 讲座目的

  3. 企业的信息化建设 • 企业信息化不只是ERP/CRM • 从小事做起,积小成大 • 管理为主,信息化为辅

  4. 基于Web的应用 • 容易部署 • 容易使用 • 容易升级和更新 能够随建随用,见效快

  5. VS.NET和ASP.NET • VS.NET的特点 • 面向企业应用的开发 • 提高开发的效率 • ASP.NET的优势 • 让Web应用开发变得容易 • 让更多的程序员或准程序员能够开发企业的应用

  6. AD在企业中的作用 • 用户身份验证的机构 • 安全管理的核心部分 • 公司组织结构的体现 • 一个重要的数据中心

  7. 一个请假的应用

  8. 业务逻辑 • 填写请假单,说明时间、天数、类型和理由 • 提交请假单给自己的主管,等待批准 • 主管批准或不批准此请假申请,说明理由 • 请假人得到结果通知

  9. 数据库结构

  10. 页面模块设计 • 一个页面是一个完整的功能模块 • .aspx是显示部分 • 用HTML Table建立页面结构 • 用HtmlControls.HtmlTable划分区域 • .aspx.cs是页面的代码 • 从System.Web.UI.Page继承 • .cs文件中建立一个类用于业务逻辑和数据访问

  11. 分层结构

  12. 页面加载 protected Leave currentleave; protected string currentUser; private void Page_Load(object sender, System.EventArgs e) { currentUser = Page.User.Identity.Name; if ( !Page.IsPostBack) { } else { currentleave = (Leave)Session["currentleave"]; } }

  13. Web Control protected System.Web.UI.WebControls.Button btnNew; protected System.Web.UI.WebControls.TextBox txtName; protected System.Web.UI.WebControls.DropDownList lstType; protected System.Web.UI.WebControls.DataGrid dgLeaveApply; protected System.Web.UI.HtmlControls.HtmlTable tbEdit; protected System.Web.UI.WebControls.Label lblID;

  14. 如何访问数据库

  15. 如何执行命令 using System.Data; using System.Data.SqlClient; string strConn = "server=localhost;database=approve;trusted_connection=true"; SqlConnection conn = new SqlConnection(strConn); SqlCommand cmd = new SqlCommand("usp_leaveapply_apply",conn); cmd.CommandType=CommandType.StoredProcedure; cmd.Parameters.Add("@applyid",SqlDbType.UniqueIdentifier).Value=AppConvert.ToGuid(id); cmd.Parameters.Add("@approver",SqlDbType.VarChar,50).Value=AppConvert.ToString(approver); conn.Open(); cmd.ExecuteNonQuery(); conn.Close();

  16. 如何获取数据 SqlConnection conn = new SqlConnection(strConn); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand("usp_leaveapply_list_get",conn); da.SelectCommand.CommandType=CommandType.StoredProcedure; da.SelectCommand.Parameters.Add("@account",SqlDbType.VarChar,50).Value=AppConvert.ToString(account.ToLower()); if ( ds.Tables["list"] != null) ds.Tables["list"].Clear(); da.Fill(ds,"list");

  17. 如何访问AD • AD是什么? • 树形结构的数据库 • 数据库管理服务 • 身份验证服务 • 其他服务

  18. 访问AD的代码 using System.DirectoryServices; DirectoryEntry root = new DirectoryEntry("LDAP://vacation.com/dc=vacation,dc=com"); DirectorySearcher scr = new DirectorySearcher(root); scr.Filter="(sAMAccountName=xxf)"; scr.PropertiesToLoad.Add("displayName"); scr.PropertiesToLoad.Add("department"); SearchResult sr = scr.FindOne(); ret[0]=sr.Properties["displayName"][0].ToString(); ret[1]=sr.Properties["department"][0].ToString();

  19. 总结

More Related