protected void Page_Load(object sender, EventArgs e) { _CurrentUser = SwitchUserManager.GetCurrentUser(); if (Page.IsPostBack == false) { _SelectDate = DateTime.Now.Date; if (_CurrentUser.Roles.Contains(RoleKey.Manager) == true) { _SelectedShop = (ShopItemManager.GetAll().Count == 0) ? "" : ShopItemManager.GetAll()[0].Id; } else if (_CurrentUser.Roles.Contains(RoleKey.BranchManager) == true) { ShopItem ShopItem = ShopItemManager.GetAll().FirstOrDefault(s => s.Name == _CurrentUser.Profiles[ProfileKey.分店]); _SelectedShop = (ShopItem == null) ? "" : ShopItem.Id; } } else { //判斷選項是否存在 _SelectedShop = (ShopItemManager.GetById(_SelectedShop) == null) ? "" : _SelectedShop; } Load_MonthOrderItems(); }
protected void Page_Load(object sender, EventArgs e) { _CurrentUser = SwitchUserManager.GetCurrentUser(); _AllConfigs = ConfigManager.GetAll(); Update_Counter(); }
protected void vLoginButton_Click(object sender, EventArgs e) { try { List <string> Errors = new List <string>(); string Account = this.vAccount.Text.Trim(); if (string.IsNullOrWhiteSpace(Account) == true) { Errors.Add("帳號不可空白"); } string Password = this.vPassword.Text.Trim(); if (string.IsNullOrWhiteSpace(Password) == true) { Errors.Add("密碼不可空白"); } string ValidCode = this.vValidCode.Text.Trim(); if (string.IsNullOrWhiteSpace(ValidCode) == true) { Errors.Add("驗證碼不可空白"); } if (Errors.Count() > 0) { throw new Exception(string.Join("\\r\\n", Errors)); } User User = UserManager.GetUser(Account); if (User == null) { Errors.Add("帳號或密碼錯誤"); } else if (User.Roles.Intersect(new RoleKey[] { RoleKey.Manager, RoleKey.BranchManager }).Count() == 0) { Errors.Add("帳號或密碼錯誤"); } if (Errors.Count() > 0) { throw new Exception(string.Join("\\r\\n", Errors)); } SwitchUserManager.SwitchUser(Account, Password, ValidCode, false, "/Order/Manager/Order_List.aspx"); } catch (Exception ex) { this.vValidCode.Text = ""; LeftHand.Gadget.Dialog.Alert(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { _CurrentUser = SwitchUserManager.GetCurrentUser(); if (_CurrentUser.Roles.Contains(RoleKey.Login) == false) { Response.Redirect("/Default.aspx"); } if (_CurrentUser.Roles.Intersect(new RoleKey[] { RoleKey.Manager, RoleKey.BranchManager }).Count() == 0) { Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { _Argument = LeftHand.Gadget.Encoder.DictionaryDecoder(Server.UrlDecode(Request.QueryString.ToString())); } _CurrentUser = SwitchUserManager.GetCurrentUser(); switch (_Argument["Mode"]) { case "Add": //暫時沒有新增的需要 break; case "Edit": _OrderItem = OrderItemManager.GetById(decimal.Parse(_Argument["Id"].ToString())); break; } }
protected void Page_Load(object sender, EventArgs e) { _CurrentUser = SwitchUserManager.GetCurrentUser(); _AllAreas = AreaItemManager.GetAll(); _AllShops = ShopItemManager.GetAll(); if (Page.IsPostBack == false) { string AES_OrderItemId = Server.UrlDecode(Request.QueryString.ToString()); if (string.IsNullOrWhiteSpace(AES_OrderItemId)) { _IsUpdateMode = false; _CurrentOrderItem = new OrderItem(null, null, null, DateTime.Now.Date, ""); } else { _IsUpdateMode = true; _CurrentOrderItem = OrderItemManager.GetById(decimal.Parse(LeftHand.Gadget.Encoder.AES_Decryption(AES_OrderItemId))); } } }
protected void Page_Load(object sender, EventArgs e) { EditUser = SwitchUserManager.GetCurrentUser(); }
protected void lbtnLogout_Click(object sender, EventArgs e) { //將登入使用者換成Visitor SwitchUserManager.SwitchToVisitor("/Default.aspx"); }
protected void Page_PreRender(object sender, EventArgs e) { SwitchUserManager.GetNewValidCode(); this.vValidCodeImage.ImageUrl = "/_Element/ValidCode/RandomNumberImage.ashx"; this.Page.Title = "管理者登入"; }