private void UpdateInvoice() { PayoutInvoiceInfo model = this.invoice.GetModel(this.invoiceId); model.InvoiceNo = this.txtInvoiceNo.Text.Trim(); model.InvoiceCode = this.txtInvoiceCode.Text.Trim(); model.InvoiceType = this.dropInvoiceType.SelectedValue; model.TaxNo = this.txtTaxNo.Text.Trim(); if (!string.IsNullOrEmpty(this.txtInvoiceDate.Text.Trim())) { model.InvoiceDate = new DateTime?(Convert.ToDateTime(this.txtInvoiceDate.Text.Trim())); } if (!string.IsNullOrEmpty(this.txtAmount.Text.Trim())) { model.Amount = new decimal?(Convert.ToDecimal(this.txtAmount.Text.Trim())); } model.Transactor = this.txtTransactor.Text.Trim(); model.Payer = this.txtPayer.Text.Trim(); model.Payee = this.txtPayee.Text.Trim(); model.Contact = this.txtContact.Text.Trim(); model.BankCode = this.txtBankCode.Text.Trim(); model.Notes = this.txtNotes.Text.Trim(); model.OrganizationCode = this.txtOrganizationCode.Text.Trim(); try { this.invoice.Update(model); base.RegisterScript("top.ui.show('更新成功!'); winclose('InvoiceEdit', 'PayoutInvoiceEdit.aspx?ContractID=" + model.ContractID + "', true);"); } catch (Exception) { base.RegisterHintScript("Update", false, string.Empty); } }
private void AddInvoice() { PayoutInvoiceInfo payoutInvoiceInfo = new PayoutInvoiceInfo(); payoutInvoiceInfo.InvoiceID = this.ViewState["InvoiceId"].ToString(); payoutInvoiceInfo.ContractID = this.contractId; payoutInvoiceInfo.InvoiceNo = this.txtInvoiceNo.Text.Trim(); payoutInvoiceInfo.InvoiceCode = this.txtInvoiceCode.Text.Trim(); payoutInvoiceInfo.InvoiceType = this.dropInvoiceType.SelectedValue; payoutInvoiceInfo.TaxNo = this.txtTaxNo.Text.Trim(); if (!string.IsNullOrEmpty(this.txtInvoiceDate.Text.Trim())) { payoutInvoiceInfo.InvoiceDate = new DateTime?(Convert.ToDateTime(this.txtInvoiceDate.Text.Trim())); } if (!string.IsNullOrEmpty(this.txtAmount.Text.Trim())) { payoutInvoiceInfo.Amount = new decimal?(Convert.ToDecimal(this.txtAmount.Text.Trim())); } payoutInvoiceInfo.Transactor = this.txtTransactor.Text.Trim(); payoutInvoiceInfo.FlowState = new int?(-1); payoutInvoiceInfo.Annex = string.Empty; payoutInvoiceInfo.Payer = this.txtPayer.Text.Trim(); payoutInvoiceInfo.Payee = this.txtPayee.Text.Trim(); payoutInvoiceInfo.InputPerson = this.txtInputPerson.Text.Trim(); payoutInvoiceInfo.Contact = this.txtContact.Text.Trim(); payoutInvoiceInfo.BankCode = this.txtBankCode.Text.Trim(); payoutInvoiceInfo.OrganizationCode = this.txtOrganizationCode.Text.Trim(); if (!string.IsNullOrEmpty(this.txtInputDate.Text.Trim())) { payoutInvoiceInfo.InputDate = new DateTime?(Convert.ToDateTime(this.txtInputDate.Text.Trim())); } payoutInvoiceInfo.Notes = this.txtNotes.Text.Trim(); try { this.invoice.Add(payoutInvoiceInfo); base.RegisterScript("top.ui.show('添加成功!'); winclose('InvoiceEdit', 'PayoutInvoiceEdit.aspx?ContractID=" + this.contractId + "', true);"); } catch (Exception) { base.RegisterHintScript("Add", false, string.Empty); } }
protected void BindPage() { PayoutInvoiceInfo model = this.invoice.GetModel(base.Request["InvoiceId"]); if (model != null) { PayoutContractModel model2 = new PayoutContract().GetModel(model.ContractID); if (model2 != null) { this.lblContractCode.Text = model2.ContractCode; this.lblContractName.Text = model2.ContractName; PTPrjInfoService pTPrjInfoService = new PTPrjInfoService(); string prjCode = pTPrjInfoService.GetById(model2.PrjGuid).PrjCode; this.lblPrjCode.Text = prjCode; this.lblPrjName.Text = model2.PrjName; this.lblContractMoney.Text = model2.ModifiedMoney.ToString(); this.lblSignedDate.Text = Convert.ToDateTime(model2.SignDate).ToShortDateString(); PayoutPayment payoutPayment = new PayoutPayment(); decimal? paySum = payoutPayment.GetPaySum(model2.ContractID); decimal? invoiceSum = this.invoice.GetInvoiceSum(model2.ContractID); this.lblPaymentSum.Text = paySum.ToString(); this.lblInvoiceSum.Text = invoiceSum.ToString(); this.lblDiff.Text = Convert.ToString(paySum - invoiceSum); } this.lblAmountMoney.Text = model.Amount.ToString(); this.lblInvoiceNo.Text = model.InvoiceNo; this.lblInvoiceCode.Text = model.InvoiceCode; this.lblParty.Text = model.Payer; this.lblSecond.Text = model.Payee; this.lblInvoiceType.Text = this.getInvoiceType(model.InvoiceType); this.lblTaxNo.Text = model.TaxNo; this.lblTransactor.Text = model.Transactor; this.lblInvoiceDate.Text = model.InvoiceDate.ToString(); this.lblAddress.Text = model.Contact; this.lblBankCode.Text = model.BankCode; this.lblInputUser.Text = model.InputPerson; this.lblInputTime.Text = Convert.ToDateTime(model.InputDate).ToShortDateString(); this.lblNote.Text = model.Notes; this.lblOrganizationCode.Text = model.OrganizationCode; this.lblUpFiled.Text = FileView.FilesBind(1911, model.InvoiceID); } }
public void Add(PayoutInvoiceInfo model, SqlTransaction trans) { StringBuilder builder = new StringBuilder(); builder.Append("insert into Con_Payout_Invoice("); builder.Append("InvoiceID,ContractID,InvoiceNo,InvoiceCode,InvoiceType,TaxNo,InvoiceDate,Amount,Transactor,Annex,Payer,Payee,FlowState,InputPerson,InputDate,Notes,Contact,BankCode,OrganizationCode)"); builder.Append(" values ("); builder.Append("@InvoiceID,@ContractID,@InvoiceNo,@InvoiceCode,@InvoiceType,@TaxNo,@InvoiceDate,@Amount,@Transactor,@Annex,@Payer,@Payee,@FlowState,@InputPerson,@InputDate,@Notes,@Contact,@BankCode,@OrganizationCode)"); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@InvoiceID", model.InvoiceID), new SqlParameter("@ContractID", model.ContractID), new SqlParameter("@InvoiceNo", model.InvoiceNo), new SqlParameter("@InvoiceCode", model.InvoiceCode), new SqlParameter("@InvoiceType", model.InvoiceType), new SqlParameter("@TaxNo", model.TaxNo), new SqlParameter("@InvoiceDate", model.InvoiceDate), new SqlParameter("@Amount", model.Amount), new SqlParameter("@Transactor", model.Transactor), new SqlParameter("@Annex", model.Annex), new SqlParameter("@Payer", model.Payer), new SqlParameter("@Payee", model.Payee), new SqlParameter("@FlowState", model.FlowState), new SqlParameter("@InputPerson", model.InputPerson), new SqlParameter("@InputDate", model.InputDate), new SqlParameter("@Notes", model.Notes), new SqlParameter("@Contact", model.Contact), new SqlParameter("@BankCode", model.BankCode), new SqlParameter("@OrganizationCode", model.OrganizationCode) }; if (trans == null) { SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters); } else { SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters); } }
private void InitUpdateState() { this.ViewState["InvoiceId"] = this.invoiceId; PayoutInvoiceInfo model = this.invoice.GetModel(this.invoiceId); this.InitContractInfo(model.ContractID); this.txtAmount.Text = model.Amount.ToString(); this.txtInvoiceNo.Text = model.InvoiceNo; this.txtInvoiceCode.Text = model.InvoiceCode; this.txtPayer.Text = model.Payer; this.txtPayee.Text = model.Payee; this.dropInvoiceType.SelectedValue = model.InvoiceType; this.txtTaxNo.Text = model.TaxNo; this.txtTransactor.Text = model.Transactor; this.txtInvoiceDate.Text = model.InvoiceDate.ToString(); this.txtContact.Text = model.Contact; this.txtBankCode.Text = model.BankCode; this.txtInputPerson.Text = model.InputPerson; this.txtInputDate.Text = Convert.ToDateTime(model.InputDate).ToShortDateString(); this.txtNotes.Text = model.Notes; this.txtOrganizationCode.Text = model.OrganizationCode; }
public void Update(PayoutInvoiceInfo model, SqlTransaction trans) { StringBuilder builder = new StringBuilder(); builder.Append("update Con_Payout_Invoice set "); builder.Append("ContractID=@ContractID,"); builder.Append("InvoiceNo=@InvoiceNo,"); builder.Append("InvoiceCode=@InvoiceCode,"); builder.Append("InvoiceType=@InvoiceType,"); builder.Append("TaxNo=@TaxNo,"); builder.Append("InvoiceDate=@InvoiceDate,"); builder.Append("Amount=@Amount,"); builder.Append("Transactor=@Transactor,"); builder.Append("Annex=@Annex,"); builder.Append("Payer=@Payer,"); builder.Append("Payee=@Payee,"); builder.Append("FlowState=@FlowState,"); builder.Append("InputPerson=@InputPerson,"); builder.Append("InputDate=@InputDate,"); builder.Append("Notes=@Notes,"); builder.Append("Contact=@Contact,"); builder.Append("BankCode=@BankCode,"); builder.Append("OrganizationCode=@OrganizationCode"); builder.Append(" where InvoiceID=@InvoiceID "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@InvoiceID", model.InvoiceID), new SqlParameter("@ContractID", model.ContractID), new SqlParameter("@InvoiceNo", model.InvoiceNo), new SqlParameter("@InvoiceCode", model.InvoiceCode), new SqlParameter("@InvoiceType", model.InvoiceType), new SqlParameter("@TaxNo", model.TaxNo), new SqlParameter("@InvoiceDate", model.InvoiceDate), new SqlParameter("@Amount", model.Amount), new SqlParameter("@Transactor", model.Transactor), new SqlParameter("@Annex", model.Annex), new SqlParameter("@Payer", model.Payer), new SqlParameter("@Payee", model.Payee), new SqlParameter("@FlowState", model.FlowState), new SqlParameter("@InputPerson", model.InputPerson), new SqlParameter("@InputDate", model.InputDate), new SqlParameter("@Notes", model.Notes), new SqlParameter("@Contact", model.Contact), new SqlParameter("@BankCode", model.BankCode), new SqlParameter("@OrganizationCode", model.OrganizationCode) }; if (trans == null) { SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters); } else { SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters); } }
public void Add(PayoutInvoiceInfo model) { this.invoice.Add(model, null); }
public void Update(PayoutInvoiceInfo model) { this.invoice.Update(model, null); }