Example #1
0
    public int UpdatePettyCash(PettyCashFormUI pettyCashFormUI)
    {
        int resutl = 0;

        resutl = pettyCashFormDAL.UpdatePettyCash(pettyCashFormUI);
        return(resutl);
    }
Example #2
0
    public int DeletePettyCash(PettyCashFormUI pettyCashFormUI)
    {
        int resutl = 0;

        resutl = pettyCashFormDAL.DeletePettyCash(pettyCashFormUI);
        return(resutl);
    }
Example #3
0
    public DataTable GetPettyCashListById(PettyCashFormUI pettyCashFormUI)
    {
        DataTable dtb = new DataTable();

        dtb = pettyCashFormDAL.GetPettyCashListById(pettyCashFormUI);
        return(dtb);
    }
Example #4
0
    public int AddPettyCash(PettyCashFormUI pettyCashFormUI)
    {
        int resutl = 0;

        resutl = pettyCashFormDAL.AddPettyCash(pettyCashFormUI);
        return(resutl);
    }
Example #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PettyCashFormUI pettyCashFormUI = new PettyCashFormUI();

        if (!Page.IsPostBack)
        {
            if (Request.QueryString["PettyCashId"] != null)
            {
                pettyCashFormUI.Tbl_PettyCashId = Request.QueryString["PettyCashId"];


                FillForm(pettyCashFormUI);

                btnSave.Visible   = false;
                btnClear.Visible  = false;
                btnUpdate.Visible = true;
                btnDelete.Visible = true;
                lblHeading.Text   = "Update Petty Cash";
            }
            else
            {
                btnSave.Visible   = true;
                btnClear.Visible  = true;
                btnUpdate.Visible = false;
                btnDelete.Visible = false;
                lblHeading.Text   = "Add New Petty Cash";
            }
        }
    }
    public DataTable GetPettyCashListById(PettyCashFormUI pettyCashFormUI)
    {
        DataSet   ds   = new DataSet();
        DataTable dtbl = new DataTable();

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

                sqlCmd.Parameters.Add("@tbl_PettyCashId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_PettyCashId"].Value = pettyCashFormUI.Tbl_PettyCashId;

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

            log.Error("[PettyCashFormDAL : getPettyCashListById] An error occured in the processing of Record Id : " + pettyCashFormUI.Tbl_PettyCashId + ". Details : [" + exp.ToString() + "]");
        }
        finally
        {
            ds.Dispose();
        }

        return(dtbl);
    }
Example #7
0
    private void FillForm(PettyCashFormUI pettyCashFormUI)
    {
        try
        {
            DataTable dtb = pettyCashFormBAL.GetPettyCashListById(pettyCashFormUI);

            if (dtb.Rows.Count > 0)
            {
                txtPettyCashId.Text          = dtb.Rows[0]["PettyCashId"].ToString();
                txtDescription.Text          = dtb.Rows[0]["Description"].ToString();
                chckIsInactive.Checked       = Convert.ToBoolean(dtb.Rows[0]["IsInactive"].ToString());
                txtIBAN.Text                 = dtb.Rows[0]["IBAN"].ToString();
                txtCurrencyGuid.Text         = dtb.Rows[0]["tbl_CurrencyId"].ToString();
                txtCurrency.Text             = dtb.Rows[0]["CurrencyName"].ToString();
                txtCurrentPettyCashBal.Text  = dtb.Rows[0]["CurrentPettyCashBalance"].ToString();
                txtCashAccountBal.Text       = dtb.Rows[0]["CashAccountBalance"].ToString();
                txtGLAccountGuid.Text        = dtb.Rows[0]["tbl_GLAccount_CashAccount"].ToString();
                txtGLAccount.Text            = dtb.Rows[0]["CashAccount"].ToString();
                txtNextPettyCashNumber.Text  = dtb.Rows[0]["NextPettyCashNumber"].ToString();
                txtNextDepositNumber.Text    = dtb.Rows[0]["NextDepositNumber"].ToString();
                txtAccountNumber.Text        = dtb.Rows[0]["AccountNumber"].ToString();
                txtDuplicateChequeuNo.Text   = dtb.Rows[0]["DuplicateChequeNumber"].ToString();
                txtOverrideChequeNumber.Text = dtb.Rows[0]["OverrideChequeNumber"].ToString();
            }
            else
            {
                lblError.Text    = Resources.GlobalResource.msgCouldNotLoadData;
                divError.Visible = true;
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "FillForm()";
            logExcpUIobj.ResourceName     = "Finance_Bank_Accounting_Petty_Cash_PettyCashForm.CS";
            logExcpUIobj.RecordId         = pettyCashFormUI.Tbl_PettyCashId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[Finance_Bank_Accounting_Petty_Cash_PettyCashForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]");
        }
    }
    public int DeletePettyCash(PettyCashFormUI pettyCashFormUI)
    {
        int result = 0;

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

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

                sqlCmd.Parameters.Add("@tbl_PettyCashId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_PettyCashId"].Value = pettyCashFormUI.Tbl_PettyCashId;

                result = sqlCmd.ExecuteNonQuery();

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

            log.Error("[PettyCashFormDAL : DeletePettyCash] An error occured in the processing of Record Id : " + pettyCashFormUI.Tbl_PettyCashId + ". Details : [" + exp.ToString() + "]");
        }

        return(result);
    }
    public int AddPettyCash(PettyCashFormUI pettyCashFormUI)
    {
        int result = 0;

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

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

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

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

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

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

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

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

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

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

                sqlCmd.Parameters.Add("@tbl_GLAccount_CashAccount", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GLAccount_CashAccount"].Value = pettyCashFormUI.Tbl_GLAccount_CashAccount;

                sqlCmd.Parameters.Add("@NextPettyCashNumber", SqlDbType.BigInt);
                sqlCmd.Parameters["@NextPettyCashNumber"].Value = pettyCashFormUI.NextPettyCashNumber;

                sqlCmd.Parameters.Add("@NextDepositNumber", SqlDbType.BigInt);
                sqlCmd.Parameters["@NextDepositNumber"].Value = pettyCashFormUI.NextDepositNumber;

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

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

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


                result = sqlCmd.ExecuteNonQuery();

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

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

        return(result);
    }