Exemplo n.º 1
0
    public void Page_Load(object sender, EventArgs e)
    {
        AssetAndGroupAccountFormUI assetAndGroupAccountFormUI = new AssetAndGroupAccountFormUI();


        if (!Page.IsPostBack)
        {
            if (Request.QueryString["AssetAndGroupAccountId"] != null)
            {
                assetAndGroupAccountFormUI.Tbl_AssetAndGroupAccountId = Request.QueryString["AssetAndGroupAccountId"];

                Bind_opt_TypeDropDownList();
                FillForm(assetAndGroupAccountFormUI);

                btnSave.Visible   = false;
                btnClear.Visible  = false;
                btnUpdate.Visible = true;
                btnDelete.Visible = true;
                lblHeading.Text   = "Update Asset And GroupAccount";
            }
            else
            {
                Bind_opt_TypeDropDownList();

                btnSave.Visible   = true;
                btnClear.Visible  = true;
                btnUpdate.Visible = false;
                btnDelete.Visible = false;
                lblHeading.Text   = "Add New Asset And GroupAccount";
            }
        }
    }
Exemplo n.º 2
0
    public int DeleteAssetAndGroupAccount(AssetAndGroupAccountFormUI assetAndGroupAccountFormUI)
    {
        int resutl = 0;

        resutl = assetAndGroupAccountFormDAL.DeleteAssetAndGroupAccount(assetAndGroupAccountFormUI);
        return(resutl);
    }
Exemplo n.º 3
0
    public DataTable GetAssetAndGroupAccountListById(AssetAndGroupAccountFormUI assetAndGroupAccountFormUI)
    {
        DataTable dtb = new DataTable();

        dtb = assetAndGroupAccountFormDAL.GetAssetAndGroupAccountListById(assetAndGroupAccountFormUI);
        return(dtb);
    }
    public DataTable GetAssetAndGroupAccountListById(AssetAndGroupAccountFormUI assetAndGroupAccountFormUI)
    {
        DataSet   ds   = new DataSet();
        DataTable dtbl = new DataTable();

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

                sqlCmd.Parameters.Add("@tbl_AssetAndGroupAccountId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_AssetAndGroupAccountId"].Value = assetAndGroupAccountFormUI.Tbl_AssetAndGroupAccountId;

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

            log.Error("[AssetAndGroupAccountFormDAL : GetAssetAndGroupAccountListById] An error occured in the processing of Record Id : " + assetAndGroupAccountFormUI.Tbl_AssetAndGroupAccountId + ". Details : [" + exp.ToString() + "]");
        }
        finally
        {
            ds.Dispose();
        }

        return(dtbl);
    }
Exemplo n.º 5
0
    private void FillForm(AssetAndGroupAccountFormUI assetAndGroupAccountFormUI)
    {
        try
        {
            DataTable dtb = assetAndGroupAccountFormBAL.GetAssetAndGroupAccountListById(assetAndGroupAccountFormUI);

            if (dtb.Rows.Count > 0)
            {
                ddlOpt_AccountType.SelectedValue = dtb.Rows[0]["AccountType"].ToString();
                txtAccountCode.Text                 = dtb.Rows[0]["AccountCode"].ToString();
                txtDescription.Text                 = dtb.Rows[0]["Description"].ToString();
                txtDepreciationExpenseGuid.Text     = dtb.Rows[0]["tbl_GLAccount_DepreciationExpense"].ToString();
                txtDepreciationExpense.Text         = dtb.Rows[0]["DepreciationExpense"].ToString();
                txtAccumulatedDepreciationGuid.Text = dtb.Rows[0]["tbl_GLAccount_AccumulatedDepreciation"].ToString();
                txtAccumulatedDepreciation.Text     = dtb.Rows[0]["AccumulatedDepreciation"].ToString();
                txtPriorYearDepreciationGuid.Text   = dtb.Rows[0]["tbl_GLAccount_PriorYearDepreciation"].ToString();
                txtPriorYearDepreciation.Text       = dtb.Rows[0]["PriorYearDepreciation"].ToString();
                txtAssetCost.Text     = dtb.Rows[0]["AssetCost"].ToString();
                txtAssetCostGuid.Text = dtb.Rows[0]["tbl_GLAccount_AssetCost"].ToString();
                txtClearing.Text      = dtb.Rows[0]["Clearing"].ToString();
                txtClearingGuid.Text  = dtb.Rows[0]["tbl_GLAccount_Clearing"].ToString();
            }
            else
            {
                lblError.Text    = Resources.GlobalResource.msgCouldNotLoadData;
                divError.Visible = true;
            }
        }
        catch (Exception exp)
        {
            logExcpUIobj.MethodName       = "FillForm()";
            logExcpUIobj.ResourceName     = "Assets_AssetAndGroupAccount_AssetAndGroupAccountForm.CS";
            logExcpUIobj.RecordId         = assetAndGroupAccountFormUI.Tbl_AssetAndGroupAccountId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[Assets_AssetAndGroupAccount_AssetAndGroupAccountForm : FillForm] An error occured in the processing of Record Id : " + assetAndGroupAccountFormUI.Tbl_AssetAndGroupAccountId + ". Details : [" + exp.ToString() + "]");
        }
    }
    public int DeleteAssetAndGroupAccount(AssetAndGroupAccountFormUI assetAndGroupAccountFormUI)
    {
        int result = 0;

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

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

                sqlCmd.Parameters.Add("@tbl_AssetAndGroupAccountId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_AssetAndGroupAccountId"].Value = assetAndGroupAccountFormUI.Tbl_AssetAndGroupAccountId;

                result = sqlCmd.ExecuteNonQuery();

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

            log.Error("[AssetAndGroupAccountFormDAL : DeleteAssetAndGroupAccount] An error occured in the processing of Record Id : " + assetAndGroupAccountFormUI.Tbl_AssetAndGroupAccountId + ". Details : [" + exp.ToString() + "]");
        }

        return(result);
    }
    public int AddAssetAndGroupAccount(AssetAndGroupAccountFormUI assetAndGroupAccountFormUI)
    {
        int result = 0;

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

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

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


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

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

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

                sqlCmd.Parameters.Add("@tbl_GLAccount_DepreciationExpense", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GLAccount_DepreciationExpense"].Value = assetAndGroupAccountFormUI.Tbl_GLAccount_DepreciationExpense;

                sqlCmd.Parameters.Add("@tbl_GLAccount_AccumulatedDepreciation", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GLAccount_AccumulatedDepreciation"].Value = assetAndGroupAccountFormUI.Tbl_GLAccount_AccumulatedDepreciation;

                sqlCmd.Parameters.Add("@tbl_GLAccount_PriorYearDepreciation", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GLAccount_PriorYearDepreciation"].Value = assetAndGroupAccountFormUI.Tbl_GLAccount_PriorYearDepreciation;

                sqlCmd.Parameters.Add("@tbl_GLAccount_AssetCost", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GLAccount_AssetCost"].Value = assetAndGroupAccountFormUI.Tbl_GLAccount_AssetCost;

                sqlCmd.Parameters.Add("@tbl_GLAccount_Clearing", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GLAccount_Clearing"].Value = assetAndGroupAccountFormUI.Tbl_GLAccount_Clearing;

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

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

        return(result);
    }