private void ShowInfo() { MyERP.BLL.VIP_GRADE bll = new MyERP.BLL.VIP_GRADE(); MyERP.Model.VIP_GRADE model = bll.GetModel(); this.txtCOMPANY_CODE.Text = model.COMPANY_CODE; this.txtGRADE_CODE.Text = model.GRADE_CODE; this.txtGRADE_NAME.Text = model.GRADE_NAME; this.txtGRADE_TYPE.Text = model.GRADE_TYPE; this.txtindate.Text = model.indate.ToString(); this.txtoutdate.Text = model.outdate.ToString(); this.txtLOW_SALES.Text = model.LOW_SALES.ToString(); this.txtTOTAL_SALES.Text = model.TOTAL_SALES.ToString(); this.txtzsrgrade.Text = model.zsrgrade.ToString(); this.txtstandrate.Text = model.standrate.ToString(); this.txtspecialrate.Text = model.specialrate.ToString(); this.txtbirthdayrate.Text = model.birthdayrate.ToString(); this.txtbirthdayspsrate.Text = model.birthdayspsrate.ToString(); this.txtyear_option.Text = model.year_option.ToString(); this.txtrun.Text = model.run; this.txtCREATE_NAME.Text = model.CREATE_NAME; this.txtCREATE_DATE.Text = model.CREATE_DATE.ToString(); this.txtUPDATE_NAME.Text = model.UPDATE_NAME; this.txtUPDATE_DATE.Text = model.UPDATE_DATE.ToString(); this.txtREMARK.Text = model.REMARK; }
private void ShowInfo() { MyERP.BLL.VIP_GRADE bll = new MyERP.BLL.VIP_GRADE(); MyERP.Model.VIP_GRADE model = bll.GetModel(); this.lblCOMPANY_CODE.Text = model.COMPANY_CODE; this.lblGRADE_CODE.Text = model.GRADE_CODE; this.lblGRADE_NAME.Text = model.GRADE_NAME; this.lblGRADE_TYPE.Text = model.GRADE_TYPE; this.lblindate.Text = model.indate.ToString(); this.lbloutdate.Text = model.outdate.ToString(); this.lblLOW_SALES.Text = model.LOW_SALES.ToString(); this.lblTOTAL_SALES.Text = model.TOTAL_SALES.ToString(); this.lblzsrgrade.Text = model.zsrgrade.ToString(); this.lblstandrate.Text = model.standrate.ToString(); this.lblspecialrate.Text = model.specialrate.ToString(); this.lblbirthdayrate.Text = model.birthdayrate.ToString(); this.lblbirthdayspsrate.Text = model.birthdayspsrate.ToString(); this.lblyear_option.Text = model.year_option.ToString(); this.lblrun.Text = model.run; this.lblCREATE_NAME.Text = model.CREATE_NAME; this.lblCREATE_DATE.Text = model.CREATE_DATE.ToString(); this.lblUPDATE_NAME.Text = model.UPDATE_NAME; this.lblUPDATE_DATE.Text = model.UPDATE_DATE.ToString(); this.lblREMARK.Text = model.REMARK; }
/// <summary> /// 得到一个对象实体 /// </summary> public MyERP.Model.VIP_GRADE GetModel() { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 COMPANY_CODE,GRADE_CODE,GRADE_NAME,GRADE_TYPE,indate,outdate,LOW_SALES,TOTAL_SALES,zsrgrade,standrate,specialrate,birthdayrate,birthdayspsrate,year_option,run,CREATE_NAME,CREATE_DATE,UPDATE_NAME,UPDATE_DATE,REMARK from VIP_GRADE "); strSql.Append(" where "); SqlParameter[] parameters = { }; MyERP.Model.VIP_GRADE model = new MyERP.Model.VIP_GRADE(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtCOMPANY_CODE.Text.Trim().Length == 0) { strErr += "COMPANY_CODE不能为空!\\n"; } if (this.txtGRADE_CODE.Text.Trim().Length == 0) { strErr += "GRADE_CODE不能为空!\\n"; } if (this.txtGRADE_NAME.Text.Trim().Length == 0) { strErr += "GRADE_NAME不能为空!\\n"; } if (this.txtGRADE_TYPE.Text.Trim().Length == 0) { strErr += "GRADE_TYPE不能为空!\\n"; } if (!PageValidate.IsDateTime(txtindate.Text)) { strErr += "indate格式错误!\\n"; } if (!PageValidate.IsDateTime(txtoutdate.Text)) { strErr += "outdate格式错误!\\n"; } if (!PageValidate.IsDecimal(txtLOW_SALES.Text)) { strErr += "LOW_SALES格式错误!\\n"; } if (!PageValidate.IsDecimal(txtTOTAL_SALES.Text)) { strErr += "TOTAL_SALES格式错误!\\n"; } if (!PageValidate.IsDecimal(txtzsrgrade.Text)) { strErr += "zsrgrade格式错误!\\n"; } if (!PageValidate.IsDecimal(txtstandrate.Text)) { strErr += "standrate格式错误!\\n"; } if (!PageValidate.IsDecimal(txtspecialrate.Text)) { strErr += "specialrate格式错误!\\n"; } if (!PageValidate.IsDecimal(txtbirthdayrate.Text)) { strErr += "birthdayrate格式错误!\\n"; } if (!PageValidate.IsDecimal(txtbirthdayspsrate.Text)) { strErr += "birthdayspsrate格式错误!\\n"; } if (!PageValidate.IsDecimal(txtyear_option.Text)) { strErr += "year_option格式错误!\\n"; } if (this.txtrun.Text.Trim().Length == 0) { strErr += "run不能为空!\\n"; } if (this.txtCREATE_NAME.Text.Trim().Length == 0) { strErr += "CREATE_NAME不能为空!\\n"; } if (!PageValidate.IsDateTime(txtCREATE_DATE.Text)) { strErr += "CREATE_DATE格式错误!\\n"; } if (this.txtUPDATE_NAME.Text.Trim().Length == 0) { strErr += "UPDATE_NAME不能为空!\\n"; } if (!PageValidate.IsDateTime(txtUPDATE_DATE.Text)) { strErr += "UPDATE_DATE格式错误!\\n"; } if (this.txtREMARK.Text.Trim().Length == 0) { strErr += "REMARK不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string COMPANY_CODE = this.txtCOMPANY_CODE.Text; string GRADE_CODE = this.txtGRADE_CODE.Text; string GRADE_NAME = this.txtGRADE_NAME.Text; string GRADE_TYPE = this.txtGRADE_TYPE.Text; DateTime indate = DateTime.Parse(this.txtindate.Text); DateTime outdate = DateTime.Parse(this.txtoutdate.Text); decimal LOW_SALES = decimal.Parse(this.txtLOW_SALES.Text); decimal TOTAL_SALES = decimal.Parse(this.txtTOTAL_SALES.Text); decimal zsrgrade = decimal.Parse(this.txtzsrgrade.Text); decimal standrate = decimal.Parse(this.txtstandrate.Text); decimal specialrate = decimal.Parse(this.txtspecialrate.Text); decimal birthdayrate = decimal.Parse(this.txtbirthdayrate.Text); decimal birthdayspsrate = decimal.Parse(this.txtbirthdayspsrate.Text); decimal year_option = decimal.Parse(this.txtyear_option.Text); string run = this.txtrun.Text; string CREATE_NAME = this.txtCREATE_NAME.Text; DateTime CREATE_DATE = DateTime.Parse(this.txtCREATE_DATE.Text); string UPDATE_NAME = this.txtUPDATE_NAME.Text; DateTime UPDATE_DATE = DateTime.Parse(this.txtUPDATE_DATE.Text); string REMARK = this.txtREMARK.Text; MyERP.Model.VIP_GRADE model = new MyERP.Model.VIP_GRADE(); model.COMPANY_CODE = COMPANY_CODE; model.GRADE_CODE = GRADE_CODE; model.GRADE_NAME = GRADE_NAME; model.GRADE_TYPE = GRADE_TYPE; model.indate = indate; model.outdate = outdate; model.LOW_SALES = LOW_SALES; model.TOTAL_SALES = TOTAL_SALES; model.zsrgrade = zsrgrade; model.standrate = standrate; model.specialrate = specialrate; model.birthdayrate = birthdayrate; model.birthdayspsrate = birthdayspsrate; model.year_option = year_option; model.run = run; model.CREATE_NAME = CREATE_NAME; model.CREATE_DATE = CREATE_DATE; model.UPDATE_NAME = UPDATE_NAME; model.UPDATE_DATE = UPDATE_DATE; model.REMARK = REMARK; MyERP.BLL.VIP_GRADE bll = new MyERP.BLL.VIP_GRADE(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(MyERP.Model.VIP_GRADE model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update VIP_GRADE set "); strSql.Append("COMPANY_CODE=@COMPANY_CODE,"); strSql.Append("GRADE_CODE=@GRADE_CODE,"); strSql.Append("GRADE_NAME=@GRADE_NAME,"); strSql.Append("GRADE_TYPE=@GRADE_TYPE,"); strSql.Append("indate=@indate,"); strSql.Append("outdate=@outdate,"); strSql.Append("LOW_SALES=@LOW_SALES,"); strSql.Append("TOTAL_SALES=@TOTAL_SALES,"); strSql.Append("zsrgrade=@zsrgrade,"); strSql.Append("standrate=@standrate,"); strSql.Append("specialrate=@specialrate,"); strSql.Append("birthdayrate=@birthdayrate,"); strSql.Append("birthdayspsrate=@birthdayspsrate,"); strSql.Append("year_option=@year_option,"); strSql.Append("run=@run,"); strSql.Append("CREATE_NAME=@CREATE_NAME,"); strSql.Append("CREATE_DATE=@CREATE_DATE,"); strSql.Append("UPDATE_NAME=@UPDATE_NAME,"); strSql.Append("UPDATE_DATE=@UPDATE_DATE,"); strSql.Append("REMARK=@REMARK"); strSql.Append(" where "); SqlParameter[] parameters = { new SqlParameter("@COMPANY_CODE", SqlDbType.VarChar, 40), new SqlParameter("@GRADE_CODE", SqlDbType.VarChar, 40), new SqlParameter("@GRADE_NAME", SqlDbType.VarChar, 20), new SqlParameter("@GRADE_TYPE", SqlDbType.VarChar, 30), new SqlParameter("@indate", SqlDbType.DateTime), new SqlParameter("@outdate", SqlDbType.DateTime), new SqlParameter("@LOW_SALES", SqlDbType.Decimal, 17), new SqlParameter("@TOTAL_SALES", SqlDbType.Decimal, 17), new SqlParameter("@zsrgrade", SqlDbType.Decimal, 9), new SqlParameter("@standrate", SqlDbType.Decimal, 5), new SqlParameter("@specialrate", SqlDbType.Decimal, 5), new SqlParameter("@birthdayrate", SqlDbType.Decimal, 5), new SqlParameter("@birthdayspsrate", SqlDbType.Decimal, 5), new SqlParameter("@year_option", SqlDbType.Decimal, 5), new SqlParameter("@run", SqlDbType.VarChar, 10), new SqlParameter("@CREATE_NAME", SqlDbType.VarChar, 20), new SqlParameter("@CREATE_DATE", SqlDbType.DateTime), new SqlParameter("@UPDATE_NAME", SqlDbType.VarChar, 20), new SqlParameter("@UPDATE_DATE", SqlDbType.DateTime), new SqlParameter("@REMARK", SqlDbType.VarChar, 100) }; parameters[0].Value = model.COMPANY_CODE; parameters[1].Value = model.GRADE_CODE; parameters[2].Value = model.GRADE_NAME; parameters[3].Value = model.GRADE_TYPE; parameters[4].Value = model.indate; parameters[5].Value = model.outdate; parameters[6].Value = model.LOW_SALES; parameters[7].Value = model.TOTAL_SALES; parameters[8].Value = model.zsrgrade; parameters[9].Value = model.standrate; parameters[10].Value = model.specialrate; parameters[11].Value = model.birthdayrate; parameters[12].Value = model.birthdayspsrate; parameters[13].Value = model.year_option; parameters[14].Value = model.run; parameters[15].Value = model.CREATE_NAME; parameters[16].Value = model.CREATE_DATE; parameters[17].Value = model.UPDATE_NAME; parameters[18].Value = model.UPDATE_DATE; parameters[19].Value = model.REMARK; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(MyERP.Model.VIP_GRADE model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into VIP_GRADE("); strSql.Append("COMPANY_CODE,GRADE_CODE,GRADE_NAME,GRADE_TYPE,indate,outdate,LOW_SALES,TOTAL_SALES,zsrgrade,standrate,specialrate,birthdayrate,birthdayspsrate,year_option,run,CREATE_NAME,CREATE_DATE,UPDATE_NAME,UPDATE_DATE,REMARK)"); strSql.Append(" values ("); strSql.Append("@COMPANY_CODE,@GRADE_CODE,@GRADE_NAME,@GRADE_TYPE,@indate,@outdate,@LOW_SALES,@TOTAL_SALES,@zsrgrade,@standrate,@specialrate,@birthdayrate,@birthdayspsrate,@year_option,@run,@CREATE_NAME,@CREATE_DATE,@UPDATE_NAME,@UPDATE_DATE,@REMARK)"); SqlParameter[] parameters = { new SqlParameter("@COMPANY_CODE", SqlDbType.VarChar, 40), new SqlParameter("@GRADE_CODE", SqlDbType.VarChar, 40), new SqlParameter("@GRADE_NAME", SqlDbType.VarChar, 20), new SqlParameter("@GRADE_TYPE", SqlDbType.VarChar, 30), new SqlParameter("@indate", SqlDbType.DateTime), new SqlParameter("@outdate", SqlDbType.DateTime), new SqlParameter("@LOW_SALES", SqlDbType.Decimal, 17), new SqlParameter("@TOTAL_SALES", SqlDbType.Decimal, 17), new SqlParameter("@zsrgrade", SqlDbType.Decimal, 9), new SqlParameter("@standrate", SqlDbType.Decimal, 5), new SqlParameter("@specialrate", SqlDbType.Decimal, 5), new SqlParameter("@birthdayrate", SqlDbType.Decimal, 5), new SqlParameter("@birthdayspsrate", SqlDbType.Decimal, 5), new SqlParameter("@year_option", SqlDbType.Decimal, 5), new SqlParameter("@run", SqlDbType.VarChar, 10), new SqlParameter("@CREATE_NAME", SqlDbType.VarChar, 20), new SqlParameter("@CREATE_DATE", SqlDbType.DateTime), new SqlParameter("@UPDATE_NAME", SqlDbType.VarChar, 20), new SqlParameter("@UPDATE_DATE", SqlDbType.DateTime), new SqlParameter("@REMARK", SqlDbType.VarChar, 100) }; parameters[0].Value = model.COMPANY_CODE; parameters[1].Value = model.GRADE_CODE; parameters[2].Value = model.GRADE_NAME; parameters[3].Value = model.GRADE_TYPE; parameters[4].Value = model.indate; parameters[5].Value = model.outdate; parameters[6].Value = model.LOW_SALES; parameters[7].Value = model.TOTAL_SALES; parameters[8].Value = model.zsrgrade; parameters[9].Value = model.standrate; parameters[10].Value = model.specialrate; parameters[11].Value = model.birthdayrate; parameters[12].Value = model.birthdayspsrate; parameters[13].Value = model.year_option; parameters[14].Value = model.run; parameters[15].Value = model.CREATE_NAME; parameters[16].Value = model.CREATE_DATE; parameters[17].Value = model.UPDATE_NAME; parameters[18].Value = model.UPDATE_DATE; parameters[19].Value = model.REMARK; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public MyERP.Model.VIP_GRADE DataRowToModel(DataRow row) { MyERP.Model.VIP_GRADE model = new MyERP.Model.VIP_GRADE(); if (row != null) { if (row["COMPANY_CODE"] != null) { model.COMPANY_CODE = row["COMPANY_CODE"].ToString(); } if (row["GRADE_CODE"] != null) { model.GRADE_CODE = row["GRADE_CODE"].ToString(); } if (row["GRADE_NAME"] != null) { model.GRADE_NAME = row["GRADE_NAME"].ToString(); } if (row["GRADE_TYPE"] != null) { model.GRADE_TYPE = row["GRADE_TYPE"].ToString(); } if (row["indate"] != null && row["indate"].ToString() != "") { model.indate = DateTime.Parse(row["indate"].ToString()); } if (row["outdate"] != null && row["outdate"].ToString() != "") { model.outdate = DateTime.Parse(row["outdate"].ToString()); } if (row["LOW_SALES"] != null && row["LOW_SALES"].ToString() != "") { model.LOW_SALES = decimal.Parse(row["LOW_SALES"].ToString()); } if (row["TOTAL_SALES"] != null && row["TOTAL_SALES"].ToString() != "") { model.TOTAL_SALES = decimal.Parse(row["TOTAL_SALES"].ToString()); } if (row["zsrgrade"] != null && row["zsrgrade"].ToString() != "") { model.zsrgrade = decimal.Parse(row["zsrgrade"].ToString()); } if (row["standrate"] != null && row["standrate"].ToString() != "") { model.standrate = decimal.Parse(row["standrate"].ToString()); } if (row["specialrate"] != null && row["specialrate"].ToString() != "") { model.specialrate = decimal.Parse(row["specialrate"].ToString()); } if (row["birthdayrate"] != null && row["birthdayrate"].ToString() != "") { model.birthdayrate = decimal.Parse(row["birthdayrate"].ToString()); } if (row["birthdayspsrate"] != null && row["birthdayspsrate"].ToString() != "") { model.birthdayspsrate = decimal.Parse(row["birthdayspsrate"].ToString()); } if (row["year_option"] != null && row["year_option"].ToString() != "") { model.year_option = decimal.Parse(row["year_option"].ToString()); } if (row["run"] != null) { model.run = row["run"].ToString(); } if (row["CREATE_NAME"] != null) { model.CREATE_NAME = row["CREATE_NAME"].ToString(); } if (row["CREATE_DATE"] != null && row["CREATE_DATE"].ToString() != "") { model.CREATE_DATE = DateTime.Parse(row["CREATE_DATE"].ToString()); } if (row["UPDATE_NAME"] != null) { model.UPDATE_NAME = row["UPDATE_NAME"].ToString(); } if (row["UPDATE_DATE"] != null && row["UPDATE_DATE"].ToString() != "") { model.UPDATE_DATE = DateTime.Parse(row["UPDATE_DATE"].ToString()); } if (row["REMARK"] != null) { model.REMARK = row["REMARK"].ToString(); } } return(model); }