示例#1
0
 private void ShowInfo(int UsersID)
 {
     WebDemo.BLL.WebDemo.users   bll   = new WebDemo.BLL.WebDemo.users();
     WebDemo.Model.WebDemo.users model = bll.GetModel(UsersID);
     this.lblUsersID.Text       = model.UsersID.ToString();
     this.lblUserCode.Text      = model.UserCode;
     this.lblUserName.Text      = model.UserName;
     this.lblDoorplate.Text     = model.Doorplate;
     this.lblPaperType.Text     = model.PaperType;
     this.lblPaperNo.Text       = model.PaperNo;
     this.lblAddress.Text       = model.Address;
     this.lblPhone.Text         = model.Phone;
     this.lblTel.Text           = model.Tel;
     this.lblAcreage.Text       = model.Acreage.ToString();
     this.lblChargeAcreage.Text = model.ChargeAcreage.ToString();
     this.lblReserve.Text       = model.Reserve.ToString();
     this.lblSex.Text           = model.Sex;
     this.lblPopulace.Text      = model.Populace.ToString();
     this.lblRemark.Text        = model.Remark;
     this.lblMark.Text          = model.Mark.ToString();
     this.lblDeptID.Text        = model.DeptID;
     this.lblUserFloor.Text     = model.UserFloor;
     this.lblHouseDir.Text      = model.HouseDir;
     this.lblUserType.Text      = model.UserType;
     this.lblClientId.Text      = model.ClientId;
     this.lblRemnant.Text       = model.Remnant.ToString();
     this.lblRemnant2.Text      = model.Remnant2.ToString();
     this.lblRemnant3.Text      = model.Remnant3.ToString();
     this.lblUpdateTime.Text    = model.UpdateTime.ToString();
     this.lblRegistPhone.Text   = model.RegistPhone;
     this.lblEInvoiceType.Text  = model.EInvoiceType.ToString();
 }
