public int UpdateBudget(BudgetFormUI budgetFormUI)
    {
        int resutl = 0;

        resutl = budgetFormDAL.UpdateBudget(budgetFormUI);
        return(resutl);
    }
    public int DeleteBudget(BudgetFormUI budgetFormUI)
    {
        int resutl = 0;

        resutl = budgetFormDAL.DeleteBudget(budgetFormUI);
        return(resutl);
    }
    public DataTable GetBudgetListById(BudgetFormUI budgetFormUI)
    {
        DataTable dtb = new DataTable();

        dtb = budgetFormDAL.GetBudgetListById(budgetFormUI);
        return(dtb);
    }
    public int AddBudget(BudgetFormUI budgetFormUI)
    {
        int resutl = 0;

        resutl = budgetFormDAL.AddBudget(budgetFormUI);
        return(resutl);
    }
    protected override void Page_Load(object sender, EventArgs e)
    {
        BudgetFormUI budgetFormUI = new BudgetFormUI();

        if (!Page.IsPostBack)
        {
            if (Request.QueryString["BudgetId"] != null)
            {
                budgetFormUI.Tbl_BudgetId = Request.QueryString["BudgetId"];
                BindOptionSetLisDropDown();
                BindOptionBudgetYearDropDown();
                FillForm(budgetFormUI);

                btnSave.Visible   = false;
                btnClear.Visible  = false;
                btnUpdate.Visible = true;
                btnDelete.Visible = true;
                lblHeading.Text   = "Update Budget";
            }
            else
            {
                BindOptionBudgetYearDropDown();
                BindOptionSetLisDropDown();
                btnSave.Visible   = true;
                btnClear.Visible  = true;
                btnUpdate.Visible = false;
                btnDelete.Visible = false;
                lblHeading.Text   = "Add New Budget";
            }
        }
    }
Exemple #6
0
    public int AddBudget(BudgetFormUI budgetFormUI)
    {
        int result = 0;

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

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

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

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

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

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

                sqlCmd.Parameters.Add("@Opt_BudgetYear", SqlDbType.Int);
                sqlCmd.Parameters["@Opt_BudgetYear"].Value = budgetFormUI.Opt_BudgetYear;

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

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

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

                result = sqlCmd.ExecuteNonQuery();

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

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

        return(result);
    }
    private void FillForm(BudgetFormUI budgetFormUI)
    {
        try
        {
            DataTable dtb = budgetFormBAL.GetBudgetListById(budgetFormUI);

            if (dtb.Rows.Count > 0)
            {
                txtGLAccountGuid.Text       = dtb.Rows[0]["tbl_GLAccountId"].ToString();
                txtGLAccount.Text           = dtb.Rows[0]["tbl_GLAccount"].ToString();
                txtBudgetNumber.Text        = dtb.Rows[0]["BudgetNumber"].ToString();
                txtDescription.Text         = dtb.Rows[0]["Description"].ToString();
                ddlBasedOn.SelectedValue    = dtb.Rows[0]["OptionSetLable"].ToString();
                ddlBudgetYear.SelectedValue = dtb.Rows[0]["OptionSetLable"].ToString();
                if (Convert.ToBoolean(dtb.Rows[0]["AnnualCapital"]) == true)
                {
                    chkAnnual.Checked = true;
                }
                else
                {
                    chkAnnual.Checked = false;
                }
                if (Convert.ToBoolean(dtb.Rows[0]["AnnualCapital"]) == true)
                {
                    if (Convert.ToBoolean(dtb.Rows[0]["Display"]) == true)
                    {
                        ChkDisplay.Checked = true;
                    }
                    else
                    {
                        ChkDisplay.Checked = false;
                    }
                }
            }

            else
            {
                lblError.Text    = Resources.GlobalResource.msgCouldNotLoadData;
                divError.Visible = true;
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "FillForm()";
            logExcpUIobj.ResourceName     = "System_Settings_BudgetForm.CS";
            logExcpUIobj.RecordId         = this.budgetFormUI.Tbl_BudgetId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[System_Settings_BudgetForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]");
        }
    }
Exemple #8
0
    public DataTable GetBudgetListById(BudgetFormUI budgetFormUI)
    {
        DataSet   ds   = new DataSet();
        DataTable dtbl = new DataTable();

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

                sqlCmd.Parameters.Add("@tbl_BudgetId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_BudgetId"].Value = budgetFormUI.Tbl_BudgetId;

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

            log.Error("[BudgetFormDAL : getBudgetListById] An error occured in the processing of Record Id : " + budgetFormUI.Tbl_BudgetId + ". Details : [" + exp.ToString() + "]");
        }
        finally
        {
            ds.Dispose();
        }

        return(dtbl);
    }
Exemple #9
0
    public int DeleteBudget(BudgetFormUI budgetFormUI)
    {
        int result = 0;

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

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

                sqlCmd.Parameters.Add("@tbl_BudgetId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_BudgetId"].Value = budgetFormUI.Tbl_BudgetId;

                result = sqlCmd.ExecuteNonQuery();

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

            log.Error("[BudgetFormDAL : DeleteBudget] An error occured in the processing of Record Id : " + budgetFormUI.Tbl_BudgetId + ". Details : [" + exp.ToString() + "]");
        }

        return(result);
    }