protected void Page_Load(object sender, EventArgs e) { string msg = Request.QueryString["Message"]; LoggedIn master = (LoggedIn)this.Master; master.ShowMessage(msg, false); LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { // return to login page because user has not loggedin or session has timedout... Response.Redirect("~/Login.aspx"); } if (Session["QuestId"] != null) { Response.Redirect("~/QuestAns/QA_QuestWithAns.aspx"); } if (!IsPostBack) { setBreadCrumb(); hdnbtnQueryId.Value = "1"; hdnbtnKOId.Value = "4"; ChangeKOButtonBackColor(Convert.ToInt32(hdnbtnKOId.Value)); ChangeQueryButtonBackColor(Convert.ToInt32(hdnbtnQueryId.Value)); ddlPageSize.Text = KODataPager.PageSize.ToString(); ddlPageSizeQuery.Text = QueryDataPager.PageSize.ToString(); bindLVKO(); bindLVQuery(); } //CultureInfo ci = new CultureInfo("en-US"); //if (!IsPostBack) //??? //{ // HomePageSetUpBAL setupBAL = new HomePageSetUpBAL(); // DataTable dt = new DataTable(); // if (setupBAL.DisplayHomePage(ref dt)) // { // string s = dt.Rows[0]["Pagehtml"].ToString(); // pnl.InnerHtml = HttpUtility.HtmlDecode(s); // //???divOutput.InnerText = s; // DateTime time = DateTime.Now; // string format = "dd (ddd) MM (MMM) yyyy - HH:mm "; // divOutput.InnerHtml = "<b>" + (time.ToString(format, ci)) + "</b><br/><br/>"; // } //} }
private bool ValidData() { if (txtRoleShortDesc.Text == "" || txtRoleLongDesc.Text == "") { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Every Field must be filled.", false); return(true); } else { return(false); } }
private bool ValidData() { if (txtUserName.Text == "" || txtFName.Text == "" || txtLName.Text == "" || txtPREmailId.Text == "" || txtSecretAns.Text == "" || txtPass.Text == "") { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Fields which are marked as (*) are mandatory.", false); return(true); } else { return(false); } }
//protected void LvRoleItems_Canceling(object sender, ListViewCancelEventArgs e) //{ // LvRoleItems.EditIndex = -1; // bind(); // recalcNoOfPages(); //} protected void LvRoleItems_ItemEditing(object sender, ListViewEditEventArgs e) { // Check if user has access right to perform the update/modify function if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "edit")) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false); e.Cancel = true; return; } //LvRoleItems.EditIndex = e.NewEditIndex; //bind(); //recalcNoOfPages(); }
private void bind() { RoleBAL roleBAL = new RoleBAL(); DataTable dt = new DataTable(); if (roleBAL.GetAllRoleDetails(ref dt)) { this.LvRoleItems.DataSource = dt; LvRoleItems.DataBind(); } else { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Unsuccessful", false); } }
protected void btnSave_Click(object sender, EventArgs e) { if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "add")) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false); return; } RoleAccessRightsBAL roleAccessBAL = new RoleAccessRightsBAL(); RoleAccessRightsBE roleAccessBE = new RoleAccessRightsBE(); // roleAccessBE = loadRoleAccessRightsBE(roleAccessBE); roleAccessBE.RoleID = Convert.ToInt32(ddlRoleId.SelectedValue); roleAccessBE.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId; loadRoleAccessRightsBE(roleAccessBE); }
private void loadRoleAccessRightsBE(RoleAccessRightsBE roleAccessBE) { int a = 0; int count = 0; RoleAccessRightsBAL RACBAL = new RoleAccessRightsBAL(); for (int iRow = 0; iRow < lvRoleAccessRight.Items.Count; iRow++) { for (int iCell = 5; iCell < lvRoleAccessRight.Items[0].Controls.Count - 1; iCell += 2) { roleAccessBE.PRAId = Convert.ToInt32(lvRoleAccessRight.DataKeys[iRow].Value.ToString()); if (((CheckBox)lvRoleAccessRight.Items[iRow].Controls[iCell]).Checked) { a = 1; } else { a = 0; } AssignValueRoleAccessRightsBE(iCell, ref roleAccessBE, a); } if (RACBAL.SaveRoleAccessRightDetails(roleAccessBE)) { count = count + 1; if (count == lvRoleAccessRight.Items.Count) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Role Successfully Updated.", true); } } else { count = count + 1; if (count == lvRoleAccessRight.Items.Count) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Unsuccessful", false); } } } }
private void bindlvRoleMember() { RoleMemberBE roleMember = new RoleMemberBE(); RoleMemberBAL roleMemberBAL = new RoleMemberBAL(); DataTable dt = new DataTable(); roleMember.RoleId = Convert.ToInt32(hdnRoleId.Value.ToString()); if (roleMemberBAL.GetAllRoleMembers(ref dt, ref roleMember)) { this.lvRoleMember.DataSource = dt; lvRoleMember.Visible = true; RoleMemberDataPager.Visible = true; lvRoleMember.DataBind(); recalcNoOfPages(); } else { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Unsuccessful", false); } }
protected void btnAddRole_Click(object sender, EventArgs e) { if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "add")) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("You are not authorised to Perform any operation on this page. Please contact system administrator.", false); // Server.Transfer("UM_BlankPage.aspx"); //?? send Message through Query String to the BlankPage // string cat = Request.QueryString["Message"]; // Response.Redirect("UM_BlankPage.aspx?Message=You are not authorised to Perform any operation on this page. Please contact system administrator."); return; } if (ValidData()) { } else { UserBE user = (UserBE)Session["LoggedInUser"]; RoleBE addRoleBE = new RoleBE(); RoleDAL addRoleDal = new RoleDAL(); RoleBAL addRoleBal = new RoleBAL(); addRoleBE.RoleShortDesc = txtRoleShortDesc.Text; addRoleBE.RoleLongDesc = txtRoleLongDesc.Text; addRoleBE.LastModifiedBy = user.UserId; if (addRoleBal.AddRole(addRoleBE)) { txtRoleShortDesc.Text = ""; txtRoleLongDesc.Text = ""; LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Record Inserted Successfully.", true); } else { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Unsuccessful.", false); } } }
protected void LvRoleItems_ItemDeleting(object sender, ListViewDeleteEventArgs e) { if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "delete")) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false); e.Cancel = true; return; } //string confirmValue = Request.Form["confirm_value"]; //if (confirmValue == "Yes") //{ // RoleBE role = new RoleBE(); // RoleBAL roleBAL = new RoleBAL(); // string RoleId = LvRoleItems.DataKeys[e.ItemIndex].Value.ToString(); // role.RoleId = Convert.ToInt32(RoleId); // if (roleBAL.DeleteRole(role)) // { // LvRoleItems.EditIndex = -1; // bind(); // LoggedIn master = (LoggedIn)this.Master; // master.ShowMessage("Record Successfully deleted.", true); // } // else // { // LoggedIn master = (LoggedIn)this.Master; // master.ShowMessage("Unsuccessful", false); // } //} //else //{ //} //recalcNoOfPages(); }
private void bindListView() { RoleMemberBE roleMember = new RoleMemberBE(); RoleAccessRightsBAL roleAccessBAL = new RoleAccessRightsBAL(); DataTable dt = new DataTable(); roleMember.RoleId = Convert.ToInt32(hdnRoleId.Value.ToString()); if (roleAccessBAL.GetAllRoleAccessRightDetails(ref dt, ref roleMember)) { this.lvRoleAccessRight.DataSource = dt; lvRoleAccessRight.Visible = true; RoleAccessRightDataPager.Visible = true; btnSave.Visible = true; ddlPageSize.Visible = true; lblSelect.Visible = true; lvRoleAccessRight.DataBind(); recalcNoOfPages(); } else { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Unsuccessful", false); } }
protected void Page_Load(object sender, EventArgs e) { LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { // return to login page because user has not loggedin or session has timedout... Response.Redirect("~/Login.aspx"); } if (!commonBAL.isPageAccessibleToUser(LoggedInUser.UserId, thisPageName)) { LoggedIn master = (LoggedIn)this.Master; // master.ShowMessage("You are not authorised to access this page. Please contact system administrator.", false); // Server.Transfer("UM_BlankPage.aspx"); //?? send Message through Query String to the BlankPage string msg = Request.QueryString["Message"]; Server.Transfer("LoggedInHome.aspx?Message=You are not authorised to access this page. Please contact system administrator."); return; } else { setBreadCrumb(); } }
protected void LvRoleItems_OnItemCommand(object sender, ListViewCommandEventArgs e) { UM_UC_RoleAdd roleAdd = new UM_UC_RoleAdd(); HtmlTableRow SelectedRow; if (e.Item.DisplayIndex % 2 == 0) //even { SelectedRow = e.Item.FindControl("trItemTemplate") as HtmlTableRow; } else //odd { SelectedRow = e.Item.FindControl("trAltItemTemplate") as HtmlTableRow; } SelectedRow.BgColor = "Red"; if (String.Equals(e.CommandName, "Delete")) { if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "delete")) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false); return; } RoleBE role = new RoleBE(); string[] arg = new string[3]; arg = e.CommandArgument.ToString().Split(','); hdnRoleId.Value = arg[0].ToString(); role.RoleShortDesc = arg[1].ToString(); role.RoleLongDesc = arg[2].ToString(); RoleShortDescText.Text = role.RoleShortDesc; RoleLongDescText.Text = role.RoleLongDesc; mpe_DeleteRole.Show(); } if (String.Equals(e.CommandName, "Edit")) { if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "edit")) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false); return; } RoleBE role = new RoleBE(); string[] arg = new string[5]; arg = e.CommandArgument.ToString().Split(','); hdnRoleUpdateId.Value = arg[0].ToString(); role.RoleShortDesc = arg[1].ToString(); role.RoleLongDesc = arg[2].ToString(); string lastModifiedBy = arg[3].ToString(); string lastModifiedAt = arg[4].ToString(); UCRoleAddList.RoleId = Convert.ToInt32(hdnRoleUpdateId.Value); UCRoleAddList.ShortDesc = role.RoleShortDesc; UCRoleAddList.LongDesc = role.RoleLongDesc; UCRoleAddList.LastModifiedBy = lastModifiedBy; UCRoleAddList.LastModifiedAt = lastModifiedAt; mpe_EditRole.Show(); } }