protected override void Page_Load(object sender, EventArgs e) { CustomerInvoiceFormUI customerInvoiceFormUI = new CustomerInvoiceFormUI(); if (!Page.IsPostBack) { if (Request.QueryString["CustomerInvoiceId"] != null) { customerInvoiceFormUI.Tbl_CustomerInvoiceId = Request.QueryString["CustomerInvoiceId"]; BindInvoiceTypeDropDownList(); BindDocumentStatusList(); FillForm(customerInvoiceFormUI); btnSave.Visible = false; btnClear.Visible = false; btnUpdate.Visible = true; btnDelete.Visible = true; lblHeading.Text = "Update Customer Invoice"; } else { BindDocumentStatusList(); BindInvoiceTypeDropDownList(); btnSave.Visible = true; btnClear.Visible = true; btnUpdate.Visible = false; btnDelete.Visible = false; lblHeading.Text = "Add New Customer Invoice"; } } }
public int DeleteCustomerInvoice(CustomerInvoiceFormUI customerInvoiceFormUI) { int resutl = 0; resutl = customerInvoiceFormDAL.DeleteCustomerInvoice(customerInvoiceFormUI); return(resutl); }
public int AddCustomerInvoice(CustomerInvoiceFormUI customerInvoiceFormUI) { int resutl = 0; resutl = customerInvoiceFormDAL.AddCustomerInvoice(customerInvoiceFormUI); return(resutl); }
public DataTable GetCustomerInvoiceListById(CustomerInvoiceFormUI customerInvoiceFormUI) { DataTable dtb = new DataTable(); dtb = customerInvoiceFormDAL.GetCustomerInvoiceListById(customerInvoiceFormUI); return(dtb); }
private void FillForm(CustomerInvoiceFormUI customerInvoiceFormUI) { try { DataTable dtb = customerInvoiceFormBAL.GetCustomerInvoiceListById(customerInvoiceFormUI); if (dtb.Rows.Count > 0) { txtDocumentDate.Text = dtb.Rows[0]["DocumentDate"].ToString(); ddlOpt_InvoiceAndOrderType.SelectedValue = dtb.Rows[0]["Opt_InvoiceAndOrderTypeLable"].ToString(); txtInvoiceAndOrderTypeGuid.Text = dtb.Rows[0]["tbl_InvoiceAndOrderTypeId"].ToString(); txtInvoiceAndOrderType.Text = dtb.Rows[0]["tbl_InvoiceAndOrderTypeId"].ToString(); txtInvoiceAndOrderType.Text = dtb.Rows[0]["Opt_InvoiceAndOrderTypeLable"].ToString(); txtDocumentNumber.Text = dtb.Rows[0]["DocumentNumber"].ToString(); txtBatchGuid.Text = dtb.Rows[0]["tbl_BatchId"].ToString(); txtBatch.Text = dtb.Rows[0]["BatchName"].ToString(); txtCustomerGuid.Text = dtb.Rows[0]["tbl_CustomerId"].ToString(); txtCustomer.Text = dtb.Rows[0]["CustomerName"].ToString(); txtSitesGuid.Text = dtb.Rows[0]["tbl_SitesId"].ToString(); txtSites.Text = dtb.Rows[0]["SiteNumber"].ToString(); txtCustomerPONumber.Text = dtb.Rows[0]["CustomerPONumber"].ToString(); txtCurrencyGuid.Text = dtb.Rows[0]["tbl_CurrencyId"].ToString(); txtCurrency.Text = dtb.Rows[0]["CurrencyName"].ToString(); txtAmountReceived.Text = dtb.Rows[0]["AmountReceived"].ToString(); txtOnAccount.Text = dtb.Rows[0]["OnAccount"].ToString(); txtSubTotalAmount.Text = dtb.Rows[0]["SubTotalAmount"].ToString(); txtTradeDiscountAmount.Text = dtb.Rows[0]["TradeDiscountAmount"].ToString(); txtFreightAmount.Text = dtb.Rows[0]["FreightAmount"].ToString(); txtTotalAmount.Text = dtb.Rows[0]["TotalAmount"].ToString(); //ddlOpt_DocumentStatus.SelectedValue = dtb.Rows[0]["Opt_DocumentStatus"].ToString(); txtPostingDate.Text = dtb.Rows[0]["PostingDate"].ToString(); txtQuoteDate.Text = dtb.Rows[0]["QuoteDate"].ToString(); txtOrderDate.Text = dtb.Rows[0]["OrderDate"].ToString(); txtInvoiceDate.Text = dtb.Rows[0]["InvoiceDate"].ToString(); txtBackOrderDate.Text = dtb.Rows[0]["BackOrderDate"].ToString(); txtReturnDate.Text = dtb.Rows[0]["ReturnDate"].ToString(); txtRequestedShipDate.Text = dtb.Rows[0]["RequestedShipDate"].ToString(); txtDateFulfilled.Text = dtb.Rows[0]["DateFulfilled"].ToString(); txtActualShipDate.Text = dtb.Rows[0]["ActualShipDate"].ToString(); } else { lblError.Text = Resources.GlobalResource.msgCouldNotLoadData; divError.Visible = true; } } catch (Exception exp) { logExcpUIobj.MethodName = "FillForm()"; logExcpUIobj.ResourceName = "System_Settings_BatchForm.CS"; logExcpUIobj.RecordId = customerInvoiceFormUI.Tbl_CustomerInvoiceId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[System_Settings_BatchForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]"); } }
public DataTable GetCustomerInvoiceListById(CustomerInvoiceFormUI customerInvoiceFormUI) { DataSet ds = new DataSet(); DataTable dtbl = new DataTable(); try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SqlCommand sqlCmd = new SqlCommand("SP_CustomerInvoice_SelectById", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_CustomerInvoiceId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_CustomerInvoiceId"].Value = customerInvoiceFormUI.Tbl_CustomerInvoiceId; using (SqlDataAdapter adapter = new SqlDataAdapter(sqlCmd)) { adapter.Fill(ds); } } if (ds.Tables.Count > 0) { dtbl = ds.Tables[0]; } } catch (Exception exp) { logExcpUIobj.MethodName = "getCustomerInvoiceListById()"; logExcpUIobj.ResourceName = "CustomerInvoiceFormDAL.CS"; logExcpUIobj.RecordId = customerInvoiceFormUI.Tbl_CustomerInvoiceId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[CustomerInvoiceFormDAL : getCustomerInvoiceListById] An error occured in the processing of Record Id : " + customerInvoiceFormUI.Tbl_CustomerInvoiceId + ". Details : [" + exp.ToString() + "]"); } finally { ds.Dispose(); } return(dtbl); }
public int DeleteCustomerInvoice(CustomerInvoiceFormUI customerInvoiceFormUI) { int result = 0; try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SupportCon.Open(); SqlCommand sqlCmd = new SqlCommand("SP_CustomerInvoice_Delete", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_CustomerInvoiceId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_CustomerInvoiceId"].Value = customerInvoiceFormUI.Tbl_CustomerInvoiceId; result = sqlCmd.ExecuteNonQuery(); sqlCmd.Dispose(); SupportCon.Close(); } } catch (Exception exp) { logExcpUIobj.MethodName = "DeleteCustomerInvoice()"; logExcpUIobj.ResourceName = "CustomerInvoiceFormDAL.CS"; logExcpUIobj.RecordId = customerInvoiceFormUI.Tbl_CustomerInvoiceId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[CustomerInvoiceFormDAL : DeleteCustomerInvoice] An error occured in the processing of Record Id : " + customerInvoiceFormUI.Tbl_CustomerInvoiceId + ". Details : [" + exp.ToString() + "]"); } return(result); }
public int AddCustomerInvoice(CustomerInvoiceFormUI customerInvoiceFormUI) { int result = 0; try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SupportCon.Open(); SqlCommand sqlCmd = new SqlCommand("SP_CustomerInvoice_Insert", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar); sqlCmd.Parameters["@CreatedBy"].Value = customerInvoiceFormUI.CreatedBy; sqlCmd.Parameters.Add("@tbl_OrganizationId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_OrganizationId"].Value = customerInvoiceFormUI.Tbl_OrganizationId; sqlCmd.Parameters.Add("@DocumentDate", SqlDbType.DateTime); sqlCmd.Parameters["@DocumentDate"].Value = customerInvoiceFormUI.DocumentDate; sqlCmd.Parameters.Add("@Opt_InvoiceAndOrderType", SqlDbType.Int); sqlCmd.Parameters["@Opt_InvoiceAndOrderType"].Value = customerInvoiceFormUI.Opt_InvoiceAndOrderType; sqlCmd.Parameters.Add("@tbl_InvoiceAndOrderTypeId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_InvoiceAndOrderTypeId"].Value = customerInvoiceFormUI.Tbl_InvoiceAndOrderTypeId; sqlCmd.Parameters.Add("@DocumentNumber", SqlDbType.NVarChar); sqlCmd.Parameters["@DocumentNumber"].Value = customerInvoiceFormUI.DocumentNumber; sqlCmd.Parameters.Add("@tbl_BatchId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_BatchId"].Value = customerInvoiceFormUI.Tbl_BatchId; sqlCmd.Parameters.Add("@tbl_CustomerId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_CustomerId"].Value = customerInvoiceFormUI.Tbl_CustomerId; sqlCmd.Parameters.Add("@tbl_SitesId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_SitesId"].Value = customerInvoiceFormUI.Tbl_SitesId; sqlCmd.Parameters.Add("@CustomerPONumber", SqlDbType.NVarChar); sqlCmd.Parameters["@CustomerPONumber"].Value = customerInvoiceFormUI.CustomerPONumber; sqlCmd.Parameters.Add("@tbl_CurrencyId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_CurrencyId"].Value = customerInvoiceFormUI.Tbl_CurrencyId; sqlCmd.Parameters.Add("@AmountReceived", SqlDbType.Decimal); sqlCmd.Parameters["@AmountReceived"].Value = customerInvoiceFormUI.AmountReceived; sqlCmd.Parameters.Add("@OnAccount", SqlDbType.Decimal); sqlCmd.Parameters["@OnAccount"].Value = customerInvoiceFormUI.OnAccount; sqlCmd.Parameters.Add("@SubTotalAmount", SqlDbType.Decimal); sqlCmd.Parameters["@SubTotalAmount"].Value = customerInvoiceFormUI.SubTotalAmount; sqlCmd.Parameters.Add("@TradeDiscountAmount", SqlDbType.Decimal); sqlCmd.Parameters["@TradeDiscountAmount"].Value = customerInvoiceFormUI.TradeDiscountAmount; sqlCmd.Parameters.Add("@FreightAmount", SqlDbType.Decimal); sqlCmd.Parameters["@FreightAmount"].Value = customerInvoiceFormUI.FreightAmount; sqlCmd.Parameters.Add("@TotalAmount", SqlDbType.Decimal); sqlCmd.Parameters["@TotalAmount"].Value = customerInvoiceFormUI.TotalAmount; sqlCmd.Parameters.Add("@Opt_DocumentStatus", SqlDbType.TinyInt); sqlCmd.Parameters["@Opt_DocumentStatus"].Value = customerInvoiceFormUI.Opt_DocumentStatus; sqlCmd.Parameters.Add("@PostingDate", SqlDbType.DateTime); sqlCmd.Parameters["@PostingDate"].Value = customerInvoiceFormUI.PostingDate; sqlCmd.Parameters.Add("@QuoteDate", SqlDbType.DateTime); sqlCmd.Parameters["@QuoteDate"].Value = customerInvoiceFormUI.QuoteDate; sqlCmd.Parameters.Add("@OrderDate", SqlDbType.DateTime); sqlCmd.Parameters["@OrderDate"].Value = customerInvoiceFormUI.OrderDate; sqlCmd.Parameters.Add("@InvoiceDate", SqlDbType.DateTime); sqlCmd.Parameters["@InvoiceDate"].Value = customerInvoiceFormUI.InvoiceDate; sqlCmd.Parameters.Add("@BackOrderDate", SqlDbType.DateTime); sqlCmd.Parameters["@BackOrderDate"].Value = customerInvoiceFormUI.BackOrderDate; sqlCmd.Parameters.Add("@ReturnDate", SqlDbType.DateTime); sqlCmd.Parameters["@ReturnDate"].Value = customerInvoiceFormUI.ReturnDate; sqlCmd.Parameters.Add("@RequestedShipDate", SqlDbType.DateTime); sqlCmd.Parameters["@RequestedShipDate"].Value = customerInvoiceFormUI.RequestedShipDate; sqlCmd.Parameters.Add("@DateFulfilled", SqlDbType.DateTime); sqlCmd.Parameters["@DateFulfilled"].Value = customerInvoiceFormUI.DateFulfilled; sqlCmd.Parameters.Add("@ActualShipDate", SqlDbType.DateTime); sqlCmd.Parameters["@ActualShipDate"].Value = customerInvoiceFormUI.ActualShipDate; result = sqlCmd.ExecuteNonQuery(); sqlCmd.Dispose(); SupportCon.Close(); } } catch (Exception exp) { logExcpUIobj.MethodName = "AddCustomerInvoice()"; logExcpUIobj.ResourceName = "CustomerInvoiceFormDAL.CS"; logExcpUIobj.RecordId = ""; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[CustomerInvoiceFormDAL : AddCustomerInvoice] An error occured in the processing of Record. Details : [" + exp.ToString() + "]"); } return(result); }