Example #1
0
    public int DeleteBudgetDetails(BudgetDetailsFormUI budgetDetailsFormUI)
    {
        int resutl = 0;

        resutl = budgetDetailsFormDAL.DeleteBudgetDetails(budgetDetailsFormUI);
        return(resutl);
    }
Example #2
0
    public DataTable GetBudgetDetailsListById(BudgetDetailsFormUI budgetDetailsFormUI)
    {
        DataTable dtb = new DataTable();

        dtb = budgetDetailsFormDAL.GetBudgetDetailsListById(budgetDetailsFormUI);
        return(dtb);
    }
    protected override void Page_Load(object sender, EventArgs e)
    {
        BudgetDetailsFormUI budgetDetailsFormUI = new BudgetDetailsFormUI();

        if (!Page.IsPostBack)
        {
            if (Request.QueryString["BudgetDetailsId"] != null)
            {
                budgetDetailsFormUI.Tbl_BudgetDetailsId = Request.QueryString["BudgetDetailsId"];


                FillForm(budgetDetailsFormUI);

                btnSave.Visible   = false;
                btnClear.Visible  = false;
                btnUpdate.Visible = true;
                btnDelete.Visible = true;
                lblHeading.Text   = "Update BudgetDetails";
            }
            else
            {
                btnSave.Visible   = true;
                btnClear.Visible  = true;
                btnUpdate.Visible = false;
                btnDelete.Visible = false;
                lblHeading.Text   = "Add New BudgetDetails";
            }
        }
    }
    private void FillForm(BudgetDetailsFormUI budgetDetailsFormUI)
    {
        try
        {
            DataTable dtb = budgetDetailsFormBAL.GetBudgetDetailsListById(budgetDetailsFormUI);

            if (dtb.Rows.Count > 0)
            {
                txtBudgetGuid.Text       = dtb.Rows[0]["tbl_BudgetId"].ToString();
                txtBudget.Text           = dtb.Rows[0]["tbl_Budget"].ToString();
                txtFiscalPeriodGuid.Text = dtb.Rows[0]["tbl_FiscalPeriodId"].ToString();
                txtFiscalPeriod.Text     = dtb.Rows[0]["tbl_FiscalPeriod"].ToString();
                txtPeriodDate.Text       = dtb.Rows[0]["PeriodDate"].ToString();
                txtPeriod.Text           = dtb.Rows[0]["Period"].ToString();
                txtPeriodName.Text       = dtb.Rows[0]["PeriodName"].ToString();
                txtAmount.Text           = dtb.Rows[0]["Amount"].ToString();
            }
            else
            {
                lblError.Text    = Resources.GlobalResource.msgCouldNotLoadData;
                divError.Visible = true;
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "FillForm()";
            logExcpUIobj.ResourceName     = "System_Settings_BudgetDetailsForm.CS";
            logExcpUIobj.RecordId         = this.budgetDetailsFormUI.Tbl_BudgetDetailsId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[System_Settings_BudgetDetailsForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]");
        }
    }
    public int UpdateBudgetDetails(BudgetDetailsFormUI budgetDetailsFormUI)
    {
        int result = 0;

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

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

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

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

                sqlCmd.Parameters.Add("@tbl_FiscalPeriodId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_FiscalPeriodId"].Value = budgetDetailsFormUI.Tbl_FiscalPeriodId;

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

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

                sqlCmd.Parameters.Add("@PeriodDate", SqlDbType.DateTime);
                sqlCmd.Parameters["@PeriodDate"].Value = budgetDetailsFormUI.PeriodDate;

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

                result = sqlCmd.ExecuteNonQuery();

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

            log.Error("[BudgetDetailsFormDAL : UpdateBudgetDetails] An error occured in the processing of Record Id : " + budgetDetailsFormUI.Tbl_BudgetDetailsId + ". Details : [" + exp.ToString() + "]");
        }

        return(result);
    }
    public DataTable GetBudgetDetailsListById(BudgetDetailsFormUI budgetDetailsFormUI)
    {
        DataSet   ds   = new DataSet();
        DataTable dtbl = new DataTable();

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

                sqlCmd.Parameters.Add("@tbl_BudgetDetailsId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_BudgetDetailsId"].Value = budgetDetailsFormUI.Tbl_BudgetDetailsId;

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

            log.Error("[BudgetDetailsFormDAL : getBudgetDetailsListById] An error occured in the processing of Record Id : " + budgetDetailsFormUI.Tbl_BudgetDetailsId + ". Details : [" + exp.ToString() + "]");
        }
        finally
        {
            ds.Dispose();
        }

        return(dtbl);
    }