protected void btnLogin_Click(object sender, EventArgs e) { //Activate the message if login is failed lblMessage.Visible = true; AppSecurity temp = new AppSecurity(); temp = AppSecurity.login(txtUsername.Text, txtPassword.Text); if (!string.IsNullOrEmpty(txtUsername.Text) & !string.IsNullOrEmpty(txtPassword.Text)) { //set string value to class function that returns string temp = AppSecurity.login(txtUsername.Text.Trim(), txtPassword.Text.Trim()); } else { lblMessage.Text = temp.ErrorLogin.ToString(); return; } if (temp.UserId > 0) { // Use .NET built in security system to set the UserID //within a client-side Cookie FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(temp.UserId.ToString(), false, 480); //For security reasons we may hash the cookies string encrytpedTicket = FormsAuthentication.Encrypt(ticket); HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encrytpedTicket); Response.Cookies.Add(cookie); //set the username to a client side cookie for future reference HttpCookie MyCookie = new HttpCookie("UserEmail"); DateTime now = DateTime.Now; MyCookie.Value = temp.UserEmail.ToString(); MyCookie.Expires = now.AddDays(1); Response.Cookies.Add(MyCookie); //set the userrole to a session variable for future reference Session["Role"] = temp.UserRole.ToString(); // Redirect browser back to home page Response.Redirect("~/Default.aspx"); } else { //or else display the failed login message lblMessage.Text = "Login Failed!"; } }
protected void btnStudentName_Click(object sender, EventArgs e) { try { LinkButton btnStudentName = (LinkButton)sender; int StudentID = int.Parse(btnStudentName.CommandArgument.ToString()); Response.Redirect("ViewUserDetails.aspx?Type=E&" + AppSecurity.Encrypt("StudentID=" + StudentID), false); } catch (Exception Ex) { throw Ex; } }
public ActionResult LogOff() { //var person = AppSecurity.GetUserByUsername(User.Identity.Name); var person = _personService.GetAll(HotelID).FirstOrDefault(x => x.Username.ToUpper() == User.Identity.Name.ToUpper()); if (person.PersonTypeId == (int)PersonTypeEnum.Guest || person.PersonTypeId == (int)PersonTypeEnum.Admin) { if (person != null) { person.Salary = decimal.Zero; _personService.Update(person); } AppSecurity.Logout(); FormsAuthentication.SignOut(); if (IsSelfServiceCentre()) { return(RedirectToAction("SelfService", "Account")); } return(RedirectToAction("NewLogOff")); } var unclearedItems = _tableItemService.GetAll().Where(x => x.Cashier == person.PersonID).Count(); var personModel = new PersonViewModel(); personModel.CanCloseTill = true; if (unclearedItems > 0) { personModel.CanCloseTill = false; } if (person != null) { personModel.TotalHotelRecievable = person.GetTotalHotelRecievable(DateTime.Today); personModel.TotalBarRecievable = person.GetTotalBarRecievable(DateTime.Today); personModel.TotalSales = personModel.TotalHotelRecievable + personModel.TotalBarRecievable; personModel.UserName = person.Username; personModel.Password = person.Password; } return(View(personModel)); }
protected void btChangeProfSave_Click(object sender, EventArgs e) { hfTab.Value = "home"; Employee emp = new Employee(); emp.EmployeeId = Session["EmployeeId"].ToString(); emp.FirstName = tbFirstName.Text; emp.LastName = tbLastName.Text; emp.Email = tbEmailId.Text; string pass = tbChangeProfPass.Text; string hashedPassword = AppSecurity.HashSHA1(pass + Session["USER_GUID"].ToString()); DataAccessLayer dal = new DataAccessLayer(); int? ret = dal.UpdateAccountInfo(emp, hashedPassword); switch (ret) { case 1: { // update session information Session["FirstName"] = emp.FirstName; Session["LastName"] = emp.LastName; Session["EMAIL"] = emp.Email; ((Label)Master.FindControl("lbUserName")).Text = emp.FirstName + " " + emp.LastName; //show success message editAlert.Style.Add("display", "inline"); editAlert.Attributes.Add("class", "alert-success"); editAlert.InnerText = "Account Information Successfully Updated"; } break; case -1: { //invalid password editAlert.Style.Add("display", "inline"); editAlert.Attributes.Add("class", "alert-danger"); editAlert.InnerText = "Incorrect Password"; } break; case 0: { //invalid password editAlert.Style.Add("display", "inline"); editAlert.Attributes.Add("class", "alert-danger"); editAlert.InnerText = "Database Error Occured. Information could not be saved."; } break; } }
private void ApplySecurityToControl() { DataSet ds = dsGetAssetInfo(); if (ds.Tables[0].Rows.Count > 0) { string site_code = ds.Tables[0].Rows[0]["Asset_Site_Code"].ToString(); btnAddTamper.Attributes[AppSecurity.SECURITY_SITE_CODE] = site_code; btnSaveManagePropertiesModal.Attributes[AppSecurity.SECURITY_SITE_CODE] = site_code; AppSecurity.Apply_CAIRS_Security_To_Single_Control(btnAddTamper); AppSecurity.Apply_CAIRS_Security_To_Single_Control(btnSaveManagePropertiesModal); } }
protected void gvExamDetails_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (e.CommandName.ToString() == "EditExam") { Response.Redirect("ViewExamDetails.aspx?ExamID=" + AppSecurity.Encrypt(e.CommandArgument.ToString()) + "&Type=Edit"); } else if (e.CommandName.ToString() == "ViewExam") { Response.Redirect("ViewExamDetails.aspx?ExamID=" + AppSecurity.Encrypt(e.CommandArgument.ToString()) + "&Type=View"); } else if (e.CommandName.ToString() == "DeleteExam") { Response.Redirect("ViewExamDetails.aspx?ExamID=" + AppSecurity.Encrypt(e.CommandArgument.ToString()) + "&Type=Delete"); } }
private void ApplySecurityToControl() { DataSet ds = DatabaseUtilities.DsGetAssetInfoByID(QS_ASSET_ID); if (ds.Tables[0].Rows.Count > 0) { string site_code = ds.Tables[0].Rows[0]["Asset_Site_Code"].ToString(); btnAddComment.Attributes[AppSecurity.SECURITY_SITE_CODE] = site_code; btnSaveComment.Attributes[AppSecurity.SECURITY_SITE_CODE] = site_code; AppSecurity.Apply_CAIRS_Security_To_Single_Control(btnAddComment); AppSecurity.Apply_CAIRS_Security_To_Single_Control(btnSaveComment); } }
protected void gvExamStatus_ItemCommand(object sender, GridCommandEventArgs e) { try { if (e.CommandName.ToString() == "ViewVideo") { Response.Redirect("ExamDetails.aspx?TransID=" + AppSecurity.Encrypt(e.CommandArgument.ToString()) + "&Type=ViewDetails", false); //Response.Redirect("ExamDetails.aspx?mode=old&TransID=" + AppSecurity.Encrypt(e.CommandArgument.ToString()) + "&Type=ViewDetails", false); } } catch (Exception) { //ErrorLog.WriteError(Ex); } }
protected void lblStudentName_Click(object sender, EventArgs e) { try { LinkButton lblStudentName = (LinkButton)sender; int StudentID = int.Parse(lblStudentName.CommandArgument.ToString()); Session[BaseClass.EnumPageSessions.StudentID] = StudentID; Response.Redirect("ViewStudentDetails.aspx?Type=P&" + AppSecurity.Encrypt("StudentID=" + StudentID), false); } catch (Exception Ex) { throw Ex; } }
protected void Page_Load(object sender, EventArgs e) { try { img.Visible = false; imgBack.Visible = true; ((LinkButton)this.Page.Master.FindControl("lnkAutoProctor")).CssClass = "main_menu_active"; this.Page.Title = EnumPageTitles.APPNAME + EnumPageTitles.AUDITOR_CONFIRMATION; BECommon objBECommon = new BECommon(); BCommon objBCommon = new BCommon(); if (Request.QueryString["TransID"] != null) { ViewState[BaseClass.EnumPageSessions.TransID] = Convert.ToInt64(AppSecurity.Decrypt(Request.QueryString["TransID"].ToString())); objBECommon.IntTransID = Convert.ToInt32(AppSecurity.Decrypt(Request.QueryString["TransID"].ToString())); objBECommon.IntUserID = Convert.ToInt32(Session[BaseClass.EnumPageSessions.USERID]); objBECommon.Struserlogin = Session["EmailID"].ToString(); objBCommon.BGetStudentExamDetails(objBECommon); if (objBECommon.DsResult.Tables[0] != null) { if (objBECommon.DsResult.Tables[0].Rows.Count > 0) { lblTransactionID.Text = AppSecurity.Decrypt(Request.QueryString["TransID"].ToString()); lblStudentName.Text = objBECommon.DsResult.Tables[0].Rows[0]["Name"].ToString(); lblcoursename.Text = objBECommon.DsResult.Tables[0].Rows[0]["CourseName"].ToString(); lblexamname.Text = objBECommon.DsResult.Tables[0].Rows[0]["ExamName"].ToString(); lblDAte.Text = objBECommon.DsResult.Tables[0].Rows[0]["ExamDate"].ToString(); lblSlot.Text = objBECommon.DsResult.Tables[0].Rows[0]["TimeDuration"].ToString(); if (Request.QueryString["type"].ToString() == "1") { lblHead.Text = "Approved Exam Details"; imgConfirm.Visible = true; } else { lblHead.Text = "Rejected Exam Details"; //btnReject.Visible = true; } } } } } catch (Exception) { } }
protected void GetReportsData() { try { int intReportType = Convert.ToInt32(AppSecurity.Decrypt(Request.QueryString["ReportTypeID"].ToString())); BECommon objBECommon = new BECommon(); BCommon objBCommon = new BCommon(); objBECommon.IntRoleID = Convert.ToInt32(Session["RoleID"]); if (intReportType == 1) { if (dtpstartdate.SelectedDate != null) { objBECommon.DateStartDate = Convert.ToDateTime(dtpstartdate.SelectedDate); } if (dtpEnddate.SelectedDate != null) { objBECommon.DateEndDate = Convert.ToDateTime(dtpEnddate.SelectedDate); } } else { objBECommon.strCourseName = txtCourseName.Text.ToString(); objBECommon.strExamName = txtExamName.Text.ToString(); objBECommon.StrFirstName = txtFirstName.Text.ToString(); objBECommon.StrLastName = txtLastName.Text.ToString(); } objBECommon.iReportID = Convert.ToInt32(AppSecurity.Decrypt(Request.QueryString["ReportID"].ToString())); objBECommon.IntUserID = Convert.ToInt32(Session[EnumPageSessions.USERID]); objBECommon.intReportTypeID = intReportType; objBCommon.BGetSelectedReport(objBECommon); if (objBECommon.DtResult != null && objBECommon.DtResult.Rows.Count > 0) { gvReports.DataSource = objBECommon.DtResult; trExportButtons.Visible = true; trGridView.Visible = true; } else { gvReports.DataSource = new Object[0]; trExportButtons.Visible = false; trGridView.Visible = true; } } catch (Exception Ex) { throw Ex; } }
protected void GetAllRules() { BECommon objBECommon = new BECommon(); BCommon objBCommon = new BCommon(); objBECommon.iID = Convert.ToInt64(AppSecurity.Decrypt(Request.QueryString["TransID"].ToString())); objBECommon.iTypeID = 1; objBECommon.StrFromPage = "STUDENT"; objBCommon.BGetExamRulesInformation(objBECommon); if (objBECommon.DsResult != null && objBECommon.DsResult.Tables.Count > 0 && objBECommon.DsResult.Tables[0].Rows.Count > 0) { gvStandard.DataSource = objBECommon.DsResult.Tables[0]; gvStandard.DataBind(); } else { gvStandard.DataSource = new string[] { } }; //Additional Rules if (objBECommon.DsResult != null && objBECommon.DsResult.Tables.Count > 0 && objBECommon.DsResult.Tables[1].Rows.Count > 0) { gvAllowed.DataSource = objBECommon.DsResult.Tables[1]; gvAllowed.DataBind(); } else { gvAllowed.DataSource = new string[] { }; gvAllowed.DataBind(); trAllowed.Style.Add("display", "none"); } //Special Instructions if (objBECommon.DsResult != null && objBECommon.DsResult.Tables.Count > 0 && objBECommon.DsResult.Tables[2].Rows.Count > 0) { gvSpecialInstructions_Student.DataSource = objBECommon.DsResult.Tables[2]; gvSpecialInstructions_Student.DataBind(); } else { gvSpecialInstructions_Student.DataSource = new string[] { }; gvSpecialInstructions_Student.DataBind(); trSpecialStudent.Style.Add("display", "none"); } }
protected void ButtonLogin_Click(object sender, EventArgs e) { string sql = "SELECT email, nombre, apellidos, tipo " + "FROM Usuarios " + "WHERE email = @email " + "AND pass = @password"; byte[] hashedPass = AppSecurity.GenerateHash(textBoxPassword.Text); Dictionary <string, object> parameters = new Dictionary <string, object> { { "@email", textBoxEmail.Text }, { "@password", hashedPass } }; try { QueryResult queryResult = DataAccess.Query(sql, parameters); if (queryResult.Rows.Count != 1) { Debug.WriteLine("Wrong credentials"); } else { Session["IsLogged"] = true; string email = Convert.ToString(queryResult.Rows[0]["email"]); Session["Email"] = email; Session["Name"] = queryResult.Rows[0]["nombre"]; Session["LastName"] = queryResult.Rows[0]["apellidos"]; string tipo = Convert.ToString(queryResult.Rows[0]["tipo"]); Session["UserType"] = GetUserTypeName(email, tipo); FormsAuthentication.SetAuthCookie(Session["UserType"].ToString(), true); AddConnectedUsers(Session["UserType"].ToString(), email); Response.Redirect(AppConfig.WebSite.MainPage); } } catch (Exception ex) { Debug.WriteLine("Exception caught: " + ex.Message); NotificationData data = new NotificationData { Title = "Exception caught", Body = $"Could not perform the login correctly.", Level = AlertLevel.Danger, Dismissible = true }; Master.UserNotification.ShowNotification(data); } }
private void LoadBinDetails() { string binID = hdnBinID.Value; DataSet ds = DatabaseUtilities.DsGetByTableColumnValue(Constants.DBNAME_ASSET_TRACKING, Constants.DB_VIEW_BIN, "Bin_ID", binID, ""); Utilities.DataBindForm(divBinInfo, ds); //Apply security to save button btnSaveBin.Enabled = true; if (ds.Tables[0].Rows.Count > 0) { btnSaveBin.Attributes[AppSecurity.SECURITY_SITE_CODE] = ds.Tables[0].Rows[0]["Site_Code"].ToString(); AppSecurity.Apply_CAIRS_Security_To_Single_Control(btnSaveBin); } }
protected void hplnkScheduledAppointments_Click(object sender, EventArgs e) { LinkButton lnkSch = (LinkButton)sender; string[] ids = lnkSch.CommandArgument.ToString().Split(','); string courseId = ids[0]; string examId = ids[1]; string URL = "AppointmentDetails.aspx?sch=" + AppSecurity.Encrypt("true") + "&cid=" + AppSecurity.Encrypt(courseId) + "&eid=" + AppSecurity.Encrypt(examId); ScriptManager.RegisterStartupScript(up, up.GetType(), "alert", "window.open('" + URL + "','_newtab');", true); //Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('"+URL+"','_newtab');", true); //Response.Redirect("AppointmentDetails.aspx?sch=" + AppSecurity.Encrypt("true") + "&cid=" + AppSecurity.Encrypt(courseId) + "&eid=" + AppSecurity.Encrypt(examId), false); }
protected void dgAssetBin_ItemDataBound(object sender, DataGridItemEventArgs e) { Button btn = e.Item.FindControl("btnUnassignFromBin") as Button; if (btn != null) { AppSecurity.Apply_CAIRS_Security_To_Single_Control(btn); } CheckBox chk = e.Item.FindControl("chkAsset") as CheckBox; if (chk != null) { AppSecurity.Apply_CAIRS_Security_To_Single_Control(chk); } }
public bool ValidateUser(string username, string password) { if (String.IsNullOrEmpty(username) || String.IsNullOrEmpty(password)) { return(false); } var user = _userRepo.FindByUserName(username); if (user == null) { return(false); } return(AppSecurity.VerifyPasswords(password, user.Password)); }
protected void gvAuditorInbox_ItemCommand(object sender, GridCommandEventArgs e) { try { if (e.CommandName.ToString() == "ViewVideo") { Response.Redirect("ExamDetails.aspx?TransID=" + AppSecurity.Encrypt(e.CommandArgument.ToString()), false); // Response.Redirect("ExamDetails.aspx?mode=old&TransID=" + AppSecurity.Encrypt(e.CommandArgument.ToString()), false); } } catch (Exception Ex) { throw Ex; } }
protected void btnBack_Click(object sender, EventArgs e) { string backstatus = ""; if (Request.QueryString["status"] != null && Request.QueryString["status"].ToString() != string.Empty) { backstatus = Request.QueryString["status"].ToString(); Response.Redirect("StudentLookUp.aspx?TransID=" + AppSecurity.Encrypt(ViewState[BaseClass.EnumPageSessions.TransID].ToString()) + "&status=" + backstatus + "", false); } else { Response.Redirect("StudentLookUp.aspx?TransID=" + AppSecurity.Encrypt(ViewState[BaseClass.EnumPageSessions.TransID].ToString()), false); } // Response.Redirect("ExamDetails.aspx?TransID=" + AppSecurity.Encrypt(transID.ToString()), false); }
private void Apply_CAIRS_To_Pages() { //Current Page string current_page_name = Path.GetFileName(Request.Path); //need to append addition string before comparing to match correctly. string prefix = "/Pages/"; current_page_name = prefix + current_page_name; //Get the logged on user access level to process int iUserAccessLevel = AppSecurity.Current_User_Access_Level(); switch (current_page_name) { //Manage Asset Site Bin case Constants.PAGES_ADD_BIN_PAGE: //Access denied for read only user and below if (iUserAccessLevel.Equals(AppSecurity.ROLE_READ_ONLY)) { Unauthorized_Access(""); } break; case Constants.PAGES_CHECK_OUT_ASSET_PAGE: case Constants.PAGES_ASSET_FOLLOW_UP_PAGE: //Access denided for read only and director role if (iUserAccessLevel.Equals(AppSecurity.ROLE_READ_ONLY) || iUserAccessLevel.Equals(AppSecurity.ROLE_DIRECTOR)) { Unauthorized_Access(""); } break; case Constants.PAGES_ADD_ASSET_PAGE: case Constants.PAGES_CHECK_IN_ASSET_PAGE: //Access denied for Site Staff user and below if (iUserAccessLevel <= AppSecurity.ROLE_SITE_STAFF) { Unauthorized_Access(""); } break; default: break; } }
protected void GetStudentDeetails() { BEAdmin objBEAdmin = new BEAdmin(); BAdmin objBAdmin = new BAdmin(); objBEAdmin.IntStudentID = Convert.ToInt32(AppSecurity.Decrypt(Request.QueryString["UserID"].ToString())); objBAdmin.BViewStudentDetails(objBEAdmin); if (objBEAdmin.DtResult != null) { if (objBEAdmin.DtResult.Rows.Count > 0) { this.BindTimeZone(objBEAdmin.IntStudentID); lblFirstName.Text = objBEAdmin.DtResult.Rows[0]["FirstName"].ToString(); txtFirstName.Text = objBEAdmin.DtResult.Rows[0]["FirstName"].ToString(); lblLastName.Text = objBEAdmin.DtResult.Rows[0]["LastName"].ToString(); txtStudentLastName.Text = objBEAdmin.DtResult.Rows[0]["LastName"].ToString(); lblEmailAddress.Text = objBEAdmin.DtResult.Rows[0]["EmailAddress"].ToString(); txtEmailAddress.Text = objBEAdmin.DtResult.Rows[0]["EmailAddress"].ToString(); lblPhoneNumber.Text = objBEAdmin.DtResult.Rows[0]["PhoneNumber"].ToString(); txtPhoneNumber.Text = objBEAdmin.DtResult.Rows[0]["PhoneNumber"].ToString(); lblTimeZone.Text = objBEAdmin.DtResult.Rows[0]["TimeZone"].ToString(); lblSpecialNeeds.Text = objBEAdmin.DtResult.Rows[0]["SpecialNeeds"].ToString(); // lblComments.Text = objBEAdmin.DtResult.Rows[0]["Comments"].ToString(); // txtcomments.Value = objBEAdmin.DtResult.Rows[0]["Comments"].ToString(); string SpecialNeeds = objBEAdmin.DtResult.Rows[0]["SpecialNeeds"].ToString(); if (SpecialNeeds == "Yes") { trcomments.Visible = true; if (objBEAdmin.DtResult.Rows[0]["Comments"] != DBNull.Value) { lblComments.Text = objBEAdmin.DtResult.Rows[0]["Comments"].ToString(); txtcomments.Value = objBEAdmin.DtResult.Rows[0]["Comments"].ToString(); } ddlSpecialNeeds.SelectedValue = "1"; } else if (SpecialNeeds == "No") { trcomments.Visible = false; ddlSpecialNeeds.SelectedValue = "0"; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BECommon objBECommon = new BECommon(); BCommon objBCommon = new BCommon(); objBECommon.iTimeZoneID = Convert.ToInt32(Session["TimeZoneID"].ToString()); objBCommon.BGetTimeDelay(objBECommon); dtpstartdate.SelectedDate = DateTime.UtcNow.AddMinutes(objBECommon.IntResult); dtpEnddate.SelectedDate = DateTime.UtcNow.AddMinutes(objBECommon.IntResult); btnInvoice.Visible = false; string monthselect = DateTime.Today.Month.ToString(); string yrselect = DateTime.Today.Year.ToString(); ddlMonths.FindItemByValue(monthselect).Selected = true; ddlYear.FindItemByText(yrselect).Selected = true; } this.Page.Title = EnumPageTitles.APPNAME + EnumPageTitles.EXAMPROVIDER_EXAMPROVIDERREPORTS; ((LinkButton)this.Page.Master.FindControl("lnkReports")).CssClass = "main_menu_active"; if (Request.QueryString != null && Request.QueryString.ToString() != null) { int intReportID = Convert.ToInt32(AppSecurity.Decrypt(Request.QueryString["ReportID"].ToString())); int intTypeID = Convert.ToInt32(AppSecurity.Decrypt(Request.QueryString["ReportTypeID"].ToString())); if (intTypeID == 1) { trSearchCriteria1.Visible = true; trSearchCriteria2.Visible = false; trSearchCriteria3.Visible = false; } else if (intTypeID == 2) { trSearchCriteria1.Visible = false; trSearchCriteria2.Visible = true; trSearchCriteria3.Visible = false; } else if (intTypeID == 3) { trSearchCriteria1.Visible = false; trSearchCriteria2.Visible = false; trSearchCriteria3.Visible = true; btnInvoice.Visible = true; } } }
public ActionResult LogOffCompletely(string userName, string password, decimal?totalHotelRecievable, decimal?totalBarRecievable, decimal?totalSales, string closeShift) { closeShift = closeShift.Trim().ToUpper(); EndShift(userName, password, totalHotelRecievable.Value, totalBarRecievable.Value, totalSales.Value, closeShift); AppSecurity.Logout(); FormsAuthentication.SignOut(); if (IsSelfServiceCentre()) { return(RedirectToAction("SelfService", "Account")); } return(RedirectToAction("Index", "Home")); }
private void LoadTamperAttachmentDG() { string sortby = "Date_Added desc"; DataSet ds = DatabaseUtilities.DsGetByTableColumnValue(Constants.DB_VIEW_ASSET_TAB_ATTACHMENTS, "Asset_Tamper_ID", GetSetTamperID, sortby); dgTamperAttachment.Visible = false; lblResultsAttachment.Text = "No attachments(s) found"; if (ds.Tables[0].Rows.Count > 0) { lblResultsAttachment.Text = ""; dgTamperAttachment.Visible = true; dgTamperAttachment.DataSource = ds; dgTamperAttachment.DataBind(); AppSecurity.Apply_CAIRS_Security_To_UserControls(dgTamperAttachment.Controls); } }
protected void gvExamStatus_ItemCommand(object sender, GridCommandEventArgs e) { //string NextPage = string.Empty; //if (e.CommandName == "view") // NextPage = "ViewExamScreens.aspx?mode=old&TransID="; //else // NextPage = "ViewExamScreens.aspx?mode=new&TransID="; // Response.Redirect(NextPage+AppSecurity.Encrypt(e.CommandArgument.ToString())+"&Type=View", false); if (e.CommandName == "view") { Response.Redirect("ViewExamScreens.aspx?TransID=" + AppSecurity.Encrypt(e.CommandArgument.ToString()) + "&Type=View", false); //Response.Redirect("ViewExamScreens.aspx?mode=old&TransID=" + AppSecurity.Encrypt(e.CommandArgument.ToString()) + "&Type=View", false); } }
protected void btnStep1Next_Click(object sender, EventArgs e) { BEStudent objBEStudent = new BEStudent(); BStudent objBStudent = new BStudent(); objBEStudent.IntTransID = Convert.ToInt64(AppSecurity.Decrypt(Request.QueryString["TransID"].ToString())); objBStudent.BUpdateNextButtonTime(objBEStudent); if (TYPE == "1") { Response.Redirect("StudentexamiKNOW.aspx?TransID=" + Request.QueryString["TransID"].ToString() + "&&ExamiKEY=" + AppSecurity.Encrypt("1"), false); } else { Response.Redirect("StudentexamiKNOW.aspx?TransID=" + Request.QueryString["TransID"].ToString() + "&&ExamiKEY=" + AppSecurity.Encrypt("0"), false); } }
protected void btnUpdate_Click(object sender, EventArgs e) { if (Page.IsValid) { BEAdmin objBEAdmin = new BEAdmin(); BAdmin objBAdmin = new BAdmin(); //objBEAdmin.IntUserID = Convert.ToInt32(Session[BaseClass.EnumPageSessions.USERID].ToString()); objBEAdmin.IntProviderID = Convert.ToInt32(AppSecurity.Decrypt(Request.QueryString["ExamProviderID"])); objBEAdmin.IntCourseID = Convert.ToInt32(AppSecurity.Decrypt(Request.QueryString["CourseID"])); objBEAdmin.strCourseID = TxtCourseID.Text; objBEAdmin.strCourseName = txtCourseName.Text; objBAdmin.BUpdateCourseDetails(objBEAdmin); if (objBEAdmin.DsResult.Tables[0].Rows.Count > 0) { if (Convert.ToInt32(objBEAdmin.DsResult.Tables[0].Rows[0][0]) == 1) { lblSuccess.Text = Resources.ResMessages.Provider_CourseEditSuccess; lblCourseID.Visible = true; lblCourseID.Text = TxtCourseID.Text; lblCourseName.Visible = true; lblCourseName.Text = txtCourseName.Text; btnUpdate.Visible = false; TxtCourseID.Visible = false; txtCourseName.Visible = false; btnBack.Visible = true; // lblModifiedDate.Text = DateTime.Now.ToShortDateString(); lblSuccess.Visible = true; lblSuccess.ForeColor = System.Drawing.Color.Green; imgSuccess.Visible = true; } else { TxtCourseID.Visible = true; txtCourseName.Visible = true; lblSuccess.Text = Resources.ResMessages.Provider_CourseEditFailed; lblSuccess.ForeColor = System.Drawing.Color.Red; btnUpdate.Visible = true; btnBack.Visible = true; lblSuccess.Visible = true; imgSuccess.Visible = false; } } } }
protected void Div_Click(string strReportType) { // int intTypeID = 0; //this.ResetTabStyles(); // trGridView.Visible = false; switch (strReportType) { case "Examstatusreport": //hdValue.Value = "1-2"; //intTypeID = 2; //((System.Web.UI.HtmlControls.HtmlGenericControl)this.Page.Master.FindControl("ExamProviderContent").FindControl("divDistinctstudentsreport")).Attributes.Add("class", "tab_s_active"); Response.Redirect("AuditorReportsView.aspx?ReportID=" + AppSecurity.Encrypt("3") + "&ReportTypeID=" + AppSecurity.Encrypt("2")); break; case "Billingreport": //hdValue.Value = "1-2"; //intTypeID = 2; //((System.Web.UI.HtmlControls.HtmlGenericControl)this.Page.Master.FindControl("ExamProviderContent").FindControl("divDistinctstudentsreport")).Attributes.Add("class", "tab_s_active"); Response.Redirect("AuditorReportsView.aspx?ReportID=" + AppSecurity.Encrypt("3") + "&ReportTypeID=" + AppSecurity.Encrypt("3")); break; case "TestSummaryReport": Response.Redirect("TestSummaryReport.aspx"); break; case "TestResultReport": Response.Redirect("TestResultReport.aspx"); break; case "AppointmentScheduleReport": Response.Redirect("AppointmentScheduleReport.aspx"); break; } }
protected void dgComments_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemIndex >= 0) { Button btnDelete = ((Button)e.Item.FindControl("btnDelete")); AppSecurity.Apply_CAIRS_Security_To_Single_Control(btnDelete); //If delete is enable make sure the logged on user matches the person who created the comment before they can delete. if (btnDelete.Enabled) { string entered_by_emp_id = btnDelete.Attributes["Added_By_Emp_ID"]; string logged_on_user_emp_id = Utilities.GetEmployeeIdByLoggedOn(Utilities.GetLoggedOnUser()); btnDelete.Enabled = entered_by_emp_id.Equals(logged_on_user_emp_id); } } }
public ActionResult AdminLogOnPAYG(RoomBookingViewModel model, string returnUrl, string signIn) { if (string.IsNullOrEmpty(model.UserName)) { ModelState.AddModelError("", "The Pin Code entered is invalid."); } else { var guestCredential = AppSecurity.GetUserByPinCode(model.UserName); if (guestCredential == null) { ModelState.AddModelError("", "The Pin Code entered is invalid."); } else { if (guestCredential.EndDate < DateTime.Today) { ModelState.AddModelError("", "The Pin Code entered has expired."); } else { bool guestLogin; if (AppSecurity.Login(guestCredential.Person.Username, guestCredential.Person.Password, out guestLogin)) { if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return(Redirect(returnUrl)); } //var tt = GetName(); return(RedirectToAction("Index", "Home", new { model.UserName, guestLogin = guestLogin, auth = "req" })); } //return View("_ErrorMessage", new BaseViewModel { Errormsg = "The user name or password provided is incorrect." }); ModelState.AddModelError("", "The user name or password provided is incorrect."); return(RedirectToAction("Index", "Home", new { model.UserName, guestLogin = true, auth = "req" })); } } } return(View("PAYGLogin", new BaseViewModel())); }
protected void btnBegin_Click(object sender, EventArgs e) { Session["Flowcheck"] = null; Session["NonProctorExam"] = null; Session["Isproctorless"] = null; BEStudent objBEStudent = new BEStudent(); BStudent objBStudent = new BStudent(); objBEStudent.IntTransID = Convert.ToInt64(AppSecurity.Decrypt(Request.QueryString["TransID"].ToString())); objBEStudent.IntType = 18; objBEStudent.IntResult = 0; objBStudent.BUpdateNonProctorExamStatus(objBEStudent); objBStudent.BUpdatePLTime(objBEStudent); ScriptManager.RegisterStartupScript(this, Page.GetType(), "newWindow", "window.open('" + GetExamLink() + "','_blank');", true); }
public static AppSecurity login(string username, string password) { DataTable dt = new DataTable(); SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["cs"].ConnectionString); SqlCommand cmd = new SqlCommand("spUserLogin", cn); // Mark the Command as a Stored Procedure cmd.CommandType = CommandType.StoredProcedure; // Add Parameters to Stored Procedure SqlParameter pUserName = new SqlParameter("@UserName", SqlDbType.VarChar, 30); pUserName.Value = username; cmd.Parameters.Add(pUserName); // Add Parameters to Stored Procedure //cmd.Parameters.AddWithValue(@password, password); SqlParameter parameterPassword = new SqlParameter("@UserPassword", SqlDbType.VarChar, 30); parameterPassword.Value = password; cmd.Parameters.Add(parameterPassword); // Open the database connection and execute the command try { cn.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); cmd.ExecuteNonQuery(); } catch (Exception ex) { //process errors here ex.ToString(); } finally { cn.Close(); } // Return the object if (dt.Rows.Count > 0) { AppSecurity temp = new AppSecurity(); temp.UserId = Convert.ToInt32(dt.Rows[0]["userId"].ToString()); temp.UserEmail = dt.Rows[0]["userEmail"].ToString(); temp.UserRole = dt.Rows[0]["userRole"].ToString(); return temp; } else { AppSecurity temp = new AppSecurity(); temp.ErrorLogin = ""; //AppSecurity object returned return temp; } }