//Grid Fee row deleting #region [Grid Fee Row Deleting] protected void GrdFees_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { string[] confirmValue = Request.Form["confirm_value"].Split(','); if (confirmValue[confirmValue.Length - 1] == "Yes") { EWA_Fees ObjEWA = new EWA_Fees(); BL_Fees ObjBL = new BL_Fees(); ObjEWA.Action = "DeleteParticular"; ObjEWA.FeesId = ViewState["FeesId"].ToString(); Label lblParticular = (Label)GrdFees.Rows[e.RowIndex].FindControl("lblPerticular"); ObjEWA.Particular = lblParticular.Text; string FeesDetailsId = GrdFees.DataKeys[e.RowIndex].Values["FeesDetailsId"].ToString(); ObjEWA.FeesDetalsId = FeesDetailsId; ObjBL.DeleteParticular_BL(ObjEWA); BindGridView(ObjEWA.FeesId); lblresult.ForeColor = Color.Green; lblresult.Text = ObjEWA.Particular + " Details Deleted successfully"; } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Bind Grid View #region [Bind Grid View] private void BindGridView(string feesId) { try { EWA_Fees ObjEWA = new EWA_Fees(); BL_Fees ObjBL = new BL_Fees(); if (!feesId.Equals("Empty")) { ObjEWA.FeesId = feesId; DataSet ds = ObjBL.BindGridView_BL(ObjEWA); if (ds != null) { GrdFees.DataSource = ds; GrdFees.DataBind(); } else { BindEmptyDataTable(); } } else { BindEmptyDataTable(); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Update Perticular #region [Update Perticular] public int UpdateParticular_DL(EWA_Fees ObjEWA) { int flag = 0; try { cmd = new SqlCommand("SP_FeesDetails", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", ObjEWA.Action); cmd.Parameters.AddWithValue("@FeesId", ObjEWA.FeesId); cmd.Parameters.AddWithValue("@FeesDetalsId", ObjEWA.FeesDetalsId); cmd.Parameters.AddWithValue("@Particular", ObjEWA.Particular); cmd.Parameters.AddWithValue("@Amount", ObjEWA.Amount); cmd.Parameters.AddWithValue("@OldParticular", ObjEWA.OldParticular); cmd.Parameters.AddWithValue("@OldAmount", ObjEWA.OldAmount); con.Open(); flag = cmd.ExecuteNonQuery(); con.Close(); return(flag); } catch (Exception) { return(flag); } }
//Grid Fee Row Command #region [Grid Fee Row Command] protected void GrdFees_RowCommand(object sender, GridViewCommandEventArgs e) { try { EWA_Fees ObjEWA = new EWA_Fees(); BL_Fees ObjBL = new BL_Fees(); if (e.CommandName.Equals("AddNew")) { TextBox txtParticular = (TextBox)GrdFees.FooterRow.FindControl("txtFooterPerticular"); TextBox txtAmount = (TextBox)GrdFees.FooterRow.FindControl("txtFooterAmount"); ObjEWA.FeesId = ViewState["FeesId"].ToString(); ObjEWA.Particular = txtParticular.Text; ObjEWA.Amount = txtAmount.Text; ObjEWA.Action = "Save"; ObjBL.AddNewRow_BL(ObjEWA); BindGridView(ObjEWA.FeesId); lblresult.ForeColor = Color.Green; lblresult.Text = ObjEWA.Particular + " Details inserted successfully"; //msgBox.ShowMessage("Particular added successfully !!!", "Information", UserControls.MessageBox.MessageStyle.Critical); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Get Fee Id #region [get Fee Id] public DataSet GetFeesId_DL(EWA_Fees ObjEWA) { DataSet ds = null; try { prmList = new string[12]; prmList[0] = "@Action"; prmList[1] = "FetchFeesId"; prmList[2] = "@CourseId"; prmList[3] = ObjEWA.CourseId; prmList[4] = "@ClassId"; prmList[5] = ObjEWA.ClassId; prmList[6] = "@CasteCategoryId"; prmList[7] = ObjEWA.CasteCategoryId; prmList[8] = "@OrgId"; prmList[9] = ObjEWA.OrgId; prmList[10] = "@AcademicYearId"; prmList[11] = ObjEWA.AcademicYear; ds = ObjHelper.FillControl(prmList, "SP_Fees"); if (ds.Tables[0].Rows.Count > 0) { return(ds); } return(ds); } catch (Exception) { throw; } }
//Add new fees #region [Add New Fee] public void AddNewFees_BL(EWA_Fees ObjEWA) { try { DL_Fees ObjDL = new DL_Fees(); ObjDL.AddNewFees_DL(ObjEWA); } catch (Exception) { throw; } }
//Delete Perticular #region [Delete Perticular] public void DeleteParticular_BL(EWA_Fees ObjEWA) { try { DL_Fees ObjDL = new DL_Fees(); ObjDL.DeleteParticular_DL(ObjEWA); } catch (Exception) { throw; } }
//Update Perticular #region [Update Perticular] public int UpdateParticular_BL(EWA_Fees ObjEWA) { try { DL_Fees ObjDL = new DL_Fees(); return(ObjDL.UpdateParticular_DL(ObjEWA)); } catch (Exception) { return(0); } }
//Caste Category Index Changed #region [Caste Category Index Changed] protected void ddlCastCategory_SelectedIndexChanged(object sender, EventArgs e) { try { EWA_Fees ObjEWA = new EWA_Fees(); BL_Fees ObjBL = new BL_Fees(); ObjEWA.OrgId = Session["OrgId"].ToString(); ObjEWA.CourseId = ddlCourse.SelectedValue; ObjEWA.ClassId = ddlClass.SelectedValue; ObjEWA.CasteCategoryId = ddlCastCategory.SelectedValue; ObjEWA.AcademicYear = ddlAcademicYear.SelectedValue; if (!ObjEWA.CasteCategoryId.Equals("Select")) { DataSet ds = ObjBL.GetFeesId_BL(ObjEWA); if (ds.Tables[0].Rows.Count > 0) { feesId = ds.Tables[0].Rows[0]["FeesId"].ToString(); ViewState["FeesId"] = feesId; ObjEWA.OrgId = Session["OrgId"].ToString(); BindGridView(feesId); } else { ObjEWA.OrgId = Session["OrgId"].ToString(); ObjEWA.CourseId = ddlCourse.SelectedValue; ObjEWA.BranchId = ddlBranch.SelectedValue; ObjEWA.ClassId = ddlClass.SelectedValue; ObjEWA.AcademicYear = ddlAcademicYear.SelectedValue; ObjEWA.CasteCategoryId = ddlCastCategory.SelectedValue; ObjEWA.Action = "Save"; ObjBL.AddNewFees_BL(ObjEWA); ds = ObjBL.GetFeesId_BL(ObjEWA); feesId = ds.Tables[0].Rows[0]["FeesId"].ToString(); ViewState["FeesId"] = feesId; BindGridView("Empty"); } } else { BindEmptyDataTable(); } lblresult.Text = ""; } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Bind Gridview #region [Bind Grid View] public DataSet BindGridView_BL(EWA_Fees ObjEWA) { try { DL_Fees ObjDL = new DL_Fees(); DataSet ds = ObjDL.BindGridView_DL(ObjEWA); return(ds); } catch (Exception) { throw; } }
//Get Fee Id #region [Get Fee Id] public DataSet GetFeesId_BL(EWA_Fees ObjEWA) { try { DL_Fees ObjDL = new DL_Fees(); DataSet ds = ObjDL.GetFeesId_DL(ObjEWA); return(ds); } catch (Exception) { throw; } }
//Bind Category BindCategory_BL #region [Bind Cast Category] public DataSet BindCasteCategory_BL(EWA_Fees objEWA) { try { DL_Fees objDL = new DL_Fees(); DataSet ds = objDL.BindCategory_DL(objEWA); return(ds); } catch (Exception) { throw; } }
//Delete Perticular #region [Delete Perticular] public void DeleteParticular_DL(EWA_Fees ObjEWA) { try { cmd = new SqlCommand("SP_FeesDetails", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", ObjEWA.Action); cmd.Parameters.AddWithValue("@FeesId", ObjEWA.FeesId); cmd.Parameters.AddWithValue("@FeesDetalsId", ObjEWA.FeesDetalsId); cmd.Parameters.AddWithValue("@Particular", ObjEWA.Particular); con.Open(); int flag = cmd.ExecuteNonQuery(); con.Close(); } catch (Exception) { throw; } }
//Grid Fee Row Updating #region [Grid Fee Row Updating] protected void GrdFees_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { EWA_Fees ObjEWA = new EWA_Fees(); BL_Fees ObjBL = new BL_Fees(); ObjEWA.Action = "UpdateParticular"; ObjEWA.FeesId = ViewState["FeesId"].ToString(); TextBox txtParticular = (TextBox)GrdFees.Rows[e.RowIndex].FindControl("txtPerticular"); TextBox txtAmount = (TextBox)GrdFees.Rows[e.RowIndex].FindControl("txtAmount"); string FeesDetailsId = GrdFees.DataKeys[e.RowIndex].Values["FeesDetailsId"].ToString(); ObjEWA.FeesDetalsId = FeesDetailsId; ObjEWA.Particular = txtParticular.Text; ObjEWA.Amount = txtAmount.Text; ObjEWA.OldParticular = ViewState["OldParticular"].ToString(); ObjEWA.OldAmount = ViewState["OldAmount"].ToString(); int result = ObjBL.UpdateParticular_BL(ObjEWA); GrdFees.EditIndex = -1; BindGridView(ObjEWA.FeesId); if (result > 0) { lblresult.ForeColor = Color.Green; lblresult.Text = ObjEWA.Particular + " Details Updated successfully"; } else { lblresult.ForeColor = Color.Red; lblresult.Text = ObjEWA.OldParticular + " Details is in use. Not updated."; } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Add New Fee #region [Add New Fee] public void AddNewFees_DL(EWA_Fees ObjEWA) { try { cmd = new SqlCommand("SP_Fees", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", ObjEWA.Action); cmd.Parameters.AddWithValue("@OrgId", ObjEWA.OrgId); cmd.Parameters.AddWithValue("@CourseId", ObjEWA.CourseId); cmd.Parameters.AddWithValue("@BranchId", ObjEWA.BranchId); cmd.Parameters.AddWithValue("@ClassId", ObjEWA.ClassId); cmd.Parameters.AddWithValue("@AcademicYearId", ObjEWA.AcademicYear); cmd.Parameters.AddWithValue("@CasteCategoryId", ObjEWA.CasteCategoryId); con.Open(); int flag = cmd.ExecuteNonQuery(); con.Close(); } catch (Exception) { throw; } }
//Bind Grid View #region [Bind Grid View] public DataSet BindGridView_DL(EWA_Fees ObjEWA) { DataSet ds = null; try { prmList = new string[4]; prmList[0] = "@Action"; prmList[1] = "FetchParticular"; prmList[2] = "@FeesId"; prmList[3] = ObjEWA.FeesId; ds = ObjHelper.FillControl(prmList, "SP_FeesDetails"); if (ds.Tables[0].Rows.Count > 0) { return(ds); } return(null); } catch (Exception) { throw; } }
//Bind Class BindCastCategory_DL #region Bind CastCategory public DataSet BindCategory_DL(EWA_Fees objEWA) { DataSet ds = null; try { prmList = new string[4]; prmList[0] = "@Action"; prmList[1] = "FetchCasteCategory"; prmList[2] = "@OrgId"; prmList[3] = objEWA.OrgId; ds = ObjHelper.FillControl(prmList, "SP_Fees"); if (ds.Tables[0].Rows.Count > 0) { return(ds); } return(ds); } catch (Exception) { throw; } }