Esempio n. 1
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e

        private void BindGrid()
        {
            LoanBLL objLoanBLL = new LoanBLL();

            GrdPurposeofencumbrance.DataSource = objLoanBLL.GetLoan("");
            GrdPurposeofencumbrance.DataBind();
        }
Esempio n. 2
0
        /// <summary>
        /// Update Database Make data as Obsoluted
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void IsObsolete_CheckedChanged(Object sender, EventArgs e)
        {
            string message = string.Empty;

            try
            {
                CheckBox    chk = (CheckBox)sender;
                GridViewRow gr  = (GridViewRow)chk.Parent.Parent;

                string  ENCUMBRANCEID = ((Literal)gr.FindControl("litENCUMBRANCEID")).Text;
                LoanBLL objLoanBLL    = new LoanBLL();
                message = objLoanBLL.ObsoleteLoan(Convert.ToInt32(ENCUMBRANCEID), Convert.ToString(chk.Checked));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                BindGrid();

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Set edit mode for edit comand
        /// Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void GrdPurposeofencumbrance_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ShowHideSections(true, false);
                ViewState["ENCUMBRANCEID"] = e.CommandArgument;
                LoanBLL objLoanBLL = new LoanBLL();
                LoanBO  objLoan    = objLoanBLL.GetLoanByLoanID(Convert.ToInt32(ViewState["ENCUMBRANCEID"]));
                txtPurposeofencumbrance.Text = objLoan.Encumbrancepurpose;
                SetUpdateMode(true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
            }

            else if (e.CommandName == "DeleteRow")
            {
                LoanBLL objLoanBLL = new LoanBLL();
                objLoanBLL.DeleteLoan(Convert.ToInt32(e.CommandArgument));
                SetUpdateMode(false);
                BindGrid();
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        protected void SetGridSource(bool showRecentRecords)
        {
            string EncumbrancepurposeName;

            EncumbrancepurposeName = txtSearch.Text.Trim();
            LoanBLL  objLoanBLL  = new LoanBLL();
            LoanList objLoanList = new LoanList();

            objLoanList = objLoanBLL.GetLoan(EncumbrancepurposeName);
            if (objLoanList.Count > 0)
            {
                GrdPurposeofencumbrance.DataSource = objLoanList;
                GrdPurposeofencumbrance.DataBind();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            string message = "";
            LoanBO objLoan = new LoanBO();

            objLoan.EncumbranceId      = Convert.ToInt32(ViewState["ENCUMBRANCEID"]);
            objLoan.Encumbrancepurpose = txtPurposeofencumbrance.Text.Trim();
            LoanBLL objLoanBLL = new LoanBLL();

            if (objLoan.EncumbranceId == 0)
            {
                objLoan.CreatedBy = Convert.ToInt32(Session["USER_ID"]);
                message           = objLoanBLL.AddLoan(objLoan);

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                }
            }
            else
            {
                objLoan.UpdatedBy = Convert.ToInt32(Session["USER_ID"]);
                message           = objLoanBLL.UpdateLoan(objLoan);
                // SetUpdateMode(false);

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                SetUpdateMode(false);
            }

            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }

            ClearDetails();
            BindGrid();
        }