Example #1
0
    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();
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _CurrentUser = SwitchUserManager.GetCurrentUser();
        _AllConfigs  = ConfigManager.GetAll();

        Update_Counter();
    }
Example #3
0
    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);
        }
    }
Example #4
0
    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();
        }
    }
Example #5
0
    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;
        }
    }
Example #6
0
    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)));
            }
        }
    }
Example #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     EditUser = SwitchUserManager.GetCurrentUser();
 }
Example #8
0
 protected void lbtnLogout_Click(object sender, EventArgs e)
 {
     //將登入使用者換成Visitor
     SwitchUserManager.SwitchToVisitor("/Default.aspx");
 }
Example #9
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     SwitchUserManager.GetNewValidCode();
     this.vValidCodeImage.ImageUrl = "/_Element/ValidCode/RandomNumberImage.ashx";
     this.Page.Title = "管理者登入";
 }