protected override void Page_Load(object sender, EventArgs e)
    {
        GLAccountCategoryFormUI gLAccountCategoryFormUI = new GLAccountCategoryFormUI();

        if (!Page.IsPostBack)
        {
            if (Request.QueryString["GLAccountCategoryId"] != null)
            {
                gLAccountCategoryFormUI.Tbl_GLAccountCategoryId = Request.QueryString["GLAccountCategoryId"];


                FillForm(gLAccountCategoryFormUI);

                btnSave.Visible   = false;
                btnClear.Visible  = false;
                btnUpdate.Visible = true;
                btnDelete.Visible = true;
                lblHeading.Text   = "Update GLAccountCategory";
            }
            else
            {
                btnSave.Visible   = true;
                btnClear.Visible  = true;
                btnUpdate.Visible = false;
                btnDelete.Visible = false;
                lblHeading.Text   = "Add New GLAccountCategory";
            }
        }
    }
    private void FillForm(GLAccountCategoryFormUI gLAccountCategoryFormUI)
    {
        try
        {
            DataTable dtb = gLAccountCategoryFormBAL.GetGLAccountCategoryListById(gLAccountCategoryFormUI);

            if (dtb.Rows.Count > 0)
            {
                txtCategoryNumber.Text = dtb.Rows[0]["CategoryNumber"].ToString();
                txtDescription.Text    = dtb.Rows[0]["Description"].ToString();
            }
            else
            {
                lblError.Text    = Resources.GlobalResource.msgCouldNotLoadData;
                divError.Visible = true;
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "FillForm()";
            logExcpUIobj.ResourceName     = "System_Settings_GLAccountCategoryForm.CS";
            logExcpUIobj.RecordId         = gLAccountCategoryFormUI.Tbl_GLAccountCategoryId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[System_Settings_GLAccountCategoryForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]");
        }
    }
예제 #3
0
    public int DeleteGLAccountCategory(GLAccountCategoryFormUI gLAccountCategoryFormUI)
    {
        int resutl = 0;

        resutl = gLAccountCategoryFormDAL.DeleteGLAccountCategory(gLAccountCategoryFormUI);
        return(resutl);
    }
예제 #4
0
    public DataTable GetGLAccountCategoryListById(GLAccountCategoryFormUI gLAccountCategoryFormUI)
    {
        DataTable dtb = new DataTable();

        dtb = gLAccountCategoryFormDAL.GetGLAccountCategoryListById(gLAccountCategoryFormUI);
        return(dtb);
    }
    public int UpdateGLAccountCategory(GLAccountCategoryFormUI gLAccountCategoryFormUI)
    {
        int result = 0;

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

                sqlCmd.Parameters.Add("@tbl_GLAccountCategoryId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GLAccountCategoryId"].Value = gLAccountCategoryFormUI.Tbl_GLAccountCategoryId;

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

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

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

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

                result = sqlCmd.ExecuteNonQuery();

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

            log.Error("[GLAccountCategoryFormDAL : UpdateGLAccountCategory] An error occured in the processing of Record Id : " + gLAccountCategoryFormUI.Tbl_GLAccountCategoryId + ". Details : [" + exp.ToString() + "]");
        }

        return(result);
    }
    public DataTable GetGLAccountCategoryListById(GLAccountCategoryFormUI gLAccountCategoryFormUI)
    {
        DataSet   ds   = new DataSet();
        DataTable dtbl = new DataTable();

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

                sqlCmd.Parameters.Add("@tbl_GLAccountCategoryId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GLAccountCategoryId"].Value = gLAccountCategoryFormUI.Tbl_GLAccountCategoryId;

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

            log.Error("[GLAccountCategoryFormDAL : getGLAccountCategoryListById] An error occured in the processing of Record Id : " + gLAccountCategoryFormUI.Tbl_GLAccountCategoryId + ". Details : [" + exp.ToString() + "]");
        }
        finally
        {
            ds.Dispose();
        }

        return(dtbl);
    }