protected void QueryOne(string operate, string orderBy) { _rolewhere = string.Empty; if (string.IsNullOrEmpty(_where)) { _rolewhere = "1=1"; } else { _rolewhere = _where; } if (_list != null) { _rolewhere += " AND code " + operate + _list.code; } _list = _bll.getList(_rolewhere + orderBy); if (_list != null) { setValue(_list); } }
bool getValue( ) { errorProvider1.Clear( ); isOk = true; if (string.IsNullOrEmpty(txtpurchasecode.Text)) { errorProvider1.SetError(txtpurchasecode, "不能为空"); } if (string.IsNullOrEmpty(txtCNumbering.Text)) { errorProvider1.SetError(txtCNumbering, "不能为空"); } if (string.IsNullOrEmpty(txtOddNum.Text)) { errorProvider1.SetError(txtOddNum, "不可为空"); isOk = false; } decimal outPut = 0M; if (!string.IsNullOrEmpty(txtprice.Text.Trim( )) && decimal.TryParse(txtprice.Text, out outPut) == false) { errorProvider1.SetError(txtprice, "清输入数字"); isOk = false; } outPut = 0M; if (!string.IsNullOrEmpty(txtweight.Text.Trim( )) && decimal.TryParse(txtweight.Text, out outPut) == false) { errorProvider1.SetError(txtweight, "清输入数字"); isOk = false; } outPut = 0M; if (!string.IsNullOrEmpty(txtapplyMoney.Text.Trim( )) && decimal.TryParse(txtapplyMoney.Text, out outPut) == false) { errorProvider1.SetError(txtapplyMoney, "清输入数字"); isOk = false; } outPut = 0M; if (!string.IsNullOrEmpty(txtBond.Text.Trim( )) && decimal.TryParse(txtBond.Text, out outPut) == false) { errorProvider1.SetError(txtBond, "清输入数字"); isOk = false; } if (isOk == false) { return(isOk); } if (rabQuanKuan.Checked == true || rabWeiKuan.Checked == true || rabYuFu.Checked == true) { } else { errorProvider1.SetError(groupBox1, "必选一个"); isOk = false; } _list = new FishEntity.PaymentRequisitionEntity( ); _list.createMan = _list.modifyMan = FishEntity.Variable.User.username; _list.code = txtOddNum.Text; _list.applyDepart = txtDepartMent.Text; _list.applyDate = dtpDate.Value; _list.applyCode = txtPayCode.Text; _list.Numbering = txtNumbering.Text; _list.Purchasecode = txtpurchasecode.Text; _list.AcountNum = txtPayAcount.Text; _list.unit = txtPayUnit.Text; _list.PurchasingUnit = txtPurchasingUnit.Text; _list.PurchasingUnitId = txtPurchasingUnit.Tag.ToString(); if (txtPayUnit.Tag != null) { _list.applyDepartId = txtPayUnit.Tag.ToString(); } _list.contacts = txtcontacts.Text; _list.ContactsId = txtcontacts.Tag.ToString(); _list.backDeposit = txtbackDeposit.Text; _list.FishMealId = txtFishMealId.Text; _list.price = string.IsNullOrEmpty(txtprice.Text.Trim( )) == true ? 0 : Math.Round(Convert.ToDecimal(txtprice.Text), 2); _list.weight = string.IsNullOrEmpty(txtweight.Text.Trim( )) == true ? 0 : Math.Round(Convert.ToDecimal(txtweight.Text), 2); _list.bond = string.IsNullOrEmpty(txtBond.Text.Trim( )) == true ? 0 : Math.Round(Convert.ToDecimal(txtBond.Text), 2); _list.CNumbering = txtCNumbering.Text; if (rabQuanKuan.Checked == true) { _list.paymentType = rabQuanKuan.Text; } else if (rabWeiKuan.Checked == true) { _list.paymentType = rabWeiKuan.Text; } else if (rabYuFu.Checked == true) { _list.paymentType = rabYuFu.Text; } else { _list.paymentType = string.Empty; } if (rabBaoZheng.Checked == true) { _list.PricingType = rabBaoZheng.Text; } else if (rabHuoKuan.Checked == true) { _list.PricingType = rabHuoKuan.Text; } else { _list.PricingType = string.Empty; } _list.applyMoney = string.IsNullOrEmpty(txtapplyMoney.Text.Trim( )) == true ? 0 : Math.Round(Convert.ToDecimal(txtapplyMoney.Text), 2); if (rabGongZhang.Checked == true) { _list.paymentMethod = rabGongZhang.Text; } else if (rabSiZhang.Checked == true) { _list.paymentMethod = rabSiZhang.Text; } else if (rabChengDui.Checked == true) { _list.paymentMethod = rabChengDui.Text; } else if (rabXianJin.Checked == true) { _list.paymentMethod = rabXianJin.Text; } else if (rabQiTa.Checked == true) { _list.paymentMethod = rabQiTa.Text; _list.paymentMethodOther = texOther.Text; } else { _list.paymentMethod = string.Empty; _list.paymentMethodOther = string.Empty; } if (rabZZSFP.Checked == true) { _list.invoiceType = rabZZSFP.Text; } else if (rabPTFP.Checked == true) { _list.invoiceType = rabPTFP.Text; } else if (rabSJ.Checked == true) { _list.invoiceType = rabSJ.Text; } else { _list.invoiceType = string.Empty; } _list.paymentDate = dtpDate.Value; _list.remark = txtRemark.Text; return(isOk); }
void setValue(FishEntity.PaymentRequisitionEntity _list) { txtOddNum.Text = _list.code; txtDepartMent.Text = _list.applyDepart; txtPayUnit.Text = _list.unit; txtPayUnit.Tag = _list.applyDepartId; if (_list.applyDate != null) { dtpDate.Value = Convert.ToDateTime(_list.applyDate.ToString( )); } txtPayCode.Text = _list.applyCode; txtNumbering.Text = _list.Numbering; txtpurchasecode.Text = _list.Purchasecode; txtPayAcount.Text = _list.AcountNum; txtCNumbering.Text = _list.CNumbering; txtPurchasingUnit.Text = _list.PurchasingUnit; txtPurchasingUnit.Tag = _list.PurchasingUnitId; txtcontacts.Text = _list.contacts; txtcontacts.Tag = _list.ContactsId; txtbackDeposit.Text = _list.backDeposit; txtprice.Text = _list.price.ToString( ); txtweight.Text = _list.weight.ToString( ); txtmodifyman.Text = _list.modifyMan; txtcreateman.Text = _list.createMan; txtFishMealId.Text = _list.FishMealId; txtBond.Text = _list.bond.ToString( ); if (_list.paymentType != null) { if (_list.paymentType.Trim().Equals(rabYuFu.Text)) { rabYuFu.Checked = true; } else if (_list.paymentType.Trim().Equals(rabQuanKuan.Text)) { rabQuanKuan.Checked = true; } else if (_list.paymentType.Trim().Equals(rabWeiKuan.Text)) { rabWeiKuan.Checked = true; } else { rabQuanKuan.Checked = rabWeiKuan.Checked = false; } } else { rabQuanKuan.Checked = rabWeiKuan.Checked = false; } if (_list.PricingType != null) { if (_list.PricingType.Trim().Equals(rabBaoZheng.Text)) { rabBaoZheng.Checked = true; } else if (_list.PricingType.Trim().Equals(rabHuoKuan.Text)) { rabHuoKuan.Checked = true; } else { rabBaoZheng.Checked = rabHuoKuan.Checked = false; } } else { rabBaoZheng.Checked = rabHuoKuan.Checked = false; } txtapplyMoney.Text = _list.applyMoney.ToString( ); inputRMB.Text = Utility.MoneyToRMB.ConvertSum(_list.applyMoney.ToString( )); if (_list.paymentMethod != null) { if (_list.paymentMethod.Trim( ).Equals(rabGongZhang.Text)) { rabGongZhang.Checked = true; } else if (_list.paymentMethod.Trim( ).Equals(rabSiZhang.Text)) { rabSiZhang.Checked = true; } else if (_list.paymentMethod.Trim( ).Equals(rabChengDui.Text)) { rabChengDui.Checked = true; } else if (_list.paymentMethod.Trim( ).Equals(rabXianJin.Text)) { rabXianJin.Checked = true; } else if (_list.paymentMethod.Trim( ).Equals(rabQiTa.Text)) { rabQiTa.Checked = true; texOther.Text = _list.paymentMethodOther; } else { rabGongZhang.Checked = rabSiZhang.Checked = rabChengDui.Checked = rabXianJin.Checked = rabQiTa.Checked = false; texOther.Text = string.Empty; } } else { rabGongZhang.Checked = rabSiZhang.Checked = rabChengDui.Checked = rabXianJin.Checked = rabQiTa.Checked = false; texOther.Text = string.Empty; } if (_list.invoiceType != null) { if (_list.invoiceType.Trim( ).Equals(rabZZSFP.Text)) { rabZZSFP.Checked = true; } else if (_list.invoiceType.Trim( ).Equals(rabPTFP.Text)) { rabPTFP.Checked = true; } else if (_list.invoiceType.Trim( ).Equals(rabSJ.Text)) { rabSJ.Checked = true; } else { rabZZSFP.Checked = rabPTFP.Checked = rabSJ.Checked = false; } } else { rabZZSFP.Checked = rabPTFP.Checked = rabSJ.Checked = false; } if (!string.IsNullOrEmpty(_list.paymentDate.ToString( ))) { dtpDate.Value = Convert.ToDateTime(_list.paymentDate.ToString( )); } txtRemark.Text = _list.remark; }
/// <summary> /// 编辑一条记录 /// </summary> /// <param name="_list"></param> /// <returns></returns> public bool Edit(FishEntity.PaymentRequisitionEntity _list) { return(dal.Edit(_list)); }
/// <summary> /// 增加一条记录 /// </summary> /// <param name="_list"></param> /// <returns></returns> public bool Add(FishEntity.PaymentRequisitionEntity _list) { return(dal.Add(_list)); }
/// <summary> /// 编辑一条记录 /// </summary> /// <param name="_list"></param> /// <returns></returns> public bool Edit(FishEntity.PaymentRequisitionEntity _list) { _list.createTime = _list.modifyTime = getTime(); StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE t_paymentrequisition SET "); strSql.Append("applyDepartId=@applyDepartId,"); strSql.Append("applyDepart=@applyDepart,"); strSql.Append("applyDate=@applyDate,"); strSql.Append("applyCode=@applyCode,"); strSql.Append("unit=@unit,"); strSql.Append("acountNum=@acountNum,"); strSql.Append("contacts=@contacts,"); strSql.Append("backDeposit=@backDeposit,"); strSql.Append("price=@price,"); strSql.Append("weight=@weight,"); strSql.Append("applyMoney=@applyMoney,"); strSql.Append("paymentType=@paymentType,"); strSql.Append("paymentMethod=@paymentMethod,"); strSql.Append("paymentMethodOther=@paymentMethodOther,"); strSql.Append("invoiceType=@invoiceType,"); strSql.Append("paymentDate=@paymentDate,"); strSql.Append("remark=@remark,"); strSql.Append("modifyTime=@modifyTime,"); strSql.Append("modifyMan=@modifyMan,"); strSql.Append("purchasecode=@purchasecode, "); strSql.Append("PurchasingUnit=@PurchasingUnit,"); strSql.Append("PurchasingUnitId=@PurchasingUnitId,"); strSql.Append("ContactsId=@ContactsId,"); strSql.Append("CNumbering=@CNumbering,"); strSql.Append("FishMealId=@FishMealId,"); strSql.Append("PricingType=@PricingType,"); strSql.Append("bond=@bond "); strSql.Append("WHERE code=@code"); MySqlParameter[] parameter = { new MySqlParameter("@code", MySqlDbType.VarChar, 45), new MySqlParameter("@applyDepartId", MySqlDbType.VarChar, 45), new MySqlParameter("@applyDepart", MySqlDbType.VarChar, 45), new MySqlParameter("@applyDate", MySqlDbType.Date), new MySqlParameter("@applyCode", MySqlDbType.VarChar, 200), new MySqlParameter("@unit", MySqlDbType.VarChar, 45), new MySqlParameter("@acountNum", MySqlDbType.VarChar, 45), new MySqlParameter("@contacts", MySqlDbType.VarChar, 45), new MySqlParameter("@backDeposit", MySqlDbType.VarChar, 45), new MySqlParameter("@price", MySqlDbType.Decimal, 45), new MySqlParameter("@weight", MySqlDbType.Decimal, 45), new MySqlParameter("@applyMoney", MySqlDbType.Decimal, 45), new MySqlParameter("@paymentType", MySqlDbType.VarChar, 45), new MySqlParameter("@paymentMethod", MySqlDbType.VarChar, 45), new MySqlParameter("@paymentMethodOther", MySqlDbType.VarChar, 45), new MySqlParameter("@invoiceType", MySqlDbType.VarChar, 45), new MySqlParameter("@paymentDate", MySqlDbType.Date), new MySqlParameter("@remark", MySqlDbType.VarChar, 45), new MySqlParameter("@modifyTime", MySqlDbType.DateTime), new MySqlParameter("@modifyMan", MySqlDbType.VarChar, 45), new MySqlParameter("@purchasecode", MySqlDbType.VarChar, 45), new MySqlParameter("@PurchasingUnit", MySqlDbType.VarChar, 45), new MySqlParameter("@PurchasingUnitId", MySqlDbType.VarChar, 45), new MySqlParameter("@ContactsId", MySqlDbType.VarChar, 45), new MySqlParameter("@CNumbering", MySqlDbType.VarChar, 45), new MySqlParameter("@bond", MySqlDbType.Decimal, 45), new MySqlParameter("@FishMealId", MySqlDbType.VarChar, 45), new MySqlParameter("@PricingType", MySqlDbType.VarChar, 45) }; parameter[0].Value = _list.code; parameter[1].Value = _list.applyDepartId; parameter[2].Value = _list.applyDepart; parameter[3].Value = _list.applyDate; parameter[4].Value = _list.applyCode; parameter[5].Value = _list.unit; parameter[6].Value = _list.AcountNum; parameter[7].Value = _list.contacts; parameter[8].Value = _list.backDeposit; parameter[9].Value = _list.price; parameter[10].Value = _list.weight; parameter[11].Value = _list.applyMoney; parameter[12].Value = _list.paymentType; parameter[13].Value = _list.paymentMethod; parameter[14].Value = _list.paymentMethodOther; parameter[15].Value = _list.invoiceType; parameter[16].Value = _list.paymentDate; parameter[17].Value = _list.remark; parameter[18].Value = _list.modifyTime; parameter[19].Value = _list.modifyMan; parameter[20].Value = _list.Purchasecode; parameter[21].Value = _list.PurchasingUnit; parameter[22].Value = _list.PurchasingUnitId; parameter[23].Value = _list.ContactsId; parameter[24].Value = _list.CNumbering; parameter[25].Value = _list.bond; parameter[26].Value = _list.FishMealId; parameter[27].Value = _list.PricingType; int row = MySqlHelper.ExecuteSql(strSql.ToString(), parameter); if (row > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条记录 /// </summary> /// <param name="_list"></param> /// <returns></returns> public bool Add(FishEntity.PaymentRequisitionEntity _list) { _list.createTime = _list.modifyTime = getTime(); StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO t_paymentrequisition ("); strSql.Append("FishMealId,Numbering,code,applyDepartId,applyDepart,applyDate,applyCode,contacts,ContactsId,backDeposit,price,weight,applyMoney,paymentType,paymentMethod,paymentMethodOther,invoiceType,paymentDate,remark,unit,acountNum,createTime,createMan,modifyTime,modifyMan,purchasecode,PurchasingUnit,PurchasingUnitId,CNumbering,bond,PricingType) "); strSql.Append("VALUES ("); strSql.Append("@FishMealId,@Numbering,@code,@applyDepartId,@applyDepart,@applyDate,@applyCode,@contacts,@ContactsId,@backDeposit,@price,@weight,@applyMoney,@paymentType,@paymentMethod,@paymentMethodOther,@invoiceType,@paymentDate,@remark,@unit,@acountNum,@createTime,@createMan,@modifyTime,@modifyMan,@purchasecode,@PurchasingUnit,@PurchasingUnitId,@CNumbering,@bond,@PricingType)"); MySqlParameter[] parameter = { new MySqlParameter("@code", MySqlDbType.VarChar, 45), new MySqlParameter("@applyDepartId", MySqlDbType.VarChar, 45), new MySqlParameter("@applyDepart", MySqlDbType.VarChar, 45), new MySqlParameter("@applyDate", MySqlDbType.Date), new MySqlParameter("@applyCode", MySqlDbType.VarChar, 200), new MySqlParameter("@contacts", MySqlDbType.VarChar, 45), new MySqlParameter("@backDeposit", MySqlDbType.VarChar, 45), new MySqlParameter("@price", MySqlDbType.Decimal, 45), new MySqlParameter("@weight", MySqlDbType.Decimal, 45), new MySqlParameter("@applyMoney", MySqlDbType.Decimal, 45), new MySqlParameter("@paymentType", MySqlDbType.VarChar, 45), new MySqlParameter("@paymentMethod", MySqlDbType.VarChar, 45), new MySqlParameter("@paymentMethodOther", MySqlDbType.VarChar, 45), new MySqlParameter("@invoiceType", MySqlDbType.VarChar, 45), new MySqlParameter("@paymentDate", MySqlDbType.Date), new MySqlParameter("@remark", MySqlDbType.VarChar, 45), new MySqlParameter("@unit", MySqlDbType.VarChar, 45), new MySqlParameter("@acountNum", MySqlDbType.VarChar, 45), new MySqlParameter("@createTime", MySqlDbType.DateTime), new MySqlParameter("@createMan", MySqlDbType.VarChar, 45), new MySqlParameter("@modifyTime", MySqlDbType.DateTime), new MySqlParameter("@modifyMan", MySqlDbType.VarChar, 45), new MySqlParameter("@purchasecode", MySqlDbType.VarChar, 45), new MySqlParameter("@PurchasingUnit", MySqlDbType.VarChar, 45), new MySqlParameter("@PurchasingUnitId", MySqlDbType.VarChar, 45), new MySqlParameter("@ContactsId", MySqlDbType.VarChar, 45), new MySqlParameter("@Numbering", MySqlDbType.VarChar, 45), new MySqlParameter("@CNumbering", MySqlDbType.VarChar, 45), new MySqlParameter("@bond", MySqlDbType.Decimal, 45), new MySqlParameter("@FishMealId", MySqlDbType.VarChar, 45), new MySqlParameter("@PricingType", MySqlDbType.VarChar, 45) }; parameter[0].Value = _list.code; parameter[1].Value = _list.applyDepartId; parameter[2].Value = _list.applyDepart; parameter[3].Value = _list.applyDate; parameter[4].Value = _list.applyCode; parameter[5].Value = _list.contacts; parameter[6].Value = _list.backDeposit; parameter[7].Value = _list.price; parameter[8].Value = _list.weight; parameter[9].Value = _list.applyMoney; parameter[10].Value = _list.paymentType; parameter[11].Value = _list.paymentMethod; parameter[12].Value = _list.paymentMethodOther; parameter[13].Value = _list.invoiceType; parameter[14].Value = _list.paymentDate; parameter[15].Value = _list.remark; parameter[16].Value = _list.unit; parameter[17].Value = _list.AcountNum; parameter[18].Value = _list.createTime; parameter[19].Value = _list.createMan; parameter[20].Value = _list.modifyTime; parameter[21].Value = _list.modifyMan; parameter[22].Value = _list.Purchasecode; parameter[23].Value = _list.PurchasingUnit; parameter[24].Value = _list.PurchasingUnitId; parameter[25].Value = _list.ContactsId; parameter[26].Value = _list.Numbering; parameter[27].Value = _list.CNumbering; parameter[28].Value = _list.bond; parameter[29].Value = _list.FishMealId; parameter[30].Value = _list.PricingType; int row = MySqlHelper.ExecuteSql(strSql.ToString(), parameter); if (row > 0) { return(true); } else { return(false); } }
public FishEntity.PaymentRequisitionEntity getModel(DataRow row) { FishEntity.PaymentRequisitionEntity model = new FishEntity.PaymentRequisitionEntity( ); if (row != null) { if (row["Numbering"] != null) { model.Numbering = row["Numbering"].ToString(); } if (row["FishMealId"] != null) { model.FishMealId = row["FishMealId"].ToString(); } if (row["modifyman"] != null) { model.modifyMan = row["modifyman"].ToString(); } if (row["createman"] != null) { model.createMan = row["createman"].ToString(); } if (row["code"] != null) { model.code = row["code"].ToString(); } if (row["applyDepartId"] != null) { model.applyDepartId = row["applyDepartId"].ToString(); } if (row ["applyDepart"] != null) { model.applyDepart = row ["applyDepart"].ToString( ); } if (row ["applyDate"] != null && row["applyDate"].ToString() != "") { model.applyDate = DateTime.Parse(row ["applyDate"].ToString( )); } if (row["applyCode"] != null) { model.applyCode = row["applyCode"].ToString(); } if (row["purchasecode"] != null) { model.Purchasecode = row["purchasecode"].ToString(); } if (row["unit"] != null) { model.unit = row["unit"].ToString(); } if (row["PurchasingUnit"] != null) { model.PurchasingUnit = row["PurchasingUnit"].ToString(); } if (row["PurchasingUnitId"] != null) { model.PurchasingUnitId = row["PurchasingUnitId"].ToString(); } if (row["contacts"] != null) { model.contacts = row["contacts"].ToString(); } if (row["ContactsId"] != null) { model.ContactsId = row["ContactsId"].ToString(); } if (row ["backDeposit"] != null) { model.backDeposit = row ["backDeposit"].ToString( ); } if (row ["price"] != null && row ["price"].ToString( ) != "") { model.price = decimal.Parse(row ["price"].ToString( )); } if (row ["weight"] != null && row ["weight"].ToString( ) != "") { model.weight = decimal.Parse(row ["weight"].ToString( )); } if (row ["applyMoney"] != null && row ["applyMoney"].ToString( ) != "") { model.applyMoney = decimal.Parse(row ["applyMoney"].ToString( )); } if (row ["paymentType"] != null) { model.paymentType = row ["paymentType"].ToString( ); } if (row["PricingType"] != null) { model.PricingType = row["PricingType"].ToString(); } if (row ["paymentMethod"] != null) { model.paymentMethod = row ["paymentMethod"].ToString( ); } if (row ["paymentMethodOther"] != null) { model.paymentMethodOther = row ["paymentMethodOther"].ToString( ); } if (row ["invoiceType"] != null) { model.invoiceType = row ["invoiceType"].ToString( ); } if (row ["paymentDate"] != null && row ["paymentDate"].ToString( ) != "") { model.paymentDate = DateTime.Parse(row ["paymentDate"].ToString( )); } if (row ["remark"] != null) { model.remark = row ["remark"].ToString( ); } if (row ["acountNum"] != null) { model.AcountNum = row ["acountNum"].ToString( ); } if (row ["CNumbering"] != null) { model.CNumbering = row ["CNumbering"].ToString( ); } if (row ["bond"] != null && row ["bond"].ToString( ) != "") { model.bond = decimal.Parse(row ["bond"].ToString( )); } } return(model); }