示例#2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WebDemo.Model.WebDemo.users GetModel(int UsersID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 UsersID,UserCode,UserName,Doorplate,PaperType,PaperNo,Address,Phone,Tel,Acreage,ChargeAcreage,Reserve,Sex,Populace,Remark,Mark,DeptID,UserFloor,HouseDir,UserType,ClientId,Remnant,Remnant2,Remnant3,UpdateTime,RegistPhone,EInvoiceType from users ");
            strSql.Append(" where UsersID=@UsersID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UsersID", SqlDbType.Int, 4)
            };
            parameters[0].Value = UsersID;

            WebDemo.Model.WebDemo.users model = new WebDemo.Model.WebDemo.users();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#3
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtUserCode.Text.Trim().Length == 0)
            {
                strErr += "用户编号,不能重复不能为空!\\n";
            }
            if (this.txtUserName.Text.Trim().Length == 0)
            {
                strErr += "UserName不能为空!\\n";
            }
            if (this.txtDoorplate.Text.Trim().Length == 0)
            {
                strErr += "Doorplate不能为空!\\n";
            }
            if (this.txtPaperType.Text.Trim().Length == 0)
            {
                strErr += "PaperType不能为空!\\n";
            }
            if (this.txtPaperNo.Text.Trim().Length == 0)
            {
                strErr += "PaperNo不能为空!\\n";
            }
            if (this.txtAddress.Text.Trim().Length == 0)
            {
                strErr += "Address不能为空!\\n";
            }
            if (this.txtPhone.Text.Trim().Length == 0)
            {
                strErr += "Phone不能为空!\\n";
            }
            if (this.txtTel.Text.Trim().Length == 0)
            {
                strErr += "Tel不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtAcreage.Text))
            {
                strErr += "住房面积格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtChargeAcreage.Text))
            {
                strErr += "收费面积格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtReserve.Text))
            {
                strErr += "余额格式错误!\\n";
            }
            if (this.txtSex.Text.Trim().Length == 0)
            {
                strErr += "性别不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtPopulace.Text))
            {
                strErr += "人口格式错误!\\n";
            }
            if (this.txtRemark.Text.Trim().Length == 0)
            {
                strErr += "Remark不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtMark.Text))
            {
                strErr += "状态 1正常 2销户格式错误!\\n";
            }
            if (this.txtDeptID.Text.Trim().Length == 0)
            {
                strErr += "DeptID不能为空!\\n";
            }
            if (this.txtUserFloor.Text.Trim().Length == 0)
            {
                strErr += "UserFloor不能为空!\\n";
            }
            if (this.txtHouseDir.Text.Trim().Length == 0)
            {
                strErr += "HouseDir不能为空!\\n";
            }
            if (this.txtUserType.Text.Trim().Length == 0)
            {
                strErr += "UserType不能为空!\\n";
            }
            if (this.txtClientId.Text.Trim().Length == 0)
            {
                strErr += "ClientId不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtRemnant.Text))
            {
                strErr += "Remnant格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtRemnant2.Text))
            {
                strErr += "Remnant2格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtRemnant3.Text))
            {
                strErr += "Remnant3格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtUpdateTime.Text))
            {
                strErr += "UpdateTime格式错误!\\n";
            }
            if (this.txtRegistPhone.Text.Trim().Length == 0)
            {
                strErr += "RegistPhone不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtEInvoiceType.Text))
            {
                strErr += "EInvoiceType格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      UsersID       = int.Parse(this.lblUsersID.Text);
            string   UserCode      = this.txtUserCode.Text;
            string   UserName      = this.txtUserName.Text;
            string   Doorplate     = this.txtDoorplate.Text;
            string   PaperType     = this.txtPaperType.Text;
            string   PaperNo       = this.txtPaperNo.Text;
            string   Address       = this.txtAddress.Text;
            string   Phone         = this.txtPhone.Text;
            string   Tel           = this.txtTel.Text;
            decimal  Acreage       = decimal.Parse(this.txtAcreage.Text);
            decimal  ChargeAcreage = decimal.Parse(this.txtChargeAcreage.Text);
            decimal  Reserve       = decimal.Parse(this.txtReserve.Text);
            string   Sex           = this.txtSex.Text;
            int      Populace      = int.Parse(this.txtPopulace.Text);
            string   Remark        = this.txtRemark.Text;
            int      Mark          = int.Parse(this.txtMark.Text);
            string   DeptID        = this.txtDeptID.Text;
            string   UserFloor     = this.txtUserFloor.Text;
            string   HouseDir      = this.txtHouseDir.Text;
            string   UserType      = this.txtUserType.Text;
            string   ClientId      = this.txtClientId.Text;
            decimal  Remnant       = decimal.Parse(this.txtRemnant.Text);
            decimal  Remnant2      = decimal.Parse(this.txtRemnant2.Text);
            decimal  Remnant3      = decimal.Parse(this.txtRemnant3.Text);
            DateTime UpdateTime    = DateTime.Parse(this.txtUpdateTime.Text);
            string   RegistPhone   = this.txtRegistPhone.Text;
            int      EInvoiceType  = int.Parse(this.txtEInvoiceType.Text);


            WebDemo.Model.WebDemo.users model = new WebDemo.Model.WebDemo.users();
            model.UsersID       = UsersID;
            model.UserCode      = UserCode;
            model.UserName      = UserName;
            model.Doorplate     = Doorplate;
            model.PaperType     = PaperType;
            model.PaperNo       = PaperNo;
            model.Address       = Address;
            model.Phone         = Phone;
            model.Tel           = Tel;
            model.Acreage       = Acreage;
            model.ChargeAcreage = ChargeAcreage;
            model.Reserve       = Reserve;
            model.Sex           = Sex;
            model.Populace      = Populace;
            model.Remark        = Remark;
            model.Mark          = Mark;
            model.DeptID        = DeptID;
            model.UserFloor     = UserFloor;
            model.HouseDir      = HouseDir;
            model.UserType      = UserType;
            model.ClientId      = ClientId;
            model.Remnant       = Remnant;
            model.Remnant2      = Remnant2;
            model.Remnant3      = Remnant3;
            model.UpdateTime    = UpdateTime;
            model.RegistPhone   = RegistPhone;
            model.EInvoiceType  = EInvoiceType;

            WebDemo.BLL.WebDemo.users bll = new WebDemo.BLL.WebDemo.users();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
示例#4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(WebDemo.Model.WebDemo.users model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into users(");
            strSql.Append("UsersID,UserCode,UserName,Doorplate,PaperType,PaperNo,Address,Phone,Tel,Acreage,ChargeAcreage,Reserve,Sex,Populace,Remark,Mark,DeptID,UserFloor,HouseDir,UserType,ClientId,Remnant,Remnant2,Remnant3,UpdateTime,RegistPhone,EInvoiceType)");
            strSql.Append(" values (");
            strSql.Append("@UsersID,@UserCode,@UserName,@Doorplate,@PaperType,@PaperNo,@Address,@Phone,@Tel,@Acreage,@ChargeAcreage,@Reserve,@Sex,@Populace,@Remark,@Mark,@DeptID,@UserFloor,@HouseDir,@UserType,@ClientId,@Remnant,@Remnant2,@Remnant3,@UpdateTime,@RegistPhone,@EInvoiceType)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UsersID",       SqlDbType.Int,         4),
                new SqlParameter("@UserCode",      SqlDbType.VarChar,    50),
                new SqlParameter("@UserName",      SqlDbType.VarChar,   100),
                new SqlParameter("@Doorplate",     SqlDbType.VarChar,    50),
                new SqlParameter("@PaperType",     SqlDbType.VarChar,    50),
                new SqlParameter("@PaperNo",       SqlDbType.VarChar,    50),
                new SqlParameter("@Address",       SqlDbType.VarChar,   200),
                new SqlParameter("@Phone",         SqlDbType.VarChar,    50),
                new SqlParameter("@Tel",           SqlDbType.VarChar,    50),
                new SqlParameter("@Acreage",       SqlDbType.Decimal,     9),
                new SqlParameter("@ChargeAcreage", SqlDbType.Decimal,     9),
                new SqlParameter("@Reserve",       SqlDbType.Decimal,     9),
                new SqlParameter("@Sex",           SqlDbType.VarChar,    20),
                new SqlParameter("@Populace",      SqlDbType.Int,         4),
                new SqlParameter("@Remark",        SqlDbType.VarChar,   200),
                new SqlParameter("@Mark",          SqlDbType.Int,         4),
                new SqlParameter("@DeptID",        SqlDbType.VarChar,    60),
                new SqlParameter("@UserFloor",     SqlDbType.VarChar,    50),
                new SqlParameter("@HouseDir",      SqlDbType.VarChar,    50),
                new SqlParameter("@UserType",      SqlDbType.VarChar,     5),
                new SqlParameter("@ClientId",      SqlDbType.VarChar,    50),
                new SqlParameter("@Remnant",       SqlDbType.Decimal,     9),
                new SqlParameter("@Remnant2",      SqlDbType.Decimal,     9),
                new SqlParameter("@Remnant3",      SqlDbType.Decimal,     9),
                new SqlParameter("@UpdateTime",    SqlDbType.DateTime),
                new SqlParameter("@RegistPhone",   SqlDbType.VarChar,    50),
                new SqlParameter("@EInvoiceType",  SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.UsersID;
            parameters[1].Value  = model.UserCode;
            parameters[2].Value  = model.UserName;
            parameters[3].Value  = model.Doorplate;
            parameters[4].Value  = model.PaperType;
            parameters[5].Value  = model.PaperNo;
            parameters[6].Value  = model.Address;
            parameters[7].Value  = model.Phone;
            parameters[8].Value  = model.Tel;
            parameters[9].Value  = model.Acreage;
            parameters[10].Value = model.ChargeAcreage;
            parameters[11].Value = model.Reserve;
            parameters[12].Value = model.Sex;
            parameters[13].Value = model.Populace;
            parameters[14].Value = model.Remark;
            parameters[15].Value = model.Mark;
            parameters[16].Value = model.DeptID;
            parameters[17].Value = model.UserFloor;
            parameters[18].Value = model.HouseDir;
            parameters[19].Value = model.UserType;
            parameters[20].Value = model.ClientId;
            parameters[21].Value = model.Remnant;
            parameters[22].Value = model.Remnant2;
            parameters[23].Value = model.Remnant3;
            parameters[24].Value = model.UpdateTime;
            parameters[25].Value = model.RegistPhone;
            parameters[26].Value = model.EInvoiceType;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WebDemo.Model.WebDemo.users DataRowToModel(DataRow row)
 {
     WebDemo.Model.WebDemo.users model = new WebDemo.Model.WebDemo.users();
     if (row != null)
     {
         if (row["UsersID"] != null && row["UsersID"].ToString() != "")
         {
             model.UsersID = int.Parse(row["UsersID"].ToString());
         }
         if (row["UserCode"] != null)
         {
             model.UserCode = row["UserCode"].ToString();
         }
         if (row["UserName"] != null)
         {
             model.UserName = row["UserName"].ToString();
         }
         if (row["Doorplate"] != null)
         {
             model.Doorplate = row["Doorplate"].ToString();
         }
         if (row["PaperType"] != null)
         {
             model.PaperType = row["PaperType"].ToString();
         }
         if (row["PaperNo"] != null)
         {
             model.PaperNo = row["PaperNo"].ToString();
         }
         if (row["Address"] != null)
         {
             model.Address = row["Address"].ToString();
         }
         if (row["Phone"] != null)
         {
             model.Phone = row["Phone"].ToString();
         }
         if (row["Tel"] != null)
         {
             model.Tel = row["Tel"].ToString();
         }
         if (row["Acreage"] != null && row["Acreage"].ToString() != "")
         {
             model.Acreage = decimal.Parse(row["Acreage"].ToString());
         }
         if (row["ChargeAcreage"] != null && row["ChargeAcreage"].ToString() != "")
         {
             model.ChargeAcreage = decimal.Parse(row["ChargeAcreage"].ToString());
         }
         if (row["Reserve"] != null && row["Reserve"].ToString() != "")
         {
             model.Reserve = decimal.Parse(row["Reserve"].ToString());
         }
         if (row["Sex"] != null)
         {
             model.Sex = row["Sex"].ToString();
         }
         if (row["Populace"] != null && row["Populace"].ToString() != "")
         {
             model.Populace = int.Parse(row["Populace"].ToString());
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
         if (row["Mark"] != null && row["Mark"].ToString() != "")
         {
             model.Mark = int.Parse(row["Mark"].ToString());
         }
         if (row["DeptID"] != null)
         {
             model.DeptID = row["DeptID"].ToString();
         }
         if (row["UserFloor"] != null)
         {
             model.UserFloor = row["UserFloor"].ToString();
         }
         if (row["HouseDir"] != null)
         {
             model.HouseDir = row["HouseDir"].ToString();
         }
         if (row["UserType"] != null)
         {
             model.UserType = row["UserType"].ToString();
         }
         if (row["ClientId"] != null)
         {
             model.ClientId = row["ClientId"].ToString();
         }
         if (row["Remnant"] != null && row["Remnant"].ToString() != "")
         {
             model.Remnant = decimal.Parse(row["Remnant"].ToString());
         }
         if (row["Remnant2"] != null && row["Remnant2"].ToString() != "")
         {
             model.Remnant2 = decimal.Parse(row["Remnant2"].ToString());
         }
         if (row["Remnant3"] != null && row["Remnant3"].ToString() != "")
         {
             model.Remnant3 = decimal.Parse(row["Remnant3"].ToString());
         }
         if (row["UpdateTime"] != null && row["UpdateTime"].ToString() != "")
         {
             model.UpdateTime = DateTime.Parse(row["UpdateTime"].ToString());
         }
         if (row["RegistPhone"] != null)
         {
             model.RegistPhone = row["RegistPhone"].ToString();
         }
         if (row["EInvoiceType"] != null && row["EInvoiceType"].ToString() != "")
         {
             model.EInvoiceType = int.Parse(row["EInvoiceType"].ToString());
         }
     }
     return(model);
 }
示例#6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WebDemo.Model.WebDemo.users model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update users set ");
            strSql.Append("UserCode=@UserCode,");
            strSql.Append("UserName=@UserName,");
            strSql.Append("Doorplate=@Doorplate,");
            strSql.Append("PaperType=@PaperType,");
            strSql.Append("PaperNo=@PaperNo,");
            strSql.Append("Address=@Address,");
            strSql.Append("Phone=@Phone,");
            strSql.Append("Tel=@Tel,");
            strSql.Append("Acreage=@Acreage,");
            strSql.Append("ChargeAcreage=@ChargeAcreage,");
            strSql.Append("Reserve=@Reserve,");
            strSql.Append("Sex=@Sex,");
            strSql.Append("Populace=@Populace,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("Mark=@Mark,");
            strSql.Append("DeptID=@DeptID,");
            strSql.Append("UserFloor=@UserFloor,");
            strSql.Append("HouseDir=@HouseDir,");
            strSql.Append("UserType=@UserType,");
            strSql.Append("ClientId=@ClientId,");
            strSql.Append("Remnant=@Remnant,");
            strSql.Append("Remnant2=@Remnant2,");
            strSql.Append("Remnant3=@Remnant3,");
            strSql.Append("UpdateTime=@UpdateTime,");
            strSql.Append("RegistPhone=@RegistPhone,");
            strSql.Append("EInvoiceType=@EInvoiceType");
            strSql.Append(" where UsersID=@UsersID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserCode",      SqlDbType.VarChar,    50),
                new SqlParameter("@UserName",      SqlDbType.VarChar,   100),
                new SqlParameter("@Doorplate",     SqlDbType.VarChar,    50),
                new SqlParameter("@PaperType",     SqlDbType.VarChar,    50),
                new SqlParameter("@PaperNo",       SqlDbType.VarChar,    50),
                new SqlParameter("@Address",       SqlDbType.VarChar,   200),
                new SqlParameter("@Phone",         SqlDbType.VarChar,    50),
                new SqlParameter("@Tel",           SqlDbType.VarChar,    50),
                new SqlParameter("@Acreage",       SqlDbType.Decimal,     9),
                new SqlParameter("@ChargeAcreage", SqlDbType.Decimal,     9),
                new SqlParameter("@Reserve",       SqlDbType.Decimal,     9),
                new SqlParameter("@Sex",           SqlDbType.VarChar,    20),
                new SqlParameter("@Populace",      SqlDbType.Int,         4),
                new SqlParameter("@Remark",        SqlDbType.VarChar,   200),
                new SqlParameter("@Mark",          SqlDbType.Int,         4),
                new SqlParameter("@DeptID",        SqlDbType.VarChar,    60),
                new SqlParameter("@UserFloor",     SqlDbType.VarChar,    50),
                new SqlParameter("@HouseDir",      SqlDbType.VarChar,    50),
                new SqlParameter("@UserType",      SqlDbType.VarChar,     5),
                new SqlParameter("@ClientId",      SqlDbType.VarChar,    50),
                new SqlParameter("@Remnant",       SqlDbType.Decimal,     9),
                new SqlParameter("@Remnant2",      SqlDbType.Decimal,     9),
                new SqlParameter("@Remnant3",      SqlDbType.Decimal,     9),
                new SqlParameter("@UpdateTime",    SqlDbType.DateTime),
                new SqlParameter("@RegistPhone",   SqlDbType.VarChar,    50),
                new SqlParameter("@EInvoiceType",  SqlDbType.Int,         4),
                new SqlParameter("@UsersID",       SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.UserCode;
            parameters[1].Value  = model.UserName;
            parameters[2].Value  = model.Doorplate;
            parameters[3].Value  = model.PaperType;
            parameters[4].Value  = model.PaperNo;
            parameters[5].Value  = model.Address;
            parameters[6].Value  = model.Phone;
            parameters[7].Value  = model.Tel;
            parameters[8].Value  = model.Acreage;
            parameters[9].Value  = model.ChargeAcreage;
            parameters[10].Value = model.Reserve;
            parameters[11].Value = model.Sex;
            parameters[12].Value = model.Populace;
            parameters[13].Value = model.Remark;
            parameters[14].Value = model.Mark;
            parameters[15].Value = model.DeptID;
            parameters[16].Value = model.UserFloor;
            parameters[17].Value = model.HouseDir;
            parameters[18].Value = model.UserType;
            parameters[19].Value = model.ClientId;
            parameters[20].Value = model.Remnant;
            parameters[21].Value = model.Remnant2;
            parameters[22].Value = model.Remnant3;
            parameters[23].Value = model.UpdateTime;
            parameters[24].Value = model.RegistPhone;
            parameters[25].Value = model.EInvoiceType;
            parameters[26].Value = model.UsersID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }