private void GridDataBind() { try { ApplicationResult objResult = new ApplicationResult(); FeesCategoryBL objFeesBl = new FeesCategoryBL(); objResult = objFeesBl.FeesCategory_SelectAll(Convert.ToInt32(Session[ApplicationSession.SCHOOLID])); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { gvFeesCategory.DataSource = objResult.resultDT; gvFeesCategory.DataBind(); PanelGrid_VisibilityMode(1); } else { PanelGrid_VisibilityMode(2); } } } 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>"); } }
public void BindFeesCategory() { try { FeesCategoryBL objFeesCategoryBL = new FeesCategoryBL(); ApplicationResult objResult = new ApplicationResult(); objResult = objFeesCategoryBL.FeesCategory_SelectAll(Convert.ToInt32(Session[ApplicationSession.SCHOOLID])); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { gvFees.DataSource = objResult.resultDT; gvFees.DataBind(); //PanelGrid_VisibilityMode(1); } else { //PanelGrid_VisibilityMode(2); } } } catch (Exception ex) { } }
public bool ValidateName() { FeesCategoryBL objFeesBl = new FeesCategoryBL(); ApplicationResult objResults = new ApplicationResult(); if (ViewState["Mode"].ToString() == "Save") { objResults = objFeesBl.FeesCategory_ValidateName(txtFeesCategoryName.Text, -1, Convert.ToInt32(Session[ApplicationSession.SCHOOLID])); } else { objResults = objFeesBl.FeesCategory_ValidateName(txtFeesCategoryName.Text, Convert.ToInt32(ViewState["FeesCategoryMID"].ToString()), Convert.ToInt32(Session[ApplicationSession.SCHOOLID])); } if (objResults.resultDT.Rows.Count > 0) { return(true); } return(false); }
public void BindGridView() { try { ApplicationResult objResult = new ApplicationResult(); FeesCategoryBL objGridFeesBL = new FeesCategoryBL(); objResult = objGridFeesBL.FeesCategory_Select_For_ClassTemplate(Convert.ToInt32(Session[ApplicationSession.SCHOOLID])); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { gvFees.Visible = true; gvFees.DataSource = objResult.resultDT; gvFees.DataBind(); ((CheckBox)gvFees.HeaderRow.FindControl("chkHeader")).Enabled = true; } else { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('No Record Found.');</script>"); gvFees.Visible = false; } foreach (GridViewRow row in gvFees.Rows) { ViewState["FeesCategoryMID"] = Convert.ToInt32(row.Cells[0].Text); DataTable Dt = Select_ClassTemlate_FeeCategory(); if (Dt.Rows.Count > 0) { ViewState["ClassTemplateTID"] = Convert.ToInt32(Dt.Rows[0][ClassWiseFeesTemplateTBO.CLASSWISEFEESTEMPLATET_CLASSWISEFEESTEMPLATETID].ToString()); ((CheckBox)row.FindControl("chkChild")).Checked = true; ((CheckBox)gvFees.HeaderRow.FindControl("chkHeader")).Enabled = false; btnSave.Enabled = true; // btnSave.BackColor = Color.#3b5998; btnSave.Attributes.Add("bgcolor", "#3b5998"); ((TextBox)row.FindControl("txtFeesAmount")).Text = Dt.Rows[0][ClassWiseFeesTemplateTBO.CLASSWISEFEESTEMPLATET_FEESAMOUNT].ToString(); DataTable dtFeeCollection = ValidateFeesbyFeesCollection(Convert.ToInt32(ViewState["ClassTemplateTID"].ToString()), Convert.ToInt32(ViewState["ClassMID"].ToString()), Convert.ToInt32(ViewState["DivisionName"].ToString()), ddlAcademicYear.SelectedItem.ToString(), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]), 0); if (dtFeeCollection.Rows.Count > 0) { //ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='This Fee Category is Not Update/Delete.');</script>"); //foreach (GridViewRow rowData in gvFees.Rows) //{ ((CheckBox)row.FindControl("chkChild")).Enabled = false; ((TextBox)row.FindControl("txtFeesAmount")).Enabled = false; //} btnSave.Enabled = true; btnSave.Attributes.Add("bgcolor", "#3b5998"); // ((CheckBox)row.FindControl("chkHeader")).Visible = false; } } } } btnSave.Visible = true; //btnCancel.Visible = true; } 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>"); } }
protected void gvFeesCategory_RowCommand(object sender, GridViewCommandEventArgs e) { FeesCategoryBL objFeesBl = new FeesCategoryBL(); try { ViewState["FeesCategoryMID"] = Convert.ToInt32(e.CommandArgument.ToString()); if (e.CommandName.ToString() == "Edit1") { ApplicationResult objResultsEdit = new ApplicationResult(); objResultsEdit = objFeesBl.FeesCategory_Select(Convert.ToInt32(ViewState["FeesCategoryMID"].ToString()), Convert.ToInt32(Session[ApplicationSession.SCHOOLID])); if (objResultsEdit != null) { if (objResultsEdit.resultDT.Rows.Count > 0) { txtFeesCategoryName.Text = objResultsEdit.resultDT.Rows[0][FeesCategoryBO.FEESCATEGORY_FEESNAME].ToString(); rblFeeType.SelectedValue = objResultsEdit.resultDT.Rows[0][FeesCategoryBO.FEESCATEGORY_FEESTYPE].ToString(); ddlOutstandingMonth.SelectedValue = objResultsEdit.resultDT.Rows[0][FeesCategoryBO.FEESCATEGORY_OutstandingMonth].ToString(); txtAbbreviation.Text = objResultsEdit.resultDT.Rows[0][FeesCategoryBO.FEESCATEGORY_FEEABBREVIATION].ToString(); ddlFeeGroup.Text = objResultsEdit.resultDT.Rows[0][FeesCategoryBO.FEESCATEGORY_FEEGROUPID].ToString(); ViewState["Mode"] = "Edit"; PanelGrid_VisibilityMode(2); } } } if (e.CommandName.ToString() == "Delete1") { Controls objControls = new Controls(); //objControls.EnableControls(Master.FindControl("ContentPlaceHolder1")); ApplicationResult objDelete = new ApplicationResult(); objDelete = objFeesBl.Validate_FeesCategory_Delete(Convert.ToInt32(ViewState["FeesCategoryMID"].ToString()), Convert.ToInt32(Session[ApplicationSession.SCHOOLID])); if (objDelete != null) { if (objDelete.resultDT.Rows.Count > 0) { if (Convert.ToInt32(objDelete.resultDT.Rows[0]["FeesCategoryMID"]) == Convert.ToInt32(ViewState["FeesCategoryMID"].ToString())) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('There are ClasseTemplate(s) associated with this FeeCategory. To delete this FeeCategory you need to delete ClasseTemplate(s) first');</script>"); goto Exit; } } } ApplicationResult objResultsDelete = new ApplicationResult(); objResultsDelete = objFeesBl.FeesCategory_Delete(Convert.ToInt32(e.CommandArgument.ToString())); if (objResultsDelete.status == ApplicationResult.CommonStatusType.SUCCESS) { ClearAll(); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Fee Category deleted successfully.');</script>"); GridDataBind(); PanelGrid_VisibilityMode(1); } } Exit :; } 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>"); } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString()) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); FeesCategoryBO objFeesBo = new FeesCategoryBO(); ApplicationResult objResults = new ApplicationResult(); FeesCategoryBL objFeesBl = new FeesCategoryBL(); Controls objControls = new Controls(); objFeesBo.TrustMID = Convert.ToInt32(Session[ApplicationSession.TRUSTID]); objFeesBo.SchoolMID = Convert.ToInt32(Session[ApplicationSession.SCHOOLID]); objFeesBo.FeesName = txtFeesCategoryName.Text; objFeesBo.FeesType = rblFeeType.SelectedItem.Text; objFeesBo.OutstandingMonth = Convert.ToInt32(ddlOutstandingMonth.SelectedValue); objFeesBo.FeeAbbreviation = txtAbbreviation.Text; objFeesBo.FeeGroupID = Convert.ToInt32(ddlFeeGroup.SelectedValue); objFeesBo.LastModifiedDate = DateTime.UtcNow.AddHours(5.5).ToString(); objFeesBo.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); if (ValidateName() == true) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Fees Category Name " + txtFeesCategoryName.Text + " Already Exists');</script>"); goto Exit; } if (ViewState["Mode"].ToString() == "Save") { objResults = objFeesBl.FeesCategory_Insert(objFeesBo); if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS) { ClearAll(); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Fees Category Created Successfully.');</script>"); GridDataBind(); PanelGrid_VisibilityMode(1); } } else { objFeesBo.FeesCategoryMID = Convert.ToInt32(ViewState["FeesCategoryMID"].ToString()); objResults = objFeesBl.FeesCategory_Update(objFeesBo); if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Fee Category updated successfully.');</script>"); GridDataBind(); ClearAll(); //objControls.ClearForm(Master.FindControl("ContentPlaceHolder1")); ViewState["Mode"] = "Save"; btnSave.Text = "Save"; } } Exit :; } else { } } 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>"); } }
protected void btnGo_Click(object sender, EventArgs e) { if (rblToggleView.SelectedItem.Text == "Class") { try { ApplicationResult objResult = new ApplicationResult(); ClassBL objClassBL = new ClassBL(); ClassBO objClassBO = new ClassBO(); #region RollBack Transaction Starts DatabaseTransaction.OpenConnectionTransation(); for (int i = 0; i < gvClass.Rows.Count; i++) { TextBox txtSequence = (TextBox)gvClass.Rows[i].FindControl("txtSequence"); if (txtSequence.Text != "") { objClassBO.Priority = Convert.ToInt32(txtSequence.Text); objClassBO.ClassMID = Convert.ToInt32(gvClass.Rows[i].Cells[0].Text); objClassBO.ClassName = gvClass.Rows[i].Cells[1].Text; objClassBO.SchoolMID = Convert.ToInt32(Session[ApplicationSession.SCHOOLID]); objResult = objClassBL.Class_Update_For_Priority(objClassBO); if (objResult != null) { } else { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator...');</script>"); } } else { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Enter the priority.');</script>"); break; } } DatabaseTransaction.CommitTransation(); #endregion ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Saved Successfully.');</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>"); } } else if (rblToggleView.SelectedItem.Text == "Fees Category") { try { ApplicationResult objResult = new ApplicationResult(); FeesCategoryBL objFeesCategoryBL = new FeesCategoryBL(); FeesCategoryBO objFeesCategoryBO = new FeesCategoryBO(); #region RollBack Transaction Starts DatabaseTransaction.OpenConnectionTransation(); for (int i = 0; i < gvFees.Rows.Count; i++) { TextBox txtSequence = (TextBox)gvFees.Rows[i].FindControl("txtSequence1"); if (txtSequence.Text != "") { objFeesCategoryBO.Priority = Convert.ToInt32(txtSequence.Text); objFeesCategoryBO.FeesCategoryMID = Convert.ToInt32(gvFees.Rows[i].Cells[0].Text); objFeesCategoryBO.FeesName = gvFees.Rows[i].Cells[1].Text; objResult = objFeesCategoryBL.FeesCategory_Update_For_Priority(objFeesCategoryBO); if (objResult != null) { } else { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator...');</script>"); } } else { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Enter the priority.');</script>"); break; } } DatabaseTransaction.CommitTransation(); #endregion ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Saved Successfully.');</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>"); } } else { } }