private void UpdateHeaderInfo() { InvtBatchCAP_Header oHeader = InvtBatchCAP_Header.Load(this.CAPHeaderId); if (oHeader != null) { oHeader.TotalAmount = Convert.ToDecimal(DAL.Common.Utility.IsNumeric(txtTotalAmount.Text) ? txtTotalAmount.Text : "0"); oHeader.Save(); } }
private void Delete() { InvtBatchCAP_Header oHeader = InvtBatchCAP_Header.Load(this.CAPHeaderId); if (oHeader != null) { string sql = "HeaderId = '" + oHeader.HeaderId.ToString() + "'"; DeleteDetails(sql); oHeader.Delete(); } }
private void SaveCAP() { InvtBatchCAP_Header oHeader = InvtBatchCAP_Header.Load(this.CAPHeaderId); if (oHeader == null) { oHeader = new InvtBatchCAP_Header(); txtTxNumber.Text = Common.Utility.QueuingTxNumber(DAL.Common.Enums.TxType.CAP); oHeader.TxNumber = txtTxNumber.Text; oHeader.TxType = DAL.Common.Enums.TxType.CAP.ToString(); oHeader.CreatedBy = DAL.Common.Config.CurrentUserId; oHeader.CreatedOn = DateTime.Now; } oHeader.TxDate = dtpTxDate.Value; oHeader.Status = Convert.ToInt32(cboStatus.Text == "HOLD" ? DAL.Common.Enums.Status.Draft.ToString("d") : DAL.Common.Enums.Status.Active.ToString("d")); oHeader.WorkplaceId = new Guid(cboWorkplace.SelectedValue.ToString()); oHeader.StaffId = new Guid(cboStaff.SelectedValue.ToString()); oHeader.SupplierId = new Guid(cboSupplier.SelectedValue.ToString()); oHeader.SupplierRefernce = txtSupplierInvoice.Text; oHeader.Remarks = txtRemarks.Text; oHeader.Reference = txtReference.Text; oHeader.CurrencyCode = cboCurrency.Text; oHeader.ExchangeRate = Convert.ToDecimal(txtExchgRate.Text.Length == 0 ? "1" : txtExchgRate.Text); oHeader.LinkToAP = chkApLink.Checked; oHeader.ModifiedBy = DAL.Common.Config.CurrentUserId; oHeader.ModifiedOn = DateTime.Now; oHeader.Save(); this.CAPHeaderId = oHeader.HeaderId; SaveCAPDetail(); UpdateHeaderInfo(); }
private void ShowItem() { InvtBatchCAP_Header oHeader = InvtBatchCAP_Header.Load(this.CAPHeaderId); if (oHeader != null) { this.txtTxNumber.Text = oHeader.TxNumber; this.txtTxType.Text = oHeader.TxType; this.dtpTxDate.Value = oHeader.TxDate; this.cboCurrency.Text = oHeader.CurrencyCode; this.txtExchgRate.Text = oHeader.ExchangeRate.ToString("n4"); this.cboWorkplace.SelectedValue = oHeader.WorkplaceId; this.cboStaff.SelectedValue = oHeader.StaffId; this.cboStatus.Text = (oHeader.Status == 0) ? "HOLD" : "POST"; this.cboSupplier.SelectedValue = oHeader.SupplierId; this.txtSupplierInvoice.Text = oHeader.SupplierRefernce; this.txtRemarks.Text = oHeader.Remarks; this.txtReference.Text = oHeader.Reference; InitCurrency(oHeader.CurrencyCode); this.txtModifiedOn.Text = oHeader.ModifiedOn.ToString("dd/MM/yyyy"); this.txtModifiedBy.Text = GetStaffName(oHeader.ModifiedBy); this.txtAmendmentRestrict.Text = oHeader.ReadOnly ? "Y" : "N"; this.chkApLink.Checked = oHeader.LinkToAP; this.txtTotalQty.Text = GetTotalRequiredQty().ToString("n0"); this.txtTotalAmount.Text = GetTotalAmount().ToString("n2"); BindCAPDetailsInfo(GetData()); } }