public void Add(PayoutModifyModel model, SqlTransaction trans) { StringBuilder builder = new StringBuilder(); builder.Append("insert into Con_Payout_Modify("); builder.Append("ModifyID,ModifyCode,ContractID,ModifyDate,ModifyMoney,Reason,Annex,FlowState,Notes,InputPerson,InputDate,ModifyPerson)"); builder.Append(" values ("); builder.Append("@ModifyID,@ModifyCode,@ContractID,@ModifyDate,@ModifyMoney,@Reason,@Annex,@FlowState,@Notes,@InputPerson,@InputDate,@ModifyPerson)"); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@ModifyID", SqlDbType.NVarChar, 0x40), new SqlParameter("@ModifyCode", SqlDbType.NVarChar, 0x40), new SqlParameter("@ContractID", SqlDbType.NVarChar, 0x40), new SqlParameter("@ModifyDate", SqlDbType.DateTime), new SqlParameter("@ModifyMoney", SqlDbType.Decimal, 9), new SqlParameter("@Reason", SqlDbType.NVarChar), new SqlParameter("@Annex", SqlDbType.NVarChar, 0x100), new SqlParameter("@FlowState", SqlDbType.Int, 4), new SqlParameter("@Notes", SqlDbType.NVarChar), new SqlParameter("@InputPerson", SqlDbType.NVarChar, 0x40), new SqlParameter("@InputDate", SqlDbType.DateTime), new SqlParameter("@ModifyPerson", SqlDbType.NVarChar, 0x40) }; commandParameters[0].Value = model.ModifyID; commandParameters[1].Value = model.ModifyCode; commandParameters[2].Value = model.ContractID; commandParameters[3].Value = model.ModifyDate; commandParameters[4].Value = model.ModifyMoney; commandParameters[5].Value = model.Reason; commandParameters[6].Value = model.Annex; commandParameters[7].Value = model.FlowState; commandParameters[8].Value = model.Notes; commandParameters[9].Value = model.InputPerson; commandParameters[10].Value = model.InputDate; commandParameters[11].Value = model.ModifyPerson; if (trans == null) { SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters); } else { SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters); } }
private void UpdateContractModify() { PayoutModifyModel model = this.payoutModify.GetModel(this.modifyId); decimal? modifyMoney = model.ModifyMoney; if (!string.IsNullOrEmpty(this.txtModifyMoney.Text.Trim())) { model.ModifyMoney = new decimal?(Convert.ToDecimal(this.txtModifyMoney.Text.Trim())); } if (!string.IsNullOrEmpty(this.txtModifyDate.Text.Trim())) { model.ModifyDate = new DateTime?(Convert.ToDateTime(this.txtModifyDate.Text.Trim())); } model.ModifyPerson = this.txtModifyPerson.Text.Trim(); model.Reason = this.txtReason.Text.Trim(); model.Notes = this.txtNotes.Text.Trim(); try { this.payoutModify.Update(model, modifyMoney); this.SavePurchase(); if (model.FlowState == 1) { PayoutModifyAudit payoutModifyAudit = new PayoutModifyAudit(); payoutModifyAudit.CommitEvent(model.ModifyID); } } catch (Exception) { base.RegisterScript("top.ui.alert('更新失败');"); } }
private void UpdateModifiedMoney(PayoutModifyModel model, decimal?oldModifyMoney, SqlTransaction trans) { cn.justwin.contractBLL.PayoutContract contract = new cn.justwin.contractBLL.PayoutContract(); PayoutContractModel model2 = contract.GetModel(model.ContractID); if (!oldModifyMoney.HasValue) { model2.ModifiedMoney += model.ModifyMoney; } else { model2.ModifiedMoney = (model2.ModifiedMoney - oldModifyMoney) + model.ModifyMoney; } contract.Update(model2, trans); }
private void InitUpdateState() { PayoutModifyModel model = this.payoutModify.GetModel(this.modifyId); this.hfldModifyId.Value = model.ModifyID; this.txtModifyCode.Text = model.ModifyCode; this.txtModifyCode.Enabled = false; this.txtModifyMoney.Text = model.ModifyMoney.ToString(); this.txtModifyPerson.Text = model.ModifyPerson.ToString(); this.txtModifyDate.Text = model.ModifyDate.Value.ToShortDateString(); this.txtReason.Text = model.Reason; this.txtNotes.Text = model.Notes; this.txtInputPerson.Text = model.InputPerson; this.txtInputDate.Text = model.InputDate.Value.ToShortDateString(); this.InitContractInfo(model.ContractID); }
public void SuperDelete(object key) { cn.justwin.contractDAL.PayoutModify modify = new cn.justwin.contractDAL.PayoutModify(); PayoutModifyModel model = new PayoutModifyModel(); model = modify.GetModel(key.ToString()); if (model != null) { cn.justwin.contractDAL.PayoutContract contract = new cn.justwin.contractDAL.PayoutContract(); PayoutContractModel model2 = contract.GetModel(model.ContractID); if ((model2 != null) && model2.ModifiedMoney.HasValue) { model2.ModifiedMoney -= model.ModifyMoney; } contract.Update(model2, null); } }
public void Update(PayoutModifyModel model, decimal?oldModifyMoney) { using (SqlConnection connection = new SqlConnection(SqlHelper.ConnectionString)) { connection.Open(); SqlTransaction trans = connection.BeginTransaction(); try { this.modify.Update(model, trans); trans.Commit(); } catch (Exception) { trans.Rollback(); throw new Exception("添加失败"); } } }
private void AddContractModify() { PayoutModifyModel payoutModifyModel = new PayoutModifyModel(); payoutModifyModel.ModifyID = this.hfldModifyId.Value; payoutModifyModel.ContractID = this.contractId; payoutModifyModel.ModifyCode = this.txtModifyCode.Text.Trim(); if (!string.IsNullOrEmpty(this.txtModifyMoney.Text.Trim())) { payoutModifyModel.ModifyMoney = new decimal?(Convert.ToDecimal(this.txtModifyMoney.Text.Trim())); } if (!string.IsNullOrEmpty(this.txtModifyDate.Text.Trim())) { payoutModifyModel.ModifyDate = new DateTime?(Convert.ToDateTime(this.txtModifyDate.Text.Trim())); } payoutModifyModel.ModifyPerson = this.txtModifyPerson.Text.Trim(); payoutModifyModel.Annex = string.Empty; payoutModifyModel.FlowState = new int?(1); payoutModifyModel.InputPerson = this.txtInputPerson.Text.Trim(); if (!string.IsNullOrEmpty(this.txtInputDate.Text.Trim())) { payoutModifyModel.InputDate = new DateTime?(Convert.ToDateTime(this.txtInputDate.Text.Trim())); } payoutModifyModel.Reason = this.txtReason.Text.Trim(); payoutModifyModel.Notes = this.txtNotes.Text.Trim(); try { if (this.payoutModify.IsExists(payoutModifyModel.ModifyCode, payoutModifyModel.ContractID)) { base.RegisterScript("top.ui.alert('此变更编号已经存在')"); } else { this.payoutModify.Add(payoutModifyModel); this.SavePurchase(); base.RegisterScript("top.ui.show('添加成功!'); winclose('ModifyEdit','PayoutModifyEdit.aspx?ContractID=" + this.contractId + "',true);"); } } catch (Exception) { base.RegisterScript("top.ui.alert('添加失败');"); } }
public void Update(PayoutModifyModel model, SqlTransaction trans) { StringBuilder builder = new StringBuilder(); builder.Append("update Con_Payout_Modify set "); builder.Append("ModifyCode=@ModifyCode,"); builder.Append("ContractID=@ContractID,"); builder.Append("ModifyDate=@ModifyDate,"); builder.Append("ModifyMoney=@ModifyMoney,"); builder.Append("Reason=@Reason,"); builder.Append("Annex=@Annex,"); builder.Append("FlowState=@FlowState,"); builder.Append("Notes=@Notes,"); builder.Append("InputPerson=@InputPerson,"); builder.Append("InputDate=@InputDate,"); builder.Append("ModifyPerson=@ModifyPerson"); builder.Append(" where ModifyID=@ModifyID "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@ModifyID", SqlDbType.NVarChar, 0x40), new SqlParameter("@ModifyCode", SqlDbType.NVarChar, 0x40), new SqlParameter("@ContractID", SqlDbType.NVarChar, 0x40), new SqlParameter("@ModifyDate", SqlDbType.DateTime), new SqlParameter("@ModifyMoney", SqlDbType.Decimal, 9), new SqlParameter("@Reason", SqlDbType.NVarChar), new SqlParameter("@Annex", SqlDbType.NVarChar, 0x100), new SqlParameter("@FlowState", SqlDbType.Int, 4), new SqlParameter("@Notes", SqlDbType.NVarChar), new SqlParameter("@InputPerson", SqlDbType.NVarChar, 0x40), new SqlParameter("@InputDate", SqlDbType.DateTime), new SqlParameter("@ModifyPerson", SqlDbType.NVarChar, 0x40) }; commandParameters[0].Value = model.ModifyID; commandParameters[1].Value = model.ModifyCode; commandParameters[2].Value = model.ContractID; commandParameters[3].Value = model.ModifyDate; commandParameters[4].Value = model.ModifyMoney; commandParameters[5].Value = model.Reason; commandParameters[6].Value = model.Annex; commandParameters[7].Value = model.FlowState; commandParameters[8].Value = model.Notes; commandParameters[9].Value = model.InputPerson; commandParameters[10].Value = model.InputDate; commandParameters[11].Value = model.ModifyPerson; if (trans == null) { SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters); } else { SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters); } }
private void InintUpdateState() { PayoutModifyModel model = this.payoutModify.GetModel(this.ViewState["ModifyId"].ToString()); if (model != null) { this.contractId = model.ContractID; this.lblModifyCode.Text = model.ModifyCode; this.lblModifyMoney.Text = model.ModifyMoney.ToString(); this.lblModifyDate.Text = model.ModifyDate.Value.ToShortDateString(); this.lblModifyPerson.Text = model.ModifyPerson; this.lblInputPerson.Text = model.InputPerson; this.lblInputDate.Text = model.InputDate.Value.ToShortDateString(); this.lblModifyReason.Text = model.Reason; this.lblNotes.Text = model.Notes; if (model.ModifyMoney.ToString() != "") { Convert.ToDecimal(model.ModifyMoney); } this.InitContractInfo(this.contractId); } }
protected void InitProjectInfo(string modifyId) { PayoutModifyModel payoutModifyModel = new PayoutModifyModel(); payoutModifyModel = this.payoutModify.GetModel(modifyId); if (payoutModifyModel != null) { PayoutContractModel payoutContractModel = new PayoutContractModel(); PayoutContract payoutContract = new PayoutContract(); payoutContractModel = payoutContract.GetModel(payoutModifyModel.ContractID); if (payoutContractModel.PrjGuid != "") { string sqlString = " select PrjCode,PrjName,PrjGuid,TypeCode from pt_prjinfo where prjGuid='" + payoutContractModel.PrjGuid + "' "; DataTable dataTable = publicDbOpClass.DataTableQuary(sqlString); if (dataTable.Rows.Count > 0) { this.LblProjectCode.Text = dataTable.Rows[0]["PrjCode"].ToString(); this.LblProjectName.Text = dataTable.Rows[0]["PrjName"].ToString(); } } } }