protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["ServiceUnitID"] == null) { Session.Abandon(); Session.RemoveAll(); FormsAuthentication.SignOut(); //FormsAuthentication.RedirectToLoginPage(); } } this.Page.Title = "Helpdesk RSCM Kencana V1.0"; LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName; if (loginName != null && Session != null) { AppUser _user = new AppUser(); _user.es.Connection.Name = "KENCANA"; //_user.es.Connection.Name = "LOCAL_HIS"; if (_user.LoadByPrimaryKey(HttpContext.Current.User.Identity.Name)) { loginName.FormatString = _user.UserName; } } }
protected void Page_Load(object sender, EventArgs e) { IPrincipal User = HttpContext.Current.User; if (User.Identity.IsAuthenticated) { //Display a profile picture for Twitter or Facebook users. HttpCookie authCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value); UserData userData = Json.Deserialise <UserData>(authTicket.UserData); Image profileImage = (Image)HeadLoginView.FindControl("profileImage"); if (userData.serviceType == "twitter") { profileImage.ImageUrl = "http://api.twitter.com/1/users/profile_image/" + userData.username; profileImage.AlternateText = userData.name; profileImage.Visible = true; } if (userData.serviceType == "facebook") { profileImage.ImageUrl = "http://graph.facebook.com/" + userData.id + "/picture/"; profileImage.AlternateText = userData.name; profileImage.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { string urlCurrent = HttpContext.Current.Request.Url.AbsolutePath; string urlChangePassword = Navigation.User_ChangePassword().GetServerUrl(true); string urlChangePasswordFilename = urlChangePassword.Substring(urlChangePassword.LastIndexOf("/") + 1); if (Page.User.Identity.IsAuthenticated && !urlCurrent.Contains(urlChangePasswordFilename)) { User currentUser = MembershipManager.GetUserByName(Page.User.Identity.Name); LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName; if (loginName != null) { loginName.FormatString = Utilities.GetDisplayUserFirstName(currentUser.Name); } if (currentUser.PasswordChangeRequired) { Response.Redirect(Navigation.User_ChangePassword().GetServerUrl(true)); } } // Retrieve the client version number, add it to lblVersionNumber. string fileName = Path.Combine(Server.MapPath("~"), "Version.txt"); if (File.Exists(fileName)) { lblVersionNumber.Text = File.ReadAllText(fileName); } Page.Title = "BusiBlocks - " + Page.Title; DisplayAnyFeedback(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] == null) { //如果Sessions超时,则注销用户 FormsAuthentication.SignOut(); FormsAuthentication.RedirectToLoginPage(); } else { LoginName control = HeadLoginView.FindControl("HeadLoginName") as LoginName; if (control != null) { control.FormatString = Session["UserName"].ToString(); } //Configuration conf = WebConfigurationManager.OpenWebConfiguration("~"); //SystemWebSectionGroup swsg = (SystemWebSectionGroup)conf.GetSectionGroup("system.web"); //AuthorizationRule rule = new AuthorizationRule(AuthorizationRuleAction.Deny); //rule.Users.Add("?"); //swsg.Authorization.Rules.Add(rule); //conf.Save(ConfigurationSaveMode.Modified); } }
protected void EnterTheSystem(object sender, EventArgs e) { SqlConnection c = new SqlConnection(); SqlCommand q = new SqlCommand(); c.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Андрей\Documents\Visual Studio 2010\Projects\modelling\modelling\App_Data\Database1.mdf;Integrated Security=True;User Instance=True"; c.Open(); q.Connection = c; TextBox t = ((TextBox)HeadLoginView.FindControl("loginUsrName")); q.CommandText = "select password from usr where login='******';"; SqlDataReader r; r = q.ExecuteReader(); if (!(r.Read())) { ((Label)HeadLoginView.FindControl("authInfo")).ForeColor = System.Drawing.Color.Red; ((Label)HeadLoginView.FindControl("authInfo")).Text = "Неверная пара логин/пароль! Повторите ввод."; return; } if (((string)r.GetValue(0)) == ((TextBox)HeadLoginView.FindControl("loginPassword")).Text) { FormsAuthentication.SetAuthCookie(((TextBox)HeadLoginView.FindControl("loginUsrName")).Text, false); FormsAuthentication.RedirectFromLoginPage(((TextBox)HeadLoginView.FindControl("loginUsrName")).Text, false); c.Close(); //HeadLoginView.ViewStateMode = return; } ((Label)HeadLoginView.FindControl("authInfo")).ForeColor = System.Drawing.Color.Red; ((Label)HeadLoginView.FindControl("authInfo")).Text = "Неверная пара логин/пароль! Повторите ввод."; }
protected void lvCurrentOrders_ItemCommand(object sender, ListViewCommandEventArgs e) { using (DowntownDeliEntity dde = new DowntownDeliEntity()) { switch (e.CommandName) { case "Complete": ListViewDataItem item = (ListViewDataItem)e.Item; Label lblOrderID = (Label)item.FindControl("lblOrderID"); int id = int.Parse(lblOrderID.Text); Order RealOrder = dde.Orders.Find(id); RealOrder.Complete = true; dde.SaveChanges(); ListView lvCurrentOrders = (ListView)HeadLoginView.FindControl("lvCurrentOrders"); lvCurrentOrders.DataSource = dde.Orders.Include("Customer").Where(t => t.Complete == false || t.Complete == null).ToList(); lvCurrentOrders.DataBind(); break; case "Modify": ListViewDataItem item2 = (ListViewDataItem)e.Item; Label lblOrderID2 = (Label)item2.FindControl("lblOrderID"); int id2 = int.Parse(lblOrderID2.Text); Order RealOrder2 = dde.Orders.Include("Product_Order").Where(t => t.Order_ID == id2).ToList().Single(); order = RealOrder2; ModifyOrder = true; Response.Redirect("~/Pages/PlaceOrder.aspx", false); break; } } }
void Page_PreRender(Object o, EventArgs e) { btnHome.Text = GetResourceValue("Common", "btnHome", ""); btnContactUs.Text = GetResourceValue("Common", "btnContactUs", ""); //NationalEmblem_alt.Alt = GetResourceValue("Common", "NationalEmblem_alt", ""); //lbl_headTitle.Text = GetResourceValue("Common", "lbl_headTitle", ""); // lbl_navigation.Text = GetResourceValue("Common", "lbl_navigation", ""); LoginStatus HeadLoginStatus = (LoginStatus)HeadLoginView.FindControl("HeadLoginStatus"); HyperLink HyperLink1 = (HyperLink)HeadLoginView.FindControl("HyperLink1"); }
private void LoadPhysicianName() { Domain.User loggedUser = UserHelper.GetLoggedInUser(HttpContext.Current.Session); if (loggedUser != null && loggedUser.Roles.Contains(Helper.Constants.PHYSICIAN_ROLE)) { Label lblUserName = HeadLoginView.FindControl("lblPhysicianName") as Label; lblUserName.Text = Utility.GetHTMLSalutation(loggedUser.Salutation) + " " + loggedUser.FirstName + " " + loggedUser.LastName; } }
public void updatecartfilter() { int count = RewardCart.Instance.getQuantity(); if (count > 0) { HyperLink cartitem = HeadLoginView.FindControl("Cart") as HyperLink; cartitem.Text = "My Cart(" + count + ")" + "[Checkout]"; cartitem.NavigateUrl = "~/Rewards/Redeem.aspx"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SetLinkTarget(); } if (WebSecurity.IsAuthenticated) { LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName; Guid UserID = new CustomerDAC().RetrieveUserGUID(WebSecurity.CurrentUserName); if (!string.IsNullOrEmpty((string)Session[SystemConstants.ses_FName])) { loginName.FormatString = (string)Session[SystemConstants.ses_FName]; } else { var dr = new CustomerDAC().RetrieveUserProfiles(UserID); if (dr != null) { Session[SystemConstants.ses_FName] = dr.FirstName; Session[SystemConstants.ses_LName] = dr.LastName; Session[SystemConstants.ses_Role] = SystemConstants.CustomerRole; Session[SystemConstants.ses_Email] = dr.Email; Session[SystemConstants.ses_UserID] = dr.UserID; var drr = new CustomerDAC().RetrieveUserRewardDetails(dr.FirstName); if (drr != null) { Session[SystemConstants.ses_Rwdpts] = Convert.ToString(drr.RewardPoint); } } else { var drp = new CustomerDAC().RetrieveProviderProfiles(UserID); if (drp != null) { WebSecurity.Logout(); } } } loginName.FormatString = (string)Session[SystemConstants.ses_FName]; string path = HttpContext.Current.Request.Url.AbsolutePath; if (!path.Contains("Redeem")) { updatecartfilter(); } string pts = (String)(Session[SystemConstants.ses_Rwdpts]); //HyperLink hlnkRewards = HeadLoginView.FindControl("hlnkRewards") as HyperLink; loginName.FormatString = (string)Session[SystemConstants.ses_FName] + " (" + pts + " pts)"; } }
protected void lvCurrentOrders_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { using (DowntownDeliEntity dde = new DowntownDeliEntity()) { ListView lvCurrentOrders = (ListView)HeadLoginView.FindControl("lvCurrentOrders"); DataPager lvCurrentOrdersPager = lvCurrentOrders.FindControl("lvCurrentOrdersPager") as DataPager; int CurrentPage = ((lvCurrentOrdersPager.StartRowIndex) / lvCurrentOrdersPager.MaximumRows) + 1; lvCurrentOrdersPager.SetPageProperties(lvCurrentOrdersPager.StartRowIndex, lvCurrentOrdersPager.MaximumRows, false); lvCurrentOrders.DataSource = dde.Orders.Include("Customer").Where(t => t.Complete == false || t.Complete == null).ToList(); lvCurrentOrders.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Membership.GetUser() != null) { string[] roles = Roles.GetRolesForUser(Membership.GetUser().UserName); if (roles.Length == 0) { HyperLink hl = (HyperLink)HeadLoginView.FindControl("MapLink"); hl.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { LoginName loginName =HeadLoginView.FindControl("HeadLoginName") as LoginName; if (loginName != null && Session != null) { loginName.FormatString = Session["nombre"].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SetLinkTarget(); } if (WebSecurity.IsAuthenticated) { LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName; Guid UserID = new ProviderDAC().RetrieveUserGUID(WebSecurity.CurrentUserName); if (!string.IsNullOrEmpty((string)Session[SystemConstants.ses_FName])) { loginName.FormatString = (string)Session[SystemConstants.ses_FName] + " " + (string)Session[SystemConstants.ses_LName]; } else { var drp = new ProviderDAC().RetrieveProviderProfiles(UserID); if (drp != null) { string name = drp.ProviderName; if (name.Length > 20) { name = name.Remove(20); name = name + "..."; } Session[SystemConstants.ses_FName] = name; Session[SystemConstants.ses_LName] = ""; Session[SystemConstants.ses_Role] = SystemConstants.ProviderRole; Session[SystemConstants.ses_Email] = drp.Email; } else { var dr = new ProviderDAC().RetrieveUserProfiles(UserID); if (dr != null) { WebSecurity.Logout(); // Session[SystemConstants.ses_FName] = dr.FirstName; // Session[SystemConstants.ses_LName] = dr.LastName; // Session[SystemConstants.ses_Role] = SystemConstants.CustomerRole; // Session[SystemConstants.ses_Email] = dr.Email; } } } loginName.FormatString = (string)Session[SystemConstants.ses_FName] + " " + (string)Session[SystemConstants.ses_LName]; } }
protected void Page_Load(object sender, EventArgs e) { ASPxLabel2.Text = string.Format(Server.HtmlDecode("{0} © {1}"), DateTime.Now.Year, "Jetus-Soft"); CheckCurrentUser(); pnlLeftPanel.Visible = CurrentUser != null; LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName; // Page.Master.FindControl("HeadLoginName") if (loginName != null && pnlLeftPanel.Visible && Session != null) { var user = Session["_CurrentUser"] as UserProfile; if (user != null) { loginName.FormatString = user.FullName; } } }
protected void Page_Load(object sender, EventArgs e) { if (Page.User.Identity.Name != string.Empty) { HyperLink hyp = (HyperLink)HeadLoginView.FindControl("HyperLink1"); bool type = Page.User.IsInRole("Admin"); if (type) { hyp.NavigateUrl = "~/PageAdmin/Admin.aspx"; } else { hyp.NavigateUrl = "~/PageUser/MyProfile.aspx"; } } }
protected void Page_Load(object sender, EventArgs e) { if (HttpContext.Current.User.Identity.IsAuthenticated) { if (UserHelper.GetLoggedInUser(Session).Roles.Contains(Helper.Constants.ADMIN_ROLE)) { (HeadLoginView.FindControl("imgLogo") as Image).ImageUrl = "~/images/chrc_logo.png"; (HeadLoginView.FindControl("HeadLoginStatus") as LoginStatus).LogoutPageUrl = "~/Admin/Login.aspx"; } else if (UserHelper.GetLoggedInUser(Session).Roles.Contains(Helper.Constants.VALIENT_ROLE)) { (HeadLoginView.FindControl("HeadLoginStatus") as LoginStatus).LogoutPageUrl = "~/Valeant/Login.aspx"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.ClientScript.IsClientScriptBlockRegistered(Constants.GOOGLE_ANALYTICS_KEY)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Constants.GOOGLE_ANALYTICS_KEY, SystemConfig.GetValue(RHP.Common.Enums.SystemConfig.GOOGLE_ANALYTICS)); } if (!Page.IsPostBack) { if (this.Page.User.Identity.IsAuthenticated) { Label login_Name = HeadLoginView.FindControl("LoginName") as Label; login_Name.Text = getUserData(); } } if (HttpContext.Current.User.Identity.IsAuthenticated) { if (Request.QueryString.Count == 0) { if (!Roles.IsUserInRole(HttpContext.Current.User.Identity.Name, "landlord")) { if (Roles.IsUserInRole(HttpContext.Current.User.Identity.Name, "student")) { Response.Redirect("~/Student/Student_Profile.aspx"); } else if (Roles.IsUserInRole(HttpContext.Current.User.Identity.Name, "admin")) { Response.Redirect("~/Administrator/Default.aspx"); } else { Response.Redirect("~/Default.aspx"); } } else { // user = User.Select(Guid.Parse(Membership.GetUser().ProviderUserKey.ToString())); } } } else { user.LogOut(); //Response.Redirect("~/Login.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Request.Url.ToString().Contains("Default.aspx")) { Footerbottom1.Visible = false; } if (!Page.ClientScript.IsClientScriptBlockRegistered(Constants.GOOGLE_ANALYTICS_KEY)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Constants.GOOGLE_ANALYTICS_KEY, SystemConfig.GetValue(RHP.Common.Enums.SystemConfig.GOOGLE_ANALYTICS)); } if (!Page.IsPostBack) { if (this.Page.User.Identity.IsAuthenticated) { Label login_Name = HeadLoginView.FindControl("LoginName") as Label; login_Name.Text = getUserData(); } } }
protected void Page_PreRender(Object sender, EventArgs e) { Search_btn.Text = GetResourceValue("Common", "Search_btn", ""); Button btnlogin = (Button)HeadLoginView.FindControl("btnlogin"); if (btnlogin != null) { btnlogin.Text = GetResourceValue("Common", "btnlogin", ""); } else { LoginStatus HeadLoginStatus = (LoginStatus)HeadLoginView.FindControl("HeadLoginStatus");; HeadLoginStatus.LogoutText = GetResourceValue("Common", "HeadLoginStatus", ""); LinkButton lnkchangepassword = (LinkButton)HeadLoginView.FindControl("lnk_changepassword"); lnkchangepassword.Text = GetResourceValue("Common", "HyperLink1", ""); } btnHome.Text = GetResourceValue("Common", "btnHome", ""); btnContactUs.Text = GetResourceValue("Common", "btnContactUs", ""); //lbl_headTitle.Text = GetResourceValue("Common", "lbl_headTitle", ""); // NationalEmblem_alt.Alt = GetResourceValue("Common", "NationalEmblem_alt", ""); }
/// <summary> /// Description: This method is used to set the preselected date format in User settings pop-up. /// <summary> protected void SetUserDateFormat() { try { if (Session["User_DateFormat"] != null) { RadioButtonList Rbl = HeadLoginView.FindControl("rbtnDateFormat") as RadioButtonList; if (Rbl != null) { if (Rbl.Items.FindByValue(Session["User_DateFormat"].ToString()) != null) { Rbl.SelectedValue = Session["User_DateFormat"].ToString() != "" ? Session["User_DateFormat"].ToString() : "0"; } } } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
void Page_PreRender(Object o, EventArgs e) { if (System.Threading.Thread.CurrentThread.CurrentCulture.ToString() == "en-IN") { searchTxtBox.DestinationLanguage = TextBoxServerControl.TextBoxControl.SupportedLanguages.ENGLISH; searchTxtBox.CDACDestinationLanguage = TextBoxServerControl.TextBoxControl.CDACSupportedLanguages.ENGLISH; } else { searchTxtBox.DestinationLanguage = TextBoxServerControl.TextBoxControl.SupportedLanguages.ENGLISH; searchTxtBox.CDACDestinationLanguage = TextBoxServerControl.TextBoxControl.CDACSupportedLanguages.MARATHI; } MAHAITUserControl _MahaITUC = new MAHAITUserControl(); searchTxtBox.Text = _MahaITUC.GetResourceValue("Common", "searchTxtBox", ""); lblSearchBTN.InnerText = _MahaITUC.GetResourceValue("Common", "lblSearchBTN", ""); Search_btn.Text = _MahaITUC.GetResourceValue("Common", "Search_btn", ""); Button btnlogin = (Button)HeadLoginView.FindControl("btnlogin"); if (btnlogin != null) { btnlogin.Text = _MahaITUC.GetResourceValue("Common", "btnlogin", ""); } else { LoginStatus HeadLoginStatus = (LoginStatus)HeadLoginView.FindControl("HeadLoginStatus"); HeadLoginStatus.LogoutText = _MahaITUC.GetResourceValue("Common", "HeadLoginStatus", ""); } //lbl_headTitle.Text = _MahaITUC.GetResourceValue("Common", "lbl_headTitle", ""); lbl_skipToNav.Text = _MahaITUC.GetResourceValue("Common", "lbl_skipToNav", ""); lbl_skipToContent.Text = _MahaITUC.GetResourceValue("Common", "lbl_skipToContent", ""); }
protected void Page_Load(object sender, EventArgs e) { if (System.Web.HttpContext.Current.User != null && System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { if (user != null) { Button btnAdmin = (Button)HeadLoginView.FindControl("btnAdmin"); Button btnOrder = (Button)HeadLoginView.FindControl("btnOrder"); Button btnReports = (Button)HeadLoginView.FindControl("btnReports"); Button btnInventory = (Button)HeadLoginView.FindControl("btnInventory"); Button btnTimeKeeping = (Button)HeadLoginView.FindControl("btnTimeKeeping"); if (user.Job_ID == 2)//cook { btnAdmin.Visible = false; btnOrder.Visible = false; btnReports.Visible = false; btnInventory.Visible = false; btnTimeKeeping.Visible = true; } else if (user.Job_ID == 3) {//cashier btnAdmin.Visible = false; btnOrder.Visible = true; btnReports.Visible = false; btnInventory.Visible = false; btnTimeKeeping.Visible = true; } else if (user.Job_ID == 4)//manager { btnAdmin.Visible = false; btnOrder.Visible = true; btnReports.Visible = true; btnInventory.Visible = true; btnTimeKeeping.Visible = true; } else if (user.Job_ID == 5)// customer.. should never happen but just in case. { btnAdmin.Visible = false; btnOrder.Visible = false; btnReports.Visible = false; btnInventory.Visible = false; btnTimeKeeping.Visible = false; } else { btnAdmin.Visible = true; btnOrder.Visible = true; btnReports.Visible = true; btnInventory.Visible = true; btnTimeKeeping.Visible = true; } } using (DowntownDeliEntity dde = new DowntownDeliEntity()) { ListView lvCurrentOrders = (ListView)HeadLoginView.FindControl("lvCurrentOrders"); lvCurrentOrders.DataSource = dde.Orders.Include("Customer").Where(t => t.Complete == false || t.Complete == null).ToList(); lvCurrentOrders.DataBind(); } } else { FormsAuthentication.SignOut(); } }
protected void Page_Load(object sender, EventArgs e) { Page.Header.DataBind(); //Used to resolve the javascript file references in master page <Head>. if (!IsPostBack) { this.imgReportIssue.ImageUrl = "/" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "/images/close.png"; this.ImageButton1.ImageUrl = "/" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "/images/Cancel.png"; SetUserDateFormat(); } if (Session["User_DateFormat"] != null) { hdnDateFromatMasterPage.Value = Convert.ToString(Session["User_DateFormat"]); } Label lblUserSetting = HeadLoginView.FindControl("userSetting") as Label; if (lblUserSetting != null) { if (Session["USERID"] != null) { lblUserSetting.Visible = true; } else { lblUserSetting.Visible = false; } } string APP_NAME = ConfigurationManager.AppSettings["APP_NAME"].ToString(); DynamicLink.Href = "/" + APP_NAME + "/Styles/" + Convert.ToString(Session["USERSTYLE"]); string JsModalpopup = "/" + APP_NAME + "/Scripts/ReportIssuePopup.js"; Literal scriptModalpopup = new Literal(); scriptModalpopup.Text = string.Format(@"<script src=""{0}"" type=""text/javascript""></script>", JsModalpopup); Page.Header.Controls.Add(scriptModalpopup); var scriptManager = ScriptManager.GetCurrent(Page); if (scriptManager == null) { return; } scriptManager.Scripts.Add(new ScriptReference { Path = "~/Scripts/html2canvas.js" }); var scriptManager1 = ScriptManager.GetCurrent(Page); if (scriptManager1 == null) { return; } scriptManager1.Scripts.Add(new ScriptReference { Path = "~/Scripts/HelpFile.js" }); hdfuserDefaultTheme.Value = Convert.ToString(Session["USERSTYLE"]); UserAccessValidation(); AssignSPMModuleID(); var scriptManager2 = ScriptManager.GetCurrent(Page); if (scriptManager2 == null) { return; } scriptManager2.Scripts.Add(new ScriptReference { Path = "~/Scripts/StaffInfo.js" }); //string msg1 = String.Format("StaffInfo();"); string msg1 = String.Format("try{{StaffInfo();}}catch(exp){{}}"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgshowdetails", msg1, true); }