private void GridDataBind() { try { ApplicationResult objResult = new ApplicationResult(); SchoolBL objSchoolBl = new SchoolBL(); objResult = objSchoolBl.School_SelectAll(Convert.ToInt32(Session[ApplicationSession.TRUSTID])); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { gvSchool.DataSource = objResult.resultDT; gvSchool.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>"); } }
private void GridDataBind() { try { lblMsg.Visible = false; SchoolBL objSchoolBL = new SchoolBL(); ApplicationResult objResult = new ApplicationResult(); objResult = objSchoolBL.School_SelectAll(Convert.ToInt32(Session[ApplicationSession.TRUSTID])); if (objResult != null) { DataTable dtCollege = new DataTable(); dtCollege = objResult.resultDT; if (dtCollege.Rows.Count > 0) { grCollDetails.DataSource = dtCollege; grCollDetails.DataBind(); } else { lblMsg.Visible = true; lblMsg.Text = "No School Added"; } } } 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>"); } }
private void BindSchool() { SchoolBL objSchoolBL = new SchoolBL(); Controls objControls = new Controls(); ApplicationResult objResults = new ApplicationResult(); objResults = objSchoolBL.School_SelectAll(Convert.ToInt32(Session[ApplicationSession.TRUSTID])); if (objResults != null) { if (objResults.resultDT.Rows.Count > 0) { objControls.BindDropDown_ListBox(objResults.resultDT, ddlSchool, "SchoolNameEng", "SchoolMID"); } ddlSchool.Items.Insert(0, new ListItem("-Select-", "")); } }
public void BindSchool() { var objSchoolBl = new SchoolBL(); var objResult = objSchoolBl.School_SelectAll(Convert.ToInt32(ddlTrust.SelectedValue)); if (objResult == null) { return; } if (objResult.resultDT.Rows.Count <= 0) { return; } _objControl.BindDropDown_ListBox(objResult.resultDT, ddlSchool, "SchoolNameEng", "SchoolMID"); ddlSchool.Items.Insert(0, new ListItem("--Select--", "")); }
protected void btnSave_Click(object sender, EventArgs e) { try { RoleRightsBO objRoleRightsBO = new RoleRightsBO(); RoleRightsBL objRoleRightsBL = new RoleRightsBL(); ApplicationResult objResultsInsert = new ApplicationResult(); ApplicationResult objResultsSelect = new ApplicationResult(); ApplicationResult objResultsDelete = new ApplicationResult(); DataTable dtRoleRights = new DataTable(); int j = 0; CheckBox chk; for (int i = 0; i < gvSelectRights.Rows.Count; i++) { objResultsSelect = objRoleRightsBL.RoleRights_T_Select(Convert.ToInt32(ddlRole.SelectedValue), Convert.ToInt32(Session[ApplicationSession.TRUSTID]), 0, Convert.ToInt32(gvSelectRights.Rows[i].Cells[0].Text)); chk = (CheckBox)gvSelectRights.Rows[i].Cells[2].FindControl("chkRights"); if (chk.Checked == true) { if (rblSelect.SelectedValue == "0") { if (objResultsSelect != null) { if (objResultsSelect.resultDT.Rows.Count > 0) { } else { objRoleRightsBO.RoleID = Convert.ToInt32(ddlRole.SelectedValue); objRoleRightsBO.TrustMID = Convert.ToInt32(Session[ApplicationSession.TRUSTID]); objRoleRightsBO.SchoolMID = 0; objRoleRightsBO.ScreenID = Convert.ToInt32(gvSelectRights.Rows[i].Cells[0].Text); objResultsInsert = objRoleRightsBL.RoleRights_Insert(objRoleRightsBO); if (Convert.ToInt32(gvSelectRights.Rows[i].Cells[1].Text) == 1) { ApplicationResult objResults = new ApplicationResult(); SchoolBL objSchool = new SchoolBL(); objResults = objSchool.School_SelectAll(Convert.ToInt32(Session[ApplicationSession.TRUSTID])); if (objResults != null) { if (objResults.resultDT.Rows.Count > 0) { foreach (DataRow dt in objResults.resultDT.Rows) { objRoleRightsBO.RoleID = Convert.ToInt32(ddlRole.SelectedValue); objRoleRightsBO.TrustMID = Convert.ToInt32(Session[ApplicationSession.TRUSTID]); objRoleRightsBO.SchoolMID = Convert.ToInt32(dt[0].ToString()); objRoleRightsBO.ScreenID = Convert.ToInt32(Convert.ToInt32(gvSelectRights.Rows[i].Cells[0].Text)); objResultsInsert = objRoleRightsBL.RoleRights_Insert(objRoleRightsBO); } } } } } } } else { objRoleRightsBO.RoleID = Convert.ToInt32(ddlRole.SelectedValue); objRoleRightsBO.TrustMID = Convert.ToInt32(Session[ApplicationSession.TRUSTID]); objRoleRightsBO.SchoolMID = Convert.ToInt32(ViewState["SchoolMID"].ToString()); objRoleRightsBO.ScreenID = Convert.ToInt32(Convert.ToInt32(gvSelectRights.Rows[i].Cells[0].Text)); objResultsInsert = objRoleRightsBL.RoleRights_Insert(objRoleRightsBO); } } else { if (rblSelect.SelectedValue == "0") { dtRoleRights = objResultsSelect.resultDT; if (objResultsSelect.resultDT.Rows.Count > 0) { objResultsDelete = objRoleRightsBL.RoleRights_Delete(Convert.ToInt32(ddlRole.SelectedValue), Convert.ToInt32(Session[ApplicationSession.TRUSTID]), 0, Convert.ToInt32(gvSelectRights.Rows[i].Cells[0].Text)); } } else { objResultsDelete = objRoleRightsBL.RoleRights_Delete(Convert.ToInt32(ddlRole.SelectedValue), Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(ViewState["SchoolMID"].ToString()), Convert.ToInt32(gvSelectRights.Rows[i].Cells[0].Text)); } } } if (objResultsInsert.status == ApplicationResult.CommonStatusType.SUCCESS) { ClearAll(); BindScreen(); lblMsg.Visible = true; lblMsg.Text = "Roles Applied Successfully"; } //objResultsSelect = objRoleRightsBL.RoleRights_Select(Convert.ToInt32(ddlRole.SelectedValue), Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(ViewState["SchoolMID"].ToString())); //if (objResultsSelect != null) //{ // dtRoleRights = objResultsSelect.resultDT; // if (dtRoleRights.Rows.Count > 0) // { // // objResultsDelete = objRoleRightsBL.RoleRights_Delete(Convert.ToInt32(ddlRole.SelectedValue), Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(ViewState["SchoolMID"].ToString())); // } //} //for (int i = 0; i < gvSelectRights.Rows.Count; i++) //{ // chk = (CheckBox)gvSelectRights.Rows[i].Cells[2].FindControl("chkRights"); // if (chk.Checked == true) // { // objRoleRightsBO.RoleID = Convert.ToInt32(ddlRole.SelectedValue); // objRoleRightsBO.TrustMID = Convert.ToInt32(Session[ApplicationSession.TRUSTID]); // objRoleRightsBO.SchoolMID = Convert.ToInt32(ViewState["SchoolMID"].ToString()); // objRoleRightsBO.ScreenID = Convert.ToInt32(gvSelectRights.Rows[i].Cells[1].Text); // objResultsInsert = objRoleRightsBL.RoleRights_Insert(objRoleRightsBO); // } //} // } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical Problem. Contact to your Administrator.');</script>"); } }