Esempio n. 1
0
    public int DeleteCustomerGroup(CustomerGroupFormUI customerGroupFormUI)
    {
        int resutl = 0;

        resutl = customerGroupFormDAL.DeleteCustomerGroup(customerGroupFormUI);
        return(resutl);
    }
Esempio n. 2
0
    public DataTable GetCustomerGroupListById(CustomerGroupFormUI customerGroupFormUI)
    {
        DataTable dtb = new DataTable();

        dtb = customerGroupFormDAL.GetCustomerGroupListById(customerGroupFormUI);
        return(dtb);
    }
Esempio n. 3
0
    public int AddCustomerGroup(CustomerGroupFormUI customerGroupFormUI)
    {
        int resutl = 0;

        resutl = customerGroupFormDAL.AddCustomerGroup(customerGroupFormUI);
        return(resutl);
    }
    private void FillForm(CustomerGroupFormUI customerGroupFormUI)
    {
        try
        {
            DataTable dtb = customerGroupFormBAL.GetCustomerGroupListById(customerGroupFormUI);

            if (dtb.Rows.Count > 0)
            {
                txtCustomerGroupId_SelfGuid.Text = dtb.Rows[0]["tbl_CustomerGroupId_Self"].ToString();
                txtCustomerGroupId_Self.Text     = dtb.Rows[0]["CustomerGroupId_Self"].ToString();
                txtDescription.Text                 = dtb.Rows[0]["description"].ToString();
                chckIsDefault.Checked               = Convert.ToBoolean(dtb.Rows[0]["IsDefault"].ToString());
                txtCurrencyGuid.Text                = dtb.Rows[0]["tbl_CurrencyId"].ToString();
                txtCurrency.Text                    = dtb.Rows[0]["CurrencyName"].ToString();
                ddlOpt_BalanceType.SelectedValue    = dtb.Rows[0]["Opt_BalanceType"].ToString();
                ddlOpt_MinimumPayment.SelectedValue = dtb.Rows[0]["Opt_MinimumPayment"].ToString();
                txtMinimumPaymentAmount.Text        = dtb.Rows[0]["MinimumPaymentAmount"].ToString();
                ddlOpt_CreditLimit.SelectedValue    = dtb.Rows[0]["Opt_CreditLimit"].ToString();
                txtCreditLimitAmount.Text           = dtb.Rows[0]["CreditLimitAmount"].ToString();
                ddlOpt_WriteOff.SelectedValue       = dtb.Rows[0]["Opt_WriteOff"].ToString();
                txtWriteOffAmount.Text              = dtb.Rows[0]["WriteoffAmount"].ToString();
                txtTradeDiscount.Text               = dtb.Rows[0]["TradeDiscount"].ToString();
                txtPaymentTermGuid.Text             = dtb.Rows[0]["tbl_PaymentTermsId"].ToString();
                txtPaymentTerms.Text                = dtb.Rows[0]["PaymentTermsName"].ToString();
                chckCalendarYear.Checked            = Convert.ToBoolean(dtb.Rows[0]["CalendarYear"].ToString());
                chckFiscalYear.Checked              = Convert.ToBoolean(dtb.Rows[0]["FiscalYear"].ToString());
                chckTransaction.Checked             = Convert.ToBoolean(dtb.Rows[0]["Transaction"].ToString());
                chckDistribution.Checked            = Convert.ToBoolean(dtb.Rows[0]["Distribution"].ToString());
                ddlOpt_StatementCycle.SelectedValue = dtb.Rows[0]["Opt_StatementCycle"].ToString();
            }
            else
            {
                lblError.Text    = Resources.GlobalResource.msgCouldNotLoadData;
                divError.Visible = true;
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "FillForm()";
            logExcpUIobj.ResourceName     = "Finance_Accounts_Receivable_Customer_Master_Creation_CustomerGroupForm.CS";
            logExcpUIobj.RecordId         = customerGroupFormUI.Tbl_CustomerGroupId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[Finance_Accounts_Receivable_Customer_Master_Creation_CustomerGroupForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]");
        }
    }
    public DataTable GetCustomerGroupListById(CustomerGroupFormUI customerGroupFormUI)
    {
        DataSet   ds   = new DataSet();
        DataTable dtbl = new DataTable();

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

                sqlCmd.Parameters.Add("@tbl_CustomerGroupId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_CustomerGroupId"].Value = customerGroupFormUI.Tbl_CustomerGroupId;

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

            log.Error("[CustomerGroupFormDAL : getCustomerGroupListById] An error occured in the processing of Record Id : " + customerGroupFormUI.Tbl_CustomerGroupId + ". Details : [" + exp.ToString() + "]");
        }
        finally
        {
            ds.Dispose();
        }

        return(dtbl);
    }
    protected override void Page_Load(object sender, EventArgs e)
    {
        CustomerGroupFormUI customerGroupFormUI = new CustomerGroupFormUI();

        if (!Page.IsPostBack)
        {
            if (Request.QueryString["CustomerGroupId"] != null)
            {
                customerGroupFormUI.Tbl_CustomerGroupId = Request.QueryString["CustomerGroupId"];

                BindBalanceTypeDropDown();
                BindMinimumPaymentDropDown();
                BindCreditLimitDropDown();
                BindWriteoffDropDown();
                BindStatementCycleDropDown();

                FillForm(customerGroupFormUI);

                btnSave.Visible   = false;
                btnClear.Visible  = false;
                btnUpdate.Visible = true;
                btnDelete.Visible = true;
                lblHeading.Text   = "Update CustomerGroup";
            }
            else
            {
                BindBalanceTypeDropDown();
                BindMinimumPaymentDropDown();
                BindCreditLimitDropDown();
                BindWriteoffDropDown();
                BindStatementCycleDropDown();

                btnSave.Visible   = true;
                btnClear.Visible  = true;
                btnUpdate.Visible = false;
                btnDelete.Visible = false;
                lblHeading.Text   = "Add New CustomerGroup";
            }
        }
    }
    public int DeleteCustomerGroup(CustomerGroupFormUI customerGroupFormUI)
    {
        int result = 0;

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

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

                sqlCmd.Parameters.Add("@tbl_CustomerGroupId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_CustomerGroupId"].Value = customerGroupFormUI.Tbl_CustomerGroupId;

                result = sqlCmd.ExecuteNonQuery();

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

            log.Error("[CustomerGroupFormDAL : DeleteCustomerGroup] An error occured in the processing of Record Id : " + customerGroupFormUI.Tbl_CustomerGroupId + ". Details : [" + exp.ToString() + "]");
        }

        return(result);
    }
    public int AddCustomerGroup(CustomerGroupFormUI customerGroupFormUI)
    {
        int result = 0;

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

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

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

                sqlCmd.Parameters.Add("@tbl_CustomerGroupId_Self", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_CustomerGroupId_Self"].Value = customerGroupFormUI.Tbl_CustomerGroupId_Self;

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

                sqlCmd.Parameters.Add("@IsDefault", SqlDbType.Bit);
                sqlCmd.Parameters["@IsDefault"].Value = customerGroupFormUI.IsDefault;

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

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

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

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

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

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

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

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

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

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

                sqlCmd.Parameters.Add("@CalendarYear", SqlDbType.Bit);
                sqlCmd.Parameters["@CalendarYear"].Value = customerGroupFormUI.CalendarYear;

                sqlCmd.Parameters.Add("@FiscalYear", SqlDbType.Bit);
                sqlCmd.Parameters["@FiscalYear"].Value = customerGroupFormUI.FiscalYear;

                sqlCmd.Parameters.Add("@Transaction", SqlDbType.Bit);
                sqlCmd.Parameters["@Transaction"].Value = customerGroupFormUI.Transaction;

                sqlCmd.Parameters.Add("@Distribution", SqlDbType.Bit);
                sqlCmd.Parameters["@Distribution"].Value = customerGroupFormUI.Distribution;

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

                result = sqlCmd.ExecuteNonQuery();

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

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

        return(result);
    }