private void FillForm(GLAccountEntryDetailsFormUI gLAccountEntryDetailsFormUI)
    {
        try
        {
            DataTable dtb = gLAccountEntryDetailsFormBAL.GetGLAccountEntryDetailsListById(gLAccountEntryDetailsFormUI);

            if (dtb.Rows.Count > 0)
            {
                txtGLAccountEntry.Text     = dtb.Rows[0]["tbl_GLAccountEntry"].ToString();
                txtGLAccountEntryGuid.Text = dtb.Rows[0]["tbl_GLAccountEntryId"].ToString();
                txtGLAccount.Text          = dtb.Rows[0]["AccountNumber"].ToString();
                txtGLAccountGuid.Text      = dtb.Rows[0]["tbl_GLAccount"].ToString();
                txtDebit.Text  = dtb.Rows[0]["Debit"].ToString();
                txtCredit.Text = dtb.Rows[0]["Credit"].ToString();
            }
            else
            {
                lblError.Text    = Resources.GlobalResource.msgCouldNotLoadData;
                divError.Visible = true;
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "FillForm()";
            logExcpUIobj.ResourceName     = "System_Settings_GLAccountEntryForm.CS";
            logExcpUIobj.RecordId         = gLAccountEntryDetailsFormUI.Tbl_GLAccountEntryDetailsId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[System_Settings_GLAccountEntryDetailsForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        GLAccountEntryDetailsFormUI gLAccountEntryDetailsFormUI = new GLAccountEntryDetailsFormUI();

        if (!Page.IsPostBack)
        {
            if (Request.QueryString["GLAccountEntryDetailsId"] != null)
            {
                gLAccountEntryDetailsFormUI.Tbl_GLAccountEntryDetailsId = Request.QueryString["GLAccountEntryDetailsId"];
                FillForm(gLAccountEntryDetailsFormUI);
                btnSave.Visible   = false;
                btnClear.Visible  = false;
                btnUpdate.Visible = true;
                btnDelete.Visible = true;
                lblHeading.Text   = "Update GLAccount Entry Details";
            }

            else
            {
                btnSave.Visible   = true;
                btnClear.Visible  = true;
                btnUpdate.Visible = false;
                btnDelete.Visible = false;
                lblHeading.Text   = "Add New GLAccount Entry Details";
            }
        }
    }
    public int UpdateGLAccountEntryDetails(GLAccountEntryDetailsFormUI gLAccountEntryDetailsFormUI)
    {
        int result = 0;

        try
        {
            using (SqlConnection SupportCon = new SqlConnection(connectionString))
            {
                SupportCon.Open();
                SqlCommand sqlCmd = new SqlCommand("SP_GLAccountEntryDetails_Update", SupportCon);
                sqlCmd.CommandType    = CommandType.StoredProcedure;
                sqlCmd.CommandTimeout = commandTimeout;
                sqlCmd.Parameters.Add("@ModifiedBy", SqlDbType.NVarChar);
                sqlCmd.Parameters["@ModifiedBy"].Value = gLAccountEntryDetailsFormUI.ModifiedBy;

                sqlCmd.Parameters.Add("@tbl_GLAccountEntryDetailsId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GLAccountEntryDetailsId"].Value = gLAccountEntryDetailsFormUI.Tbl_GLAccountEntryDetailsId;

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

                sqlCmd.Parameters.Add("@tbl_GLAccountEntryId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GLAccountEntryId"].Value = gLAccountEntryDetailsFormUI.Tbl_GLAccountEntryId;

                sqlCmd.Parameters.Add("@tbl_GLAccountId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GLAccountId"].Value = gLAccountEntryDetailsFormUI.Tbl_GLAccountId;

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

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

                result = sqlCmd.ExecuteNonQuery();

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

            log.Error("[GLAccountEntryDetailsFormDAL : UpdateGLAccountEntryDetails] An error occured in the processing of Record Id : " + gLAccountEntryDetailsFormUI.Tbl_GLAccountEntryDetailsId + ". Details : [" + exp.ToString() + "]");
        }

        return(result);
    }
    public DataTable GetGLAccountEntryDetailsListById(GLAccountEntryDetailsFormUI gLAccountEntryDetailsFormUI)
    {
        DataSet   ds   = new DataSet();
        DataTable dtbl = new DataTable();

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

                sqlCmd.Parameters.Add("@tbl_GLAccountEntryDetailsId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GLAccountEntryDetailsId"].Value = gLAccountEntryDetailsFormUI.Tbl_GLAccountEntryDetailsId;

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

            log.Error("[GLAccountEntryDetailsFormDAL : GetGLAccountEntryDetailsListById] An error occured in the processing of Record Id : " + gLAccountEntryDetailsFormUI.Tbl_GLAccountEntryId + ". Details : [" + exp.ToString() + "]");
        }
        finally
        {
            ds.Dispose();
        }

        return(dtbl);
    }