Exemple #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <zs.Model.Tbl_User> DataTableToList(DataTable dt)
        {
            List <zs.Model.Tbl_User> modelList = new List <zs.Model.Tbl_User>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                zs.Model.Tbl_User model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new zs.Model.Tbl_User();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["userName"] != null && dt.Rows[n]["userName"].ToString() != "")
                    {
                        model.userName = dt.Rows[n]["userName"].ToString();
                    }
                    if (dt.Rows[n]["userPsw"] != null && dt.Rows[n]["userPsw"].ToString() != "")
                    {
                        model.userPsw = dt.Rows[n]["userPsw"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #2
0
 private void BindData()
 {
     this.ddl_role.DataSource     = bllr.GetModelList("");
     this.ddl_role.DataTextField  = "RoleName";
     this.ddl_role.DataValueField = "ID";
     this.ddl_role.DataBind();
     if (Request.QueryString["id"] != null)
     {
         string ids = Request.QueryString["id"].ToString();
         if (ids != "0")
         {
             zs.Model.Tbl_User model = bll.GetModel(int.Parse(ids));
             this.tb_name.Text           = model.userName;
             this.tb_Psw.Text            = model.userPsw;
             this.ddl_role.SelectedValue = bllur.GetModelList("UserID=" + ids)[0].RoleID.ToString();
             this.Button1.Text           = "修改";
             ViewState["userid"]         = ids;
         }
     }
 }
Exemple #3
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] != null)
     {
         string ids = Request.QueryString["id"].ToString();
         if (ids != "0")
         {
             zs.Model.Tbl_User model = bll.GetModel(int.Parse(ids));
             model.userName = this.tb_name.Text.Trim();
             model.userPsw  = ApplicationMethod.encript(this.tb_Psw.Text.Trim());
             bll.Update(model);
             ViewState["userid"] = ids;
         }
         else
         {
             zs.Model.Tbl_User model = new zs.Model.Tbl_User();
             model.userName = this.tb_name.Text.Trim();
             model.userPsw  = ApplicationMethod.encript(this.tb_Psw.Text.Trim());
             bll.Add(model);
             ViewState["userid"] = bll.GetModelList("userName='******'")[0].id;
         }
     }
 }
Exemple #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(zs.Model.Tbl_User model)
 {
     return(dal.Update(model));
 }
Exemple #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(zs.Model.Tbl_User model)
 {
     return(dal.Add(model));
 }