Пример #1
0
        //Get Scheme
        #region [Get Scheme]

        public void GetScheme()
        {
            try
            {
                ObjEWA = new EWA_Scheme();
                ObjBL  = new BL_Scheme();

                ObjEWA.OrganizationId = Convert.ToInt32(Session["OrgId"].ToString());
                ObjEWA.AcademicYearId = Convert.ToInt32(Session["AcademicYearId"]);

                ds = ObjBL.GetScheme_BL(ObjEWA);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    dvScheme = new DataView(ds.Tables[0]);
                    ViewState["dvScheme"] = ds;

                    ddlScheme.DataTextField  = "SchemeName";
                    ddlScheme.DataValueField = "SchemeId";
                    ddlScheme.DataSource     = ds.Tables[0];
                    ddlScheme.DataBind();
                    ddlScheme.Items.Insert(0, "Select");
                    //BindGrantedAmount();
                    //BindGridView();
                }
                else
                {
                    //No data
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message);
            }
        }
Пример #2
0
        //Grid Fee row deleting
        #region [Grid Fee Row Deleting]

        protected void GrdScheme_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                string[] confirmValue = Request.Form["confirm_value"].Split(',');
                if (confirmValue[confirmValue.Length - 1] == "Yes")
                {
                    EWA_Scheme ObjEWA = new EWA_Scheme();
                    BL_Scheme  ObjBL  = new BL_Scheme();
                    ObjEWA.Action   = "Delete";
                    ObjEWA.SchemeId = Convert.ToInt32(ddlScheme.SelectedItem.Value);
                    Label lblSchemeDetailsId = (Label)GrdScheme.Rows[e.RowIndex].FindControl("lblSchemeDetailsId");

                    ObjEWA.SchemeDetailsId = Convert.ToInt32(lblSchemeDetailsId.Text);

                    ObjBL.DeleteScheme_BL(ObjEWA);
                    BindGridView();
                    lblresult.ForeColor = Color.Green;
                    lblresult.Text      = ObjEWA.FundName + " Details Deleted successfully";
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
Пример #3
0
        //Grid Fee Row Command
        #region [Grid Fee Row Command]

        protected void GrdScheme_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                EWA_Scheme ObjEWA = new EWA_Scheme();
                BL_Scheme  ObjBL  = new BL_Scheme();
                if (e.CommandName.Equals("AddNew"))
                {
                    TextBox txtFundName          = (TextBox)GrdScheme.FooterRow.FindControl("txtFooterFundName");
                    TextBox txtDistributedAmount = (TextBox)GrdScheme.FooterRow.FindControl("txtFooterDistributedAmount");

                    if ((Convert.ToDouble(ViewState["TotalAmount"].ToString()) + Convert.ToDouble(txtDistributedAmount.Text)) <= Convert.ToDouble(txtGrantedAmount.Text))
                    {
                        ObjEWA.SchemeId       = Convert.ToInt32(ddlScheme.SelectedItem.Value);
                        ObjEWA.AcademicYearId = Convert.ToInt32(Session["AcademicYearId"]);
                        ObjEWA.OrganizationId = Convert.ToInt32(Session["OrgId"].ToString());

                        ObjEWA.UserId = Session["UserCode"].ToString();

                        ObjEWA.FundName = txtFundName.Text;
                        // string str = txtDistributedAmount.Text;
                        ObjEWA.DistributedAmount = Convert.ToDouble(txtDistributedAmount.Text);

                        ObjEWA.Action = "Save";
                        ObjBL.InsertScheme_BL(ObjEWA);
                        BindGridView();
                        lblresult.ForeColor = Color.Green;
                        lblresult.Text      = ObjEWA.FundName + " Details inserted successfully";
                    }
                    else
                    {
                        lblresult.ForeColor = Color.Red;
                        lblresult.Text      = "Distributed amount should be less than granted amount.";
                    }

                    ////msgBox.ShowMessage("Particular added successfully !!!", "Information", UserControls.MessageBox.MessageStyle.Critical);
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
Пример #4
0
        //Grid Fee Row Updating
        #region [Grid Fee Row Updating]

        protected void GrdScheme_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                EWA_Scheme ObjEWA = new EWA_Scheme();
                BL_Scheme  ObjBL  = new BL_Scheme();
                ObjEWA.Action   = "Update";
                ObjEWA.SchemeId = Convert.ToInt32(ddlScheme.SelectedItem.Value);
                TextBox txtFundName          = (TextBox)GrdScheme.Rows[e.RowIndex].FindControl("txtFundName");
                TextBox txtDistributedAmount = (TextBox)GrdScheme.Rows[e.RowIndex].FindControl("txtDistributedAmount");
                Label   lblSchemeDetailsId   = (Label)GrdScheme.Rows[e.RowIndex].FindControl("lblSchemeDetailsId");

                if ((Convert.ToDouble(ViewState["TotalAmount"].ToString()) + Convert.ToDouble(txtDistributedAmount.Text) - Convert.ToDouble(ViewState["OldDistributedAmount"].ToString())) <= Convert.ToDouble(txtGrantedAmount.Text))
                {
                    ObjEWA.SchemeDetailsId   = Convert.ToInt32(lblSchemeDetailsId.Text);
                    ObjEWA.FundName          = txtFundName.Text;
                    ObjEWA.DistributedAmount = Convert.ToDouble(txtDistributedAmount.Text);
                    ObjEWA.UserId            = Session["UserCode"].ToString();

                    ObjBL.UpdateScheme_BL(ObjEWA);

                    GrdScheme.EditIndex = -1;
                    BindGridView();

                    lblresult.ForeColor = Color.Green;
                    lblresult.Text      = ObjEWA.FundName + " Details Updated successfully";
                }
                else
                {
                    lblresult.ForeColor = Color.Red;
                    lblresult.Text      = "Distributed amount should be less than granted amount.";
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
Пример #5
0
        //Bind Grid View
        #region [Bind Grid View]

        private void BindGridView()
        {
            try
            {
                EWA_Scheme ObjEWA = new EWA_Scheme();
                BL_Scheme  ObjBL  = new BL_Scheme();
                DataSet    ds     = new DataSet();
                SchemeId = ddlScheme.SelectedItem.Value;

                if (!SchemeId.Equals("Select"))
                {
                    ObjEWA.SchemeId = Convert.ToInt32(ddlScheme.SelectedItem.Value);

                    ObjEWA.AcademicYearId = Convert.ToInt32(Session["AcademicYearId"]);
                    ObjEWA.OrganizationId = Convert.ToInt32(Session["OrgId"].ToString());

                    ds = ObjBL.BindScheme_BL(ObjEWA);

                    if (ds.Tables[0].Rows.Count != 0)
                    {
                        GrdScheme.DataSource = ds.Tables[0];
                        GrdScheme.DataBind();
                    }
                    else
                    {
                        BindEmptyDataTable(ds);
                    }
                }
                else
                {
                    BindEmptyDataTable(ds);
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }