示例#1
0
    protected override void Page_Load(object sender, EventArgs e)
    {
        CustomerInvoiceProcessFormUI customerInvoiceProcessFormUI = new CustomerInvoiceProcessFormUI();

        if (!Page.IsPostBack)
        {
            if (Request.QueryString["CustomerInvoiceProcessId"] != null)
            {
                customerInvoiceProcessFormUI.Tbl_CustomerInvoiceProcessId = Request.QueryString["CustomerInvoiceProcessId"];

                BindDocumentTypeDropDownList();
                FillForm(customerInvoiceProcessFormUI);

                btnSave.Visible   = false;
                btnClear.Visible  = false;
                btnUpdate.Visible = true;
                btnDelete.Visible = true;
                lblHeading.Text   = "Update Customer Invoice Process";
            }
            else
            {
                BindDocumentTypeDropDownList();

                btnSave.Visible   = true;
                btnClear.Visible  = true;
                btnUpdate.Visible = false;
                btnDelete.Visible = false;
                lblHeading.Text   = "Add New Customer InvoiceProcess";
            }
        }
    }
示例#2
0
    private void FillForm(CustomerInvoiceProcessFormUI customerInvoiceProcessFormUI)
    {
        try
        {
            DataTable dtb = customerInvoiceProcessFormBAL.GetCustomerInvoiceProcessListById(customerInvoiceProcessFormUI);

            if (dtb.Rows.Count > 0)
            {
                txtBatchGuid.Text         = dtb.Rows[0]["tbl_BatchId"].ToString();
                txtBatch.Text             = dtb.Rows[0]["BatchName"].ToString();
                txtDocumentNumber.Text    = dtb.Rows[0]["DocumentNumber"].ToString();
                txtDocumentDate.Text      = dtb.Rows[0]["DocumentDate"].ToString();
                txtDescription.Text       = dtb.Rows[0]["Description"].ToString();
                txtPostingDate.Text       = dtb.Rows[0]["PostingDate"].ToString();
                txtInvoiceDate.Text       = dtb.Rows[0]["InvoiceDate"].ToString();
                txtInvoiceIssueDate.Text  = dtb.Rows[0]["InvoiceIssueDate"].ToString();
                txtCustomerGuid.Text      = dtb.Rows[0]["tbl_CustomerId"].ToString();
                txtCustomer.Text          = dtb.Rows[0]["CustomerName"].ToString();
                txtCurrencyGuid.Text      = dtb.Rows[0]["tbl_CurrencyId"].ToString();
                txtCurrency.Text          = dtb.Rows[0]["CurrencyName"].ToString();
                txtPaymentTermseGuid.Text = dtb.Rows[0]["tbl_PaymentTermsId"].ToString();
                txtPaymentTerms.Text      = dtb.Rows[0]["PaymentTermsName"].ToString();
                txtPONumber.Text          = dtb.Rows[0]["PONumber"].ToString();
                txtCost.Text                   = dtb.Rows[0]["Cost"].ToString();
                txtSales.Text                  = dtb.Rows[0]["Sales"].ToString();
                txtTradeDiscount.Text          = dtb.Rows[0]["TradeDiscount"].ToString();
                txtFreight.Text                = dtb.Rows[0]["Freight"].ToString();
                txtTotal.Text                  = dtb.Rows[0]["Total"].ToString();
                txtPayablesBankGuid.Text       = dtb.Rows[0]["tbl_PayablesId_BankTransfer"].ToString();
                txtPayablesBank.Text           = dtb.Rows[0]["PaymentNumberBank"].ToString();
                txtBankTransferAmount.Text     = dtb.Rows[0]["BankTransferAmount"].ToString();
                txtPayablesCashGuid.Text       = dtb.Rows[0]["tbl_PayablesId_Cash"].ToString();
                txtPayablesCash.Text           = dtb.Rows[0]["PayablesTypeCash"].ToString();
                txtCash.Text                   = dtb.Rows[0]["CashAmount"].ToString();
                txtCheque.Text                 = dtb.Rows[0]["ChequeAmount"].ToString();
                txtPayablesChequeGuid.Text     = dtb.Rows[0]["tbl_PayablesId_Cheque"].ToString();
                txtPayablesCheque.Text         = dtb.Rows[0]["PayablesTypeCheque"].ToString();
                txtPayablesCreditCardGuid.Text = dtb.Rows[0]["tbl_PayablesId_CreditCard"].ToString();
                txtPayablesCreditCard.Text     = dtb.Rows[0]["PayablesTypeCard"].ToString();
                txtCheque.Text                 = dtb.Rows[0]["ChequeAmount"].ToString();
                txtCreditCard.Text             = dtb.Rows[0]["CreditCardAmount"].ToString();
                txtOnAccount.Text              = dtb.Rows[0]["OnAccount"].ToString();
            }
            else
            {
                lblError.Text    = Resources.GlobalResource.msgCouldNotLoadData;
                divError.Visible = true;
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "FillForm()";
            logExcpUIobj.ResourceName     = "Finance_Accounts_Receivable_Customer_Invoice_Processing__Services_CustomerInvoiceProcessForm.CS";
            logExcpUIobj.RecordId         = customerInvoiceProcessFormUI.Tbl_CustomerInvoiceProcessId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[Finance_Accounts_Receivable_Customer_Invoice_Processing__Services_CustomerInvoiceProcessForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]");
        }
    }
    public int DeleteCustomerInvoiceProcess(CustomerInvoiceProcessFormUI customerInvoiceProcessFormUI)
    {
        int resutl = 0;

        resutl = customerInvoiceProcessFormDAL.DeleteCustomerInvoiceProcess(customerInvoiceProcessFormUI);
        return(resutl);
    }
    public DataTable GetCustomerInvoiceProcessListById(CustomerInvoiceProcessFormUI customerInvoiceProcessFormUI)
    {
        DataTable dtb = new DataTable();

        dtb = customerInvoiceProcessFormDAL.GetCustomerInvoiceProcessListById(customerInvoiceProcessFormUI);
        return(dtb);
    }
    public DataTable GetCustomerInvoiceProcessListById(CustomerInvoiceProcessFormUI customerInvoiceProcessFormUI)
    {
        DataSet   ds   = new DataSet();
        DataTable dtbl = new DataTable();

        try
        {
            using (SqlConnection SupportCon = new SqlConnection(connectionString))
            {
                SqlCommand sqlCmd = new SqlCommand("SP_CustomerInvoiceProcess_SelectById", SupportCon);
                sqlCmd.CommandType    = CommandType.StoredProcedure;
                sqlCmd.CommandTimeout = commandTimeout;

                sqlCmd.Parameters.Add("@tbl_CustomerInvoiceProcessId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_CustomerInvoiceProcessId"].Value = customerInvoiceProcessFormUI.Tbl_CustomerInvoiceProcessId;

                using (SqlDataAdapter adapter = new SqlDataAdapter(sqlCmd))
                {
                    adapter.Fill(ds);
                }
            }
            if (ds.Tables.Count > 0)
            {
                dtbl = ds.Tables[0];
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "getCustomerInvoiceProcessListById()";
            logExcpUIobj.ResourceName     = "CustomerInvoiceProcessFormDAL.CS";
            logExcpUIobj.RecordId         = customerInvoiceProcessFormUI.Tbl_CustomerInvoiceProcessId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[CustomerInvoiceProcessFormDAL : getCustomerInvoiceProcessListById] An error occured in the processing of Record Id : " + customerInvoiceProcessFormUI.Tbl_CustomerInvoiceProcessId + ". Details : [" + exp.ToString() + "]");
        }
        finally
        {
            ds.Dispose();
        }

        return(dtbl);
    }
    public int DeleteCustomerInvoiceProcess(CustomerInvoiceProcessFormUI customerInvoiceProcessFormUI)
    {
        int result = 0;

        try
        {
            using (SqlConnection SupportCon = new SqlConnection(connectionString))
            {
                SupportCon.Open();
                SqlCommand sqlCmd = new SqlCommand("SP_CustomerInvoiceProcess_Delete", SupportCon);

                sqlCmd.CommandType    = CommandType.StoredProcedure;
                sqlCmd.CommandTimeout = commandTimeout;

                sqlCmd.Parameters.Add("@tbl_CustomerInvoiceProcessId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_CustomerInvoiceProcessId"].Value = customerInvoiceProcessFormUI.Tbl_CustomerInvoiceProcessId;

                result = sqlCmd.ExecuteNonQuery();

                sqlCmd.Dispose();
                SupportCon.Close();
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "DeleteCustomerInvoiceProcess()";
            logExcpUIobj.ResourceName     = "CustomerInvoiceProcessFormDAL.CS";
            logExcpUIobj.RecordId         = customerInvoiceProcessFormUI.Tbl_CustomerInvoiceProcessId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[CustomerInvoiceProcessFormDAL : DeleteCustomerInvoiceProcess] An error occured in the processing of Record Id : " + customerInvoiceProcessFormUI.Tbl_CustomerInvoiceProcessId + ". Details : [" + exp.ToString() + "]");
        }

        return(result);
    }
    public int AddCustomerInvoiceProcess(CustomerInvoiceProcessFormUI customerInvoiceProcessFormUI)
    {
        int result = 0;

        try
        {
            using (SqlConnection SupportCon = new SqlConnection(connectionString))
            {
                SupportCon.Open();
                SqlCommand sqlCmd = new SqlCommand("SP_CustomerInvoiceProcess_Insert", SupportCon);
                sqlCmd.CommandType    = CommandType.StoredProcedure;
                sqlCmd.CommandTimeout = commandTimeout;

                sqlCmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar);
                sqlCmd.Parameters["@CreatedBy"].Value = customerInvoiceProcessFormUI.CreatedBy;

                sqlCmd.Parameters.Add("@tbl_OrganizationId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_OrganizationId"].Value = customerInvoiceProcessFormUI.Tbl_OrganizationId;

                sqlCmd.Parameters.Add("@Opt_DocumentType", SqlDbType.TinyInt);
                sqlCmd.Parameters["@Opt_DocumentType"].Value = customerInvoiceProcessFormUI.Opt_DocumentType;

                sqlCmd.Parameters.Add("@tbl_BatchId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_BatchId"].Value = customerInvoiceProcessFormUI.Tbl_BatchId;

                sqlCmd.Parameters.Add("@DocumentNumber", SqlDbType.NVarChar);
                sqlCmd.Parameters["@DocumentNumber"].Value = customerInvoiceProcessFormUI.DocumentNumber;

                sqlCmd.Parameters.Add("@DocumentDate", SqlDbType.DateTime);
                sqlCmd.Parameters["@DocumentDate"].Value = customerInvoiceProcessFormUI.DocumentDate;


                sqlCmd.Parameters.Add("@Description", SqlDbType.NVarChar);
                sqlCmd.Parameters["@Description"].Value = customerInvoiceProcessFormUI.Description;

                sqlCmd.Parameters.Add("@PostingDate", SqlDbType.DateTime);
                sqlCmd.Parameters["@PostingDate"].Value = customerInvoiceProcessFormUI.PostingDate;


                sqlCmd.Parameters.Add("@InvoiceDate", SqlDbType.DateTime);
                sqlCmd.Parameters["@InvoiceDate"].Value = customerInvoiceProcessFormUI.InvoiceDate;


                sqlCmd.Parameters.Add("@InvoiceIssueDate", SqlDbType.DateTime);
                sqlCmd.Parameters["@InvoiceIssueDate"].Value = customerInvoiceProcessFormUI.InvoiceIssueDate;


                sqlCmd.Parameters.Add("@tbl_CustomerId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_CustomerId"].Value = customerInvoiceProcessFormUI.Tbl_CustomerId;

                sqlCmd.Parameters.Add("@tbl_CurrencyId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_CurrencyId"].Value = customerInvoiceProcessFormUI.Tbl_CurrencyId;

                sqlCmd.Parameters.Add("@tbl_PaymentTermsId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_PaymentTermsId"].Value = customerInvoiceProcessFormUI.Tbl_PaymentTermsId;

                sqlCmd.Parameters.Add("@PONumber", SqlDbType.NVarChar);
                sqlCmd.Parameters["@PONumber"].Value = customerInvoiceProcessFormUI.PONumber;

                sqlCmd.Parameters.Add("@Cost", SqlDbType.Decimal);
                sqlCmd.Parameters["@Cost"].Value = customerInvoiceProcessFormUI.Cost;

                sqlCmd.Parameters.Add("@Sales", SqlDbType.Decimal);
                sqlCmd.Parameters["@Sales"].Value = customerInvoiceProcessFormUI.Sales;

                sqlCmd.Parameters.Add("@TradeDiscount", SqlDbType.Decimal);
                sqlCmd.Parameters["@TradeDiscount"].Value = customerInvoiceProcessFormUI.TradeDiscount;

                sqlCmd.Parameters.Add("@Freight", SqlDbType.Decimal);
                sqlCmd.Parameters["@Freight"].Value = customerInvoiceProcessFormUI.Freight;

                sqlCmd.Parameters.Add("@Total", SqlDbType.Decimal);
                sqlCmd.Parameters["@Total"].Value = customerInvoiceProcessFormUI.Total;

                sqlCmd.Parameters.Add("@tbl_PayablesId_BankTransfer", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_PayablesId_BankTransfer"].Value = customerInvoiceProcessFormUI.Tbl_PayablesId_BankTransfer;

                sqlCmd.Parameters.Add("@BankTransferAmount", SqlDbType.Decimal);
                sqlCmd.Parameters["@BankTransferAmount"].Value = customerInvoiceProcessFormUI.BankTransferAmount;

                sqlCmd.Parameters.Add("@tbl_PayablesId_Cash", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_PayablesId_Cash"].Value = customerInvoiceProcessFormUI.Tbl_PayablesId_Cash;

                sqlCmd.Parameters.Add("@CashAmount", SqlDbType.Decimal);
                sqlCmd.Parameters["@CashAmount"].Value = customerInvoiceProcessFormUI.CashAmount;

                sqlCmd.Parameters.Add("@tbl_PayablesId_Cheque", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_PayablesId_Cheque"].Value = customerInvoiceProcessFormUI.Tbl_PayablesId_Cheque;

                sqlCmd.Parameters.Add("@ChequeAmount", SqlDbType.Decimal);
                sqlCmd.Parameters["@ChequeAmount"].Value = customerInvoiceProcessFormUI.ChequeAmount;

                sqlCmd.Parameters.Add("@tbl_PayablesId_CreditCard", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_PayablesId_CreditCard"].Value = customerInvoiceProcessFormUI.Tbl_PayablesId_CreditCard;

                sqlCmd.Parameters.Add("@CreditCardAmount", SqlDbType.Decimal);
                sqlCmd.Parameters["@CreditCardAmount"].Value = customerInvoiceProcessFormUI.CreditCardAmount;

                sqlCmd.Parameters.Add("@OnAccount", SqlDbType.Decimal);
                sqlCmd.Parameters["@OnAccount"].Value = customerInvoiceProcessFormUI.OnAccount;

                result = sqlCmd.ExecuteNonQuery();

                sqlCmd.Dispose();
                SupportCon.Close();
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "AddCustomerInvoiceProcess()";
            logExcpUIobj.ResourceName     = "CustomerInvoiceProcessFormDAL.CS";
            logExcpUIobj.RecordId         = "";
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[CustomerInvoiceProcessFormDAL : AddCustomerInvoiceProcess] An error occured in the processing of Record. Details : [" + exp.ToString() + "]");
        }

        return(result);
    }