private void ShowInfo() { MyERP.BLL.ORDER_CG_DETAIL bll = new MyERP.BLL.ORDER_CG_DETAIL(); MyERP.Model.ORDER_CG_DETAIL model = bll.GetModel(); this.lblSEQUENCE.Text = model.SEQUENCE.ToString(); this.lblMASTERID.Text = model.MASTERID; this.lblDETAILID.Text = model.DETAILID; this.lblBILLNO.Text = model.BILLNO; this.lblITEM_INTERNAL_CODE.Text = model.ITEM_INTERNAL_CODE; this.lblITEM_CODE.Text = model.ITEM_CODE; this.lblITEM_NAME.Text = model.ITEM_NAME; this.lblITEM_COLOR.Text = model.ITEM_COLOR; this.lblITEM_TYPE.Text = model.ITEM_TYPE; this.lblSPECIFICATIONS.Text = model.SPECIFICATIONS; this.lblMEASURE_UNIT.Text = model.MEASURE_UNIT; this.lblITEM_CZ.Text = model.ITEM_CZ; this.lblITEM_LH.Text = model.ITEM_LH.ToString(); this.lblITEM_LK.Text = model.ITEM_LK.ToString(); this.lblITEM_BJ.Text = model.ITEM_BJ.ToString(); this.lblITEM_JZ.Text = model.ITEM_JZ.ToString(); this.lblITEM_HZ.Text = model.ITEM_HZ.ToString(); this.lblITEM_rate.Text = model.ITEM_rate; this.lblITEM_GYLC.Text = model.ITEM_GYLC; this.lblNET_PRICE.Text = model.NET_PRICE.ToString(); this.lblPRICE.Text = model.PRICE.ToString(); this.lblQuantity.Text = model.Quantity.ToString(); this.lbltotal_quantity.Text = model.total_quantity.ToString(); this.lblORD_TL.Text = model.ORD_TL; this.lblBARCODE.Text = model.BARCODE; this.lblREMARK.Text = model.REMARK; }
/// <summary> /// 得到一个对象实体 /// </summary> public MyERP.Model.ORDER_CG_DETAIL GetModel() { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 SEQUENCE,MASTERID,DETAILID,BILLNO,ITEM_INTERNAL_CODE,ITEM_CODE,ITEM_NAME,ITEM_COLOR,ITEM_TYPE,SPECIFICATIONS,MEASURE_UNIT,ITEM_CZ,ITEM_LH,ITEM_LK,ITEM_BJ,ITEM_JZ,ITEM_HZ,ITEM_rate,ITEM_GYLC,NET_PRICE,PRICE,Quantity,total_quantity,ORD_TL,BARCODE,REMARK from ORDER_CG_DETAIL "); strSql.Append(" where "); SqlParameter[] parameters = { }; MyERP.Model.ORDER_CG_DETAIL model = new MyERP.Model.ORDER_CG_DETAIL(); 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 (!PageValidate.IsNumber(txtSEQUENCE.Text)) { strErr += "SEQUENCE格式错误!\\n"; } if (this.txtMASTERID.Text.Trim().Length == 0) { strErr += "MASTERID不能为空!\\n"; } if (this.txtDETAILID.Text.Trim().Length == 0) { strErr += "DETAILID不能为空!\\n"; } if (this.txtBILLNO.Text.Trim().Length == 0) { strErr += "BILLNO不能为空!\\n"; } if (this.txtITEM_INTERNAL_CODE.Text.Trim().Length == 0) { strErr += "ITEM_INTERNAL_CODE不能为空!\\n"; } if (this.txtITEM_CODE.Text.Trim().Length == 0) { strErr += "ITEM_CODE不能为空!\\n"; } if (this.txtITEM_NAME.Text.Trim().Length == 0) { strErr += "ITEM_NAME不能为空!\\n"; } if (this.txtITEM_COLOR.Text.Trim().Length == 0) { strErr += "ITEM_COLOR不能为空!\\n"; } if (this.txtITEM_TYPE.Text.Trim().Length == 0) { strErr += "ITEM_TYPE不能为空!\\n"; } if (this.txtSPECIFICATIONS.Text.Trim().Length == 0) { strErr += "SPECIFICATIONS不能为空!\\n"; } if (this.txtMEASURE_UNIT.Text.Trim().Length == 0) { strErr += "MEASURE_UNIT不能为空!\\n"; } if (this.txtITEM_CZ.Text.Trim().Length == 0) { strErr += "ITEM_CZ不能为空!\\n"; } if (!PageValidate.IsDecimal(txtITEM_LH.Text)) { strErr += "ITEM_LH格式错误!\\n"; } if (!PageValidate.IsDecimal(txtITEM_LK.Text)) { strErr += "ITEM_LK格式错误!\\n"; } if (!PageValidate.IsDecimal(txtITEM_BJ.Text)) { strErr += "ITEM_BJ格式错误!\\n"; } if (!PageValidate.IsDecimal(txtITEM_JZ.Text)) { strErr += "ITEM_JZ格式错误!\\n"; } if (!PageValidate.IsDecimal(txtITEM_HZ.Text)) { strErr += "ITEM_HZ格式错误!\\n"; } if (this.txtITEM_rate.Text.Trim().Length == 0) { strErr += "ITEM_rate不能为空!\\n"; } if (this.txtITEM_GYLC.Text.Trim().Length == 0) { strErr += "ITEM_GYLC不能为空!\\n"; } if (!PageValidate.IsDecimal(txtNET_PRICE.Text)) { strErr += "NET_PRICE格式错误!\\n"; } if (!PageValidate.IsDecimal(txtPRICE.Text)) { strErr += "PRICE格式错误!\\n"; } if (!PageValidate.IsDecimal(txtQuantity.Text)) { strErr += "Quantity格式错误!\\n"; } if (!PageValidate.IsDecimal(txttotal_quantity.Text)) { strErr += "total_quantity格式错误!\\n"; } if (this.txtORD_TL.Text.Trim().Length == 0) { strErr += "ORD_TL不能为空!\\n"; } if (this.txtBARCODE.Text.Trim().Length == 0) { strErr += "BARCODE不能为空!\\n"; } if (this.txtREMARK.Text.Trim().Length == 0) { strErr += "REMARK不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int SEQUENCE = int.Parse(this.txtSEQUENCE.Text); string MASTERID = this.txtMASTERID.Text; string DETAILID = this.txtDETAILID.Text; string BILLNO = this.txtBILLNO.Text; string ITEM_INTERNAL_CODE = this.txtITEM_INTERNAL_CODE.Text; string ITEM_CODE = this.txtITEM_CODE.Text; string ITEM_NAME = this.txtITEM_NAME.Text; string ITEM_COLOR = this.txtITEM_COLOR.Text; string ITEM_TYPE = this.txtITEM_TYPE.Text; string SPECIFICATIONS = this.txtSPECIFICATIONS.Text; string MEASURE_UNIT = this.txtMEASURE_UNIT.Text; string ITEM_CZ = this.txtITEM_CZ.Text; decimal ITEM_LH = decimal.Parse(this.txtITEM_LH.Text); decimal ITEM_LK = decimal.Parse(this.txtITEM_LK.Text); decimal ITEM_BJ = decimal.Parse(this.txtITEM_BJ.Text); decimal ITEM_JZ = decimal.Parse(this.txtITEM_JZ.Text); decimal ITEM_HZ = decimal.Parse(this.txtITEM_HZ.Text); string ITEM_rate = this.txtITEM_rate.Text; string ITEM_GYLC = this.txtITEM_GYLC.Text; decimal NET_PRICE = decimal.Parse(this.txtNET_PRICE.Text); decimal PRICE = decimal.Parse(this.txtPRICE.Text); decimal Quantity = decimal.Parse(this.txtQuantity.Text); decimal total_quantity = decimal.Parse(this.txttotal_quantity.Text); string ORD_TL = this.txtORD_TL.Text; string BARCODE = this.txtBARCODE.Text; string REMARK = this.txtREMARK.Text; MyERP.Model.ORDER_CG_DETAIL model = new MyERP.Model.ORDER_CG_DETAIL(); model.SEQUENCE = SEQUENCE; model.MASTERID = MASTERID; model.DETAILID = DETAILID; model.BILLNO = BILLNO; model.ITEM_INTERNAL_CODE = ITEM_INTERNAL_CODE; model.ITEM_CODE = ITEM_CODE; model.ITEM_NAME = ITEM_NAME; model.ITEM_COLOR = ITEM_COLOR; model.ITEM_TYPE = ITEM_TYPE; model.SPECIFICATIONS = SPECIFICATIONS; model.MEASURE_UNIT = MEASURE_UNIT; model.ITEM_CZ = ITEM_CZ; model.ITEM_LH = ITEM_LH; model.ITEM_LK = ITEM_LK; model.ITEM_BJ = ITEM_BJ; model.ITEM_JZ = ITEM_JZ; model.ITEM_HZ = ITEM_HZ; model.ITEM_rate = ITEM_rate; model.ITEM_GYLC = ITEM_GYLC; model.NET_PRICE = NET_PRICE; model.PRICE = PRICE; model.Quantity = Quantity; model.total_quantity = total_quantity; model.ORD_TL = ORD_TL; model.BARCODE = BARCODE; model.REMARK = REMARK; MyERP.BLL.ORDER_CG_DETAIL bll = new MyERP.BLL.ORDER_CG_DETAIL(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
/// <summary> /// 得到一个对象实体 /// </summary> public MyERP.Model.ORDER_CG_DETAIL DataRowToModel(DataRow row) { MyERP.Model.ORDER_CG_DETAIL model = new MyERP.Model.ORDER_CG_DETAIL(); if (row != null) { if (row["SEQUENCE"] != null && row["SEQUENCE"].ToString() != "") { model.SEQUENCE = int.Parse(row["SEQUENCE"].ToString()); } if (row["MASTERID"] != null) { model.MASTERID = row["MASTERID"].ToString(); } if (row["DETAILID"] != null) { model.DETAILID = row["DETAILID"].ToString(); } if (row["BILLNO"] != null) { model.BILLNO = row["BILLNO"].ToString(); } if (row["ITEM_INTERNAL_CODE"] != null) { model.ITEM_INTERNAL_CODE = row["ITEM_INTERNAL_CODE"].ToString(); } if (row["ITEM_CODE"] != null) { model.ITEM_CODE = row["ITEM_CODE"].ToString(); } if (row["ITEM_NAME"] != null) { model.ITEM_NAME = row["ITEM_NAME"].ToString(); } if (row["ITEM_COLOR"] != null) { model.ITEM_COLOR = row["ITEM_COLOR"].ToString(); } if (row["ITEM_TYPE"] != null) { model.ITEM_TYPE = row["ITEM_TYPE"].ToString(); } if (row["SPECIFICATIONS"] != null) { model.SPECIFICATIONS = row["SPECIFICATIONS"].ToString(); } if (row["MEASURE_UNIT"] != null) { model.MEASURE_UNIT = row["MEASURE_UNIT"].ToString(); } if (row["ITEM_CZ"] != null) { model.ITEM_CZ = row["ITEM_CZ"].ToString(); } if (row["ITEM_LH"] != null && row["ITEM_LH"].ToString() != "") { model.ITEM_LH = decimal.Parse(row["ITEM_LH"].ToString()); } if (row["ITEM_LK"] != null && row["ITEM_LK"].ToString() != "") { model.ITEM_LK = decimal.Parse(row["ITEM_LK"].ToString()); } if (row["ITEM_BJ"] != null && row["ITEM_BJ"].ToString() != "") { model.ITEM_BJ = decimal.Parse(row["ITEM_BJ"].ToString()); } if (row["ITEM_JZ"] != null && row["ITEM_JZ"].ToString() != "") { model.ITEM_JZ = decimal.Parse(row["ITEM_JZ"].ToString()); } if (row["ITEM_HZ"] != null && row["ITEM_HZ"].ToString() != "") { model.ITEM_HZ = decimal.Parse(row["ITEM_HZ"].ToString()); } if (row["ITEM_rate"] != null) { model.ITEM_rate = row["ITEM_rate"].ToString(); } if (row["ITEM_GYLC"] != null) { model.ITEM_GYLC = row["ITEM_GYLC"].ToString(); } if (row["NET_PRICE"] != null && row["NET_PRICE"].ToString() != "") { model.NET_PRICE = decimal.Parse(row["NET_PRICE"].ToString()); } if (row["PRICE"] != null && row["PRICE"].ToString() != "") { model.PRICE = decimal.Parse(row["PRICE"].ToString()); } if (row["Quantity"] != null && row["Quantity"].ToString() != "") { model.Quantity = decimal.Parse(row["Quantity"].ToString()); } if (row["total_quantity"] != null && row["total_quantity"].ToString() != "") { model.total_quantity = decimal.Parse(row["total_quantity"].ToString()); } if (row["ORD_TL"] != null) { model.ORD_TL = row["ORD_TL"].ToString(); } if (row["BARCODE"] != null) { model.BARCODE = row["BARCODE"].ToString(); } if (row["REMARK"] != null) { model.REMARK = row["REMARK"].ToString(); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(MyERP.Model.ORDER_CG_DETAIL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into ORDER_CG_DETAIL("); strSql.Append("SEQUENCE,MASTERID,DETAILID,BILLNO,ITEM_INTERNAL_CODE,ITEM_CODE,ITEM_NAME,ITEM_COLOR,ITEM_TYPE,SPECIFICATIONS,MEASURE_UNIT,ITEM_CZ,ITEM_LH,ITEM_LK,ITEM_BJ,ITEM_JZ,ITEM_HZ,ITEM_rate,ITEM_GYLC,NET_PRICE,PRICE,Quantity,total_quantity,ORD_TL,BARCODE,REMARK)"); strSql.Append(" values ("); strSql.Append("@SEQUENCE,@MASTERID,@DETAILID,@BILLNO,@ITEM_INTERNAL_CODE,@ITEM_CODE,@ITEM_NAME,@ITEM_COLOR,@ITEM_TYPE,@SPECIFICATIONS,@MEASURE_UNIT,@ITEM_CZ,@ITEM_LH,@ITEM_LK,@ITEM_BJ,@ITEM_JZ,@ITEM_HZ,@ITEM_rate,@ITEM_GYLC,@NET_PRICE,@PRICE,@Quantity,@total_quantity,@ORD_TL,@BARCODE,@REMARK)"); SqlParameter[] parameters = { new SqlParameter("@SEQUENCE", SqlDbType.Int, 4), new SqlParameter("@MASTERID", SqlDbType.VarChar, 50), new SqlParameter("@DETAILID", SqlDbType.VarChar, 50), new SqlParameter("@BILLNO", SqlDbType.VarChar, 50), new SqlParameter("@ITEM_INTERNAL_CODE", SqlDbType.NVarChar, 100), new SqlParameter("@ITEM_CODE", SqlDbType.NVarChar, 50), new SqlParameter("@ITEM_NAME", SqlDbType.NVarChar, 50), new SqlParameter("@ITEM_COLOR", SqlDbType.NVarChar, 50), new SqlParameter("@ITEM_TYPE", SqlDbType.NVarChar, 50), new SqlParameter("@SPECIFICATIONS", SqlDbType.NVarChar, 200), new SqlParameter("@MEASURE_UNIT", SqlDbType.NVarChar, 6), new SqlParameter("@ITEM_CZ", SqlDbType.NChar, 10), new SqlParameter("@ITEM_LH", SqlDbType.Float, 8), new SqlParameter("@ITEM_LK", SqlDbType.Float, 8), new SqlParameter("@ITEM_BJ", SqlDbType.Float, 8), new SqlParameter("@ITEM_JZ", SqlDbType.Float, 8), new SqlParameter("@ITEM_HZ", SqlDbType.Float, 8), new SqlParameter("@ITEM_rate", SqlDbType.NVarChar, 50), new SqlParameter("@ITEM_GYLC", SqlDbType.NVarChar, 50), new SqlParameter("@NET_PRICE", SqlDbType.Float, 8), new SqlParameter("@PRICE", SqlDbType.Float, 8), new SqlParameter("@Quantity", SqlDbType.Float, 8), new SqlParameter("@total_quantity", SqlDbType.Float, 8), new SqlParameter("@ORD_TL", SqlDbType.NChar, 10), new SqlParameter("@BARCODE", SqlDbType.VarChar, 50), new SqlParameter("@REMARK", SqlDbType.NVarChar, 200) }; parameters[0].Value = model.SEQUENCE; parameters[1].Value = model.MASTERID; parameters[2].Value = model.DETAILID; parameters[3].Value = model.BILLNO; parameters[4].Value = model.ITEM_INTERNAL_CODE; parameters[5].Value = model.ITEM_CODE; parameters[6].Value = model.ITEM_NAME; parameters[7].Value = model.ITEM_COLOR; parameters[8].Value = model.ITEM_TYPE; parameters[9].Value = model.SPECIFICATIONS; parameters[10].Value = model.MEASURE_UNIT; parameters[11].Value = model.ITEM_CZ; parameters[12].Value = model.ITEM_LH; parameters[13].Value = model.ITEM_LK; parameters[14].Value = model.ITEM_BJ; parameters[15].Value = model.ITEM_JZ; parameters[16].Value = model.ITEM_HZ; parameters[17].Value = model.ITEM_rate; parameters[18].Value = model.ITEM_GYLC; parameters[19].Value = model.NET_PRICE; parameters[20].Value = model.PRICE; parameters[21].Value = model.Quantity; parameters[22].Value = model.total_quantity; parameters[23].Value = model.ORD_TL; parameters[24].Value = model.BARCODE; parameters[25].Value = model.REMARK; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(MyERP.Model.ORDER_CG_DETAIL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update ORDER_CG_DETAIL set "); strSql.Append("SEQUENCE=@SEQUENCE,"); strSql.Append("MASTERID=@MASTERID,"); strSql.Append("DETAILID=@DETAILID,"); strSql.Append("BILLNO=@BILLNO,"); strSql.Append("ITEM_INTERNAL_CODE=@ITEM_INTERNAL_CODE,"); strSql.Append("ITEM_CODE=@ITEM_CODE,"); strSql.Append("ITEM_NAME=@ITEM_NAME,"); strSql.Append("ITEM_COLOR=@ITEM_COLOR,"); strSql.Append("ITEM_TYPE=@ITEM_TYPE,"); strSql.Append("SPECIFICATIONS=@SPECIFICATIONS,"); strSql.Append("MEASURE_UNIT=@MEASURE_UNIT,"); strSql.Append("ITEM_CZ=@ITEM_CZ,"); strSql.Append("ITEM_LH=@ITEM_LH,"); strSql.Append("ITEM_LK=@ITEM_LK,"); strSql.Append("ITEM_BJ=@ITEM_BJ,"); strSql.Append("ITEM_JZ=@ITEM_JZ,"); strSql.Append("ITEM_HZ=@ITEM_HZ,"); strSql.Append("ITEM_rate=@ITEM_rate,"); strSql.Append("ITEM_GYLC=@ITEM_GYLC,"); strSql.Append("NET_PRICE=@NET_PRICE,"); strSql.Append("PRICE=@PRICE,"); strSql.Append("Quantity=@Quantity,"); strSql.Append("total_quantity=@total_quantity,"); strSql.Append("ORD_TL=@ORD_TL,"); strSql.Append("BARCODE=@BARCODE,"); strSql.Append("REMARK=@REMARK"); strSql.Append(" where "); SqlParameter[] parameters = { new SqlParameter("@SEQUENCE", SqlDbType.Int, 4), new SqlParameter("@MASTERID", SqlDbType.VarChar, 50), new SqlParameter("@DETAILID", SqlDbType.VarChar, 50), new SqlParameter("@BILLNO", SqlDbType.VarChar, 50), new SqlParameter("@ITEM_INTERNAL_CODE", SqlDbType.NVarChar, 100), new SqlParameter("@ITEM_CODE", SqlDbType.NVarChar, 50), new SqlParameter("@ITEM_NAME", SqlDbType.NVarChar, 50), new SqlParameter("@ITEM_COLOR", SqlDbType.NVarChar, 50), new SqlParameter("@ITEM_TYPE", SqlDbType.NVarChar, 50), new SqlParameter("@SPECIFICATIONS", SqlDbType.NVarChar, 200), new SqlParameter("@MEASURE_UNIT", SqlDbType.NVarChar, 6), new SqlParameter("@ITEM_CZ", SqlDbType.NChar, 10), new SqlParameter("@ITEM_LH", SqlDbType.Float, 8), new SqlParameter("@ITEM_LK", SqlDbType.Float, 8), new SqlParameter("@ITEM_BJ", SqlDbType.Float, 8), new SqlParameter("@ITEM_JZ", SqlDbType.Float, 8), new SqlParameter("@ITEM_HZ", SqlDbType.Float, 8), new SqlParameter("@ITEM_rate", SqlDbType.NVarChar, 50), new SqlParameter("@ITEM_GYLC", SqlDbType.NVarChar, 50), new SqlParameter("@NET_PRICE", SqlDbType.Float, 8), new SqlParameter("@PRICE", SqlDbType.Float, 8), new SqlParameter("@Quantity", SqlDbType.Float, 8), new SqlParameter("@total_quantity", SqlDbType.Float, 8), new SqlParameter("@ORD_TL", SqlDbType.NChar, 10), new SqlParameter("@BARCODE", SqlDbType.VarChar, 50), new SqlParameter("@REMARK", SqlDbType.NVarChar, 200) }; parameters[0].Value = model.SEQUENCE; parameters[1].Value = model.MASTERID; parameters[2].Value = model.DETAILID; parameters[3].Value = model.BILLNO; parameters[4].Value = model.ITEM_INTERNAL_CODE; parameters[5].Value = model.ITEM_CODE; parameters[6].Value = model.ITEM_NAME; parameters[7].Value = model.ITEM_COLOR; parameters[8].Value = model.ITEM_TYPE; parameters[9].Value = model.SPECIFICATIONS; parameters[10].Value = model.MEASURE_UNIT; parameters[11].Value = model.ITEM_CZ; parameters[12].Value = model.ITEM_LH; parameters[13].Value = model.ITEM_LK; parameters[14].Value = model.ITEM_BJ; parameters[15].Value = model.ITEM_JZ; parameters[16].Value = model.ITEM_HZ; parameters[17].Value = model.ITEM_rate; parameters[18].Value = model.ITEM_GYLC; parameters[19].Value = model.NET_PRICE; parameters[20].Value = model.PRICE; parameters[21].Value = model.Quantity; parameters[22].Value = model.total_quantity; parameters[23].Value = model.ORD_TL; parameters[24].Value = model.BARCODE; parameters[25].Value = model.REMARK; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }