Exemplo n.º 1
0
        public void BindGrid()
        {
            try
            {
                GeneralLedgerBL   objGeneralLedgerBL = new GeneralLedgerBL();
                GeneralLedgerBO   objGeneralLedgerBO = new GeneralLedgerBO();
                ApplicationResult objResultSelectAll = new ApplicationResult();

                objResultSelectAll = objGeneralLedgerBL.GeneralLedger_SelectAll(Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));
                if (objResultSelectAll != null)
                {
                    DataTable dtSelectAll = new DataTable();
                    dtSelectAll = objResultSelectAll.resultDT;
                    if (dtSelectAll.Rows.Count > 0)
                    {
                        gvGeneralLedger.DataSource = dtSelectAll;
                        gvGeneralLedger.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
Exemplo n.º 2
0
        protected void gvGeneralLedger_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                GeneralLedgerBL   objGeneralLedgerBL = new GeneralLedgerBL();
                GeneralLedgerBO   objGeneralLedgerBO = new GeneralLedgerBO();
                ApplicationResult objResultSelect    = new ApplicationResult();
                ApplicationResult objResultDelete    = new ApplicationResult();
                ViewState["LedgerID"] = e.CommandArgument.ToString();

                if (e.CommandName.ToString() == "Edit1")
                {
                    objResultSelect = objGeneralLedgerBL.GeneralLedger_Select(Convert.ToInt32(ViewState["LedgerID"].ToString()), Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));
                    if (objResultSelect != null)
                    {
                        DataTable dtResult = objResultSelect.resultDT;
                        if (dtResult.Rows.Count > 0)
                        {
                            BindAccountGroup();
                            txtAccountName.Text           = dtResult.Rows[0][GeneralLedgerBO.GENERALLEDGER_ACCOUNTNAME].ToString();
                            ddlAccountGroup.SelectedValue = dtResult.Rows[0][GeneralLedgerBO.GENERALLEDGER_ACCOUNTGROUPID].ToString();
                            txtOpeningBalance.Text        = dtResult.Rows[0][GeneralLedgerBO.GENERALLEDGER_OPENINGBALANCE].ToString();
                            if (dtResult.Rows[0][GeneralLedgerBO.GENERALLEDGER_BALANCETYPE].ToString() != "")
                            {
                                ddlBalanceType.SelectedValue = dtResult.Rows[0][GeneralLedgerBO.GENERALLEDGER_BALANCETYPE].ToString();
                            }
                            txtDescription.Text = dtResult.Rows[0][GeneralLedgerBO.GENERALLEDGER_DESCRIPTION].ToString();
                            PanelVisibility(2);
                            ViewState["Mode"] = "Edit";
                        }
                    }
                }
                else if (e.CommandName.ToString() == "Delete1")
                {
                    objResultDelete = objGeneralLedgerBL.GeneralLedger_Delete(Convert.ToInt32(e.CommandArgument.ToString()), Convert.ToInt32(Session[ApplicationSession.USERID]), DateTime.UtcNow.AddHours(5.5).ToString(), "Ledger");
                    if (objResultDelete.status == ApplicationResult.CommonStatusType.SUCCESS)
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record deleted successfully.');</script>");
                        PanelVisibility(1);
                        BindGrid();
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('You cannot delete this record because it is in used.');</script>");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
Exemplo n.º 3
0
        public void BindAccountGroup()
        {
            GeneralLedgerBL   objGeneralLedgerBL = new GeneralLedgerBL();
            GeneralLedgerBO   objGeneralLedgerBO = new GeneralLedgerBO();
            ApplicationResult objResultSelectAll = new ApplicationResult();
            DropDownList      ddlAccountName     = new DropDownList();

            objResultSelectAll = objGeneralLedgerBL.GeneralLedger_SelectAll_JournalEntry(Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));
            if (objResultSelectAll != null)
            {
                DataTable dtSelectAll = new DataTable();
                dtSelectAll = objResultSelectAll.resultDT;

                for (int i = 0; i < gvPaymentsEntry.Rows.Count; i++)
                {
                    ddlAccountName = (DropDownList)gvPaymentsEntry.Rows[i].Cells[0].FindControl("ddlAccountName");
                    if (ddlAccountName != null)
                    {
                        objControl.BindDropDown_ListBox(dtSelectAll, ddlAccountName, "AccountName", "LedgerID");
                        ddlAccountName.Items.Insert(0, new ListItem("", "-1"));
                    }
                }
            }
        }
Exemplo n.º 4
0
        protected void ddlReceiptMode_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                divlblBalance.Visible = false;
                if (ddlReceiptMode.SelectedValue != "")
                {
                    GeneralLedgerBL   objGeneralLedgerBL = new GeneralLedgerBL();
                    GeneralLedgerBO   objGeneralLedgerBO = new GeneralLedgerBO();
                    ApplicationResult objResultSelect    = new ApplicationResult();
                    DataTable         dtSelect           = new DataTable();

                    if (ddlReceiptMode.SelectedValue == "Cash")
                    {
                        txtChequeNo.Text    = "";
                        txtChequeNo.Enabled = false;
                        ddlGeneralLedger.ClearSelection();

                        objResultSelect = objGeneralLedgerBL.GeneralLedger_Select_Receipt_Payment(1, Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));
                        if (objResultSelect != null)
                        {
                            dtSelect = objResultSelect.resultDT;

                            objControl.BindDropDown_ListBox(dtSelect, ddlGeneralLedger, "AccountName", "LedgerID");
                            ddlGeneralLedger.Items.Insert(0, new ListItem("--Select--", ""));
                        }
                    }
                    else if (ddlReceiptMode.SelectedValue == "Bank")
                    {
                        txtChequeNo.Text    = "";
                        txtChequeNo.Enabled = true;
                        ddlGeneralLedger.ClearSelection();

                        objResultSelect = objGeneralLedgerBL.GeneralLedger_Select_Receipt_Payment(2, Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));
                        if (objResultSelect != null)
                        {
                            dtSelect = objResultSelect.resultDT;

                            objControl.BindDropDown_ListBox(dtSelect, ddlGeneralLedger, "AccountName", "LedgerID");
                            ddlGeneralLedger.Items.Insert(0, new ListItem("--Select--", ""));
                        }
                    }
                    else
                    {
                        txtChequeNo.Text    = "";
                        txtChequeNo.Enabled = true;
                        ddlGeneralLedger.ClearSelection();

                        objResultSelect = objGeneralLedgerBL.GeneralLedger_Select_Receipt_Payment(3, Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));
                        if (objResultSelect != null)
                        {
                            dtSelect = objResultSelect.resultDT;

                            objControl.BindDropDown_ListBox(dtSelect, ddlGeneralLedger, "AccountName", "LedgerID");
                            ddlGeneralLedger.Items.Insert(0, new ListItem("--Select--", ""));
                        }
                    }
                }
                else
                {
                    ddlGeneralLedger.Items.Clear();
                    ddlGeneralLedger.Items.Insert(0, new ListItem("--Select--", ""));
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// To Update details of GeneralLedger in tbl_GeneralLedger_M table
        /// Created By : Viral, 10/7/2014
        /// Modified By :
        /// </summary>
        /// <param name="objGeneralLedgerBO"></param>
        /// <returns></returns>
        public ApplicationResult GeneralLedger_Update(GeneralLedgerBO objGeneralLedgerBO, string strFromDate)
        {
            try
            {
                pSqlParameter = new SqlParameter[14];


                pSqlParameter[0]           = new SqlParameter("@LedgerID", SqlDbType.Int);
                pSqlParameter[0].Direction = ParameterDirection.Input;
                pSqlParameter[0].Value     = objGeneralLedgerBO.LedgerID;

                pSqlParameter[1]           = new SqlParameter("@TrustMID", SqlDbType.Int);
                pSqlParameter[1].Direction = ParameterDirection.Input;
                pSqlParameter[1].Value     = objGeneralLedgerBO.TrustMID;

                pSqlParameter[2]           = new SqlParameter("@SchoolMID", SqlDbType.Int);
                pSqlParameter[2].Direction = ParameterDirection.Input;
                pSqlParameter[2].Value     = objGeneralLedgerBO.SchoolMID;

                pSqlParameter[3]           = new SqlParameter("@AccountName", SqlDbType.NVarChar);
                pSqlParameter[3].Direction = ParameterDirection.Input;
                pSqlParameter[3].Value     = objGeneralLedgerBO.AccountName;

                pSqlParameter[4]           = new SqlParameter("@AccountGroupID", SqlDbType.Int);
                pSqlParameter[4].Direction = ParameterDirection.Input;
                pSqlParameter[4].Value     = objGeneralLedgerBO.AccountGroupID;

                pSqlParameter[5]           = new SqlParameter("@OpeningBalance", SqlDbType.Float);
                pSqlParameter[5].Direction = ParameterDirection.Input;
                pSqlParameter[5].Value     = objGeneralLedgerBO.OpeningBalance;

                pSqlParameter[6]           = new SqlParameter("@BalanceType", SqlDbType.NVarChar);
                pSqlParameter[6].Direction = ParameterDirection.Input;
                pSqlParameter[6].Value     = objGeneralLedgerBO.BalanceType;

                pSqlParameter[7]           = new SqlParameter("@Description", SqlDbType.NVarChar);
                pSqlParameter[7].Direction = ParameterDirection.Input;
                pSqlParameter[7].Value     = objGeneralLedgerBO.Description;

                pSqlParameter[8]           = new SqlParameter("@CreatedDate", SqlDbType.NVarChar);
                pSqlParameter[8].Direction = ParameterDirection.Input;
                pSqlParameter[8].Value     = objGeneralLedgerBO.CreatedDate;

                pSqlParameter[9]           = new SqlParameter("@CreatedUserID", SqlDbType.Int);
                pSqlParameter[9].Direction = ParameterDirection.Input;
                pSqlParameter[9].Value     = objGeneralLedgerBO.CreatedUserID;

                pSqlParameter[10]           = new SqlParameter("@IsDeleted", SqlDbType.Int);
                pSqlParameter[10].Direction = ParameterDirection.Input;
                pSqlParameter[10].Value     = objGeneralLedgerBO.IsDeleted;

                pSqlParameter[11]           = new SqlParameter("@LastModifideUserID", SqlDbType.Int);
                pSqlParameter[11].Direction = ParameterDirection.Input;
                pSqlParameter[11].Value     = objGeneralLedgerBO.LastModifideUserID;

                pSqlParameter[12]           = new SqlParameter("@LastModifideDate", SqlDbType.NVarChar);
                pSqlParameter[12].Direction = ParameterDirection.Input;
                pSqlParameter[12].Value     = objGeneralLedgerBO.LastModifideDate;

                pSqlParameter[13]           = new SqlParameter("@FromDate", SqlDbType.VarChar);
                pSqlParameter[13].Direction = ParameterDirection.Input;
                pSqlParameter[13].Value     = strFromDate;

                sSql = "usp_tbl_GeneralLedger_M_Update";
                int iResult = Database.ExecuteNonQuery(CommandType.StoredProcedure, sSql, pSqlParameter);

                if (iResult > 0)
                {
                    ApplicationResult objResults = new ApplicationResult();
                    objResults.status = ApplicationResult.CommonStatusType.SUCCESS;
                    return(objResults);
                }
                else
                {
                    ApplicationResult objResults = new ApplicationResult();
                    objResults.status = ApplicationResult.CommonStatusType.FAILURE;
                    return(objResults);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objGeneralLedgerBO = null;
            }
        }
Exemplo n.º 6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                GeneralLedgerBL   objGeneralLedgerBL = new GeneralLedgerBL();
                GeneralLedgerBO   objGeneralLedgerBO = new GeneralLedgerBO();
                ApplicationResult objResultValidate  = new ApplicationResult();
                int intLedgerID = 0;

                objGeneralLedgerBO.TrustMID       = Convert.ToInt32(Session[ApplicationSession.TRUSTID]);
                objGeneralLedgerBO.SchoolMID      = Convert.ToInt32(Session[ApplicationSession.SCHOOLID]);
                objGeneralLedgerBO.AccountName    = txtAccountName.Text;
                objGeneralLedgerBO.AccountGroupID = Convert.ToInt32(ddlAccountGroup.SelectedValue);
                if (txtOpeningBalance.Text.Length > 0)
                {
                    objGeneralLedgerBO.OpeningBalance = Convert.ToDouble(txtOpeningBalance.Text);
                }
                if (ddlBalanceType.SelectedValue != "")
                {
                    objGeneralLedgerBO.BalanceType = ddlBalanceType.SelectedValue;
                }
                objGeneralLedgerBO.Description        = txtDescription.Text;
                objGeneralLedgerBO.CreatedDate        = System.DateTime.UtcNow.AddHours(5.5).ToString();
                objGeneralLedgerBO.CreatedUserID      = Convert.ToInt32(Session[ApplicationSession.USERID]);
                objGeneralLedgerBO.IsDeleted          = 0;
                objGeneralLedgerBO.LastModifideDate   = System.DateTime.UtcNow.AddHours(5.5).ToString();
                objGeneralLedgerBO.LastModifideUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);

                //Code For Validate Department Name
                if (ViewState["Mode"].ToString() == "Save")
                {
                    intLedgerID = -1;
                }
                else if (ViewState["Mode"].ToString() == "Edit")
                {
                    intLedgerID = Convert.ToInt32(ViewState["LedgerID"].ToString());
                    objGeneralLedgerBO.LedgerID = Convert.ToInt32(ViewState["LedgerID"].ToString());
                }
                objResultValidate = objGeneralLedgerBL.GeneralLedger_ValidateName(Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]), txtAccountName.Text, intLedgerID);

                if (objResultValidate != null)
                {
                    DataTable dtValidate = new DataTable();
                    dtValidate = objResultValidate.resultDT;
                    if (dtValidate.Rows.Count > 0)
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Ledger name already exist.');</script>");
                    }
                    else
                    {
                        if (ViewState["Mode"].ToString() == "Save")
                        {
                            ApplicationResult objResultSave = new ApplicationResult();
                            objResultSave = objGeneralLedgerBL.GeneralLedger_Insert(objGeneralLedgerBO, Convert.ToInt32(Session[ApplicationSession.FINANCIALYEAR]));
                            if (objResultSave.status == ApplicationResult.CommonStatusType.SUCCESS)
                            {
                                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Saved successfully.');</script>");
                            }
                        }
                        else if (ViewState["Mode"].ToString() == "Edit")
                        {
                            ApplicationResult objResultUpdate = new ApplicationResult();
                            objResultUpdate = objGeneralLedgerBL.GeneralLedger_Update(objGeneralLedgerBO, Session[ApplicationSession.ACCOUNTFROMDATE].ToString());
                            if (objResultUpdate.status == ApplicationResult.CommonStatusType.SUCCESS)
                            {
                                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record updated successfully.');</script>");
                            }
                        }
                        ClearAll();
                        BindGrid();
                        PanelVisibility(1);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }