protected void Page_Load(object sender, EventArgs e)
    {
        GoodsReceivedNoteDistributionFormUI goodsReceivedNoteDistributionFormUI = new GoodsReceivedNoteDistributionFormUI();

        if (!Page.IsPostBack)
        {
            if (Request.QueryString["GoodsReceivedNoteDistributionId"] != null)
            {
                goodsReceivedNoteDistributionFormUI.Tbl_GoodsReceivedNoteDistributionId = Request.QueryString["GoodsReceivedNoteDistributionId"];
                BindGLAccountTypeDropDown();
                FillForm(goodsReceivedNoteDistributionFormUI);

                btnSave.Visible   = false;
                btnClear.Visible  = false;
                btnUpdate.Visible = true;
                btnDelete.Visible = true;
                lblHeading.Text   = "Update Goods Received Note Distribution";
            }
            else
            {
                BindGLAccountTypeDropDown();
                btnSave.Visible   = true;
                btnClear.Visible  = true;
                btnUpdate.Visible = false;
                btnDelete.Visible = false;
                lblHeading.Text   = "Add New Goods Received Note Distribution";
            }
        }
    }
Esempio n. 2
0
    public int DeleteGoodsReceivedNoteDistribution(GoodsReceivedNoteDistributionFormUI goodsReceivedNoteDistributionFormUI)
    {
        int resutl = 0;

        resutl = goodsReceivedNoteDistributionFormDAL.DeleteGoodsReceivedNoteDistribution(goodsReceivedNoteDistributionFormUI);
        return(resutl);
    }
Esempio n. 3
0
    public DataTable GetGoodsReceivedNoteDistributionListById(GoodsReceivedNoteDistributionFormUI goodsReceivedNoteDistributionFormUI)
    {
        DataTable dtb = new DataTable();

        dtb = goodsReceivedNoteDistributionFormDAL.GetGoodsReceivedNoteDistributionListById(goodsReceivedNoteDistributionFormUI);
        return(dtb);
    }
    public int AddGoodsReceivedNoteDistribution(GoodsReceivedNoteDistributionFormUI goodsReceivedNoteDistributionFormUI)
    {
        int result = 0;

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

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

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

                sqlCmd.Parameters.Add("@tbl_GoodsReceivedNoteId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GoodsReceivedNoteId"].Value = goodsReceivedNoteDistributionFormUI.Tbl_GoodsReceivedNoteId;

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

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

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

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

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

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

                result = sqlCmd.ExecuteNonQuery();

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

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

        return(result);
    }
    public DataTable GetGoodsReceivedNoteDistributionListById(GoodsReceivedNoteDistributionFormUI goodsReceivedNoteDistributionFormUI)
    {
        DataSet   ds   = new DataSet();
        DataTable dtbl = new DataTable();

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

                sqlCmd.Parameters.Add("@tbl_GoodsReceivedNoteDistributionId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GoodsReceivedNoteDistributionId"].Value = goodsReceivedNoteDistributionFormUI.Tbl_GoodsReceivedNoteDistributionId;

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

            log.Error("[GoodsReceivedNoteDistributionFormDAL : getGoodsReceivedNoteDistributionListById] An error occured in the processing of Record Id : " + goodsReceivedNoteDistributionFormUI.Tbl_GoodsReceivedNoteDistributionId + ". Details : [" + exp.ToString() + "]");
        }
        finally
        {
            ds.Dispose();
        }

        return(dtbl);
    }
    private void FillForm(GoodsReceivedNoteDistributionFormUI goodsReceivedNoteDistributionFormUI)
    {
        try
        {
            DataTable dtb = goodsReceivedNoteDistributionFormBAL.GetGoodsReceivedNoteDistributionListById(goodsReceivedNoteDistributionFormUI);

            if (dtb.Rows.Count > 0)
            {
                txtGLAccountGuid.Text              = dtb.Rows[0]["tbl_GLAccountId"].ToString();
                txtGLAccount.Text                  = dtb.Rows[0]["tbl_GLAccount"].ToString();
                txtGoodsReceivedNoteGuid.Text      = dtb.Rows[0]["tbl_GoodsReceivedNoteId"].ToString();
                txtGoodsReceivedNote.Text          = dtb.Rows[0]["tbl_GoodsReceivedNote"].ToString();
                txtDescription.Text                = dtb.Rows[0]["Description"].ToString();
                ddlopt_GLAccountType.SelectedValue = dtb.Rows[0]["opt_GLAccountType"].ToString();
                txtDistributionReference.Text      = dtb.Rows[0]["DistributionReference"].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     = "Procurement_Receive_Goods_or_Services_Receive_Goods_or_Services_GoodsReceivedNoteDistributionForm.CS";
            logExcpUIobj.RecordId         = this.goodsReceivedNoteDistributionFormUI.Tbl_GoodsReceivedNoteDistributionId;
            logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
            logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

            log.Error("[Procurement_Receive_Goods_or_Services_Receive_Goods_or_Services_GoodsReceivedNoteDistributionForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]");
        }
    }
    public int DeleteGoodsReceivedNoteDistribution(GoodsReceivedNoteDistributionFormUI goodsReceivedNoteDistributionFormUI)
    {
        int result = 0;

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

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

                sqlCmd.Parameters.Add("@tbl_GoodsReceivedNoteDistributionId", SqlDbType.NVarChar);
                sqlCmd.Parameters["@tbl_GoodsReceivedNoteDistributionId"].Value = goodsReceivedNoteDistributionFormUI.Tbl_GoodsReceivedNoteDistributionId;

                result = sqlCmd.ExecuteNonQuery();

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

            log.Error("[GoodsReceivedNoteDistributionFormDAL : DeleteGoodsReceivedNoteDistribution] An error occured in the processing of Record Id : " + goodsReceivedNoteDistributionFormUI.Tbl_GoodsReceivedNoteDistributionId + ". Details : [" + exp.ToString() + "]");
        }

        return(result);
    }