public AccountController(AccountManager accountManager, IFileService fileService, StatsManager statsManager, AccountFriendManager accountFriendManager, FriendRequestManager friendRequestManager, DataContext dataContext, SessionManager sessionManager, AccountItemManager accountItemManager, ShopItemManager shopItemManager, IImageProcessingService imageProcessingService, FileManager fileManager, IOptions <FileOptions> options, JwtTokenGenerator tokenGenerator, NotificationManager notificationManager) { _accountManager = accountManager; _fileService = fileService; _statsManager = statsManager; _accountFriendManager = accountFriendManager; _friendRequestManager = friendRequestManager; _dataContext = dataContext; _sessionManager = sessionManager; _accountItemManager = accountItemManager; _shopItemManager = shopItemManager; _imageProcessingService = imageProcessingService; _fileManager = fileManager; _tokenGenerator = tokenGenerator; _notificationManager = notificationManager; _options = options.Value; }
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(); }
public AccountController(AccountManager accountManager, IEmailService emailService, FileManager fileManager, IOptions <EmailVerificationOptions> emailVerificationOptions, IOptions <ResetPasswordOptions> resetPasswordOptions, IOptions <FinancialOptions> financialOptions, IFileService fileService, IHostingEnvironment hostingEnvironment, IOptions <FileOptions> fileOptions, JwtTokenGenerator tokenGenerator, SessionManager sessionManager, AccountItemManager accountItemManager, ShopItemManager shopItemManager, IImageProcessingService imageProcessingService, StatsManager statsManager) { _accountManager = accountManager; _emailService = emailService; _fileManager = fileManager; _fileService = fileService; _accountItemManager = accountItemManager; _shopItemManager = shopItemManager; _imageProcessingService = imageProcessingService; _statsManager = statsManager; _emailVerificationOptions = emailVerificationOptions.Value; _resetPasswordOptions = resetPasswordOptions.Value; }
public void SelectPowerUp() { int index = Random.Range(1, 12); if (index >= 1 && index < 5) { index = 1; } else if (index >= 5 && index < 9) { index = 8; } else if (index >= 9 && index < 13) { index = 9; } while (ShopItemManager.IsBought("ShopItem" + index) || ShopItemManager.IsRented("ShopItem" + index) || index == 5) { index = Random.Range(1, 13); if (index >= 1 && index < 5) { index = 1; } else if (index >= 5 && index < 9) { index = 8; } else if (index >= 9 && index < 13) { index = 9; } } selectedPowerUp = "ShopItem" + index; SetPowerUpIcon(index); }
private void Render_UserItem() { if (Page.IsPostBack == true) { return; } //帳號 this.vAccount.Text = _BranchManager.Account; this.vAccount.ReadOnly = (_Argument["Mode"] == "Edit"); //姓名 this.vName.Text = _BranchManager.Profiles[ProfileKey.姓名]; //分店 List <ShopItem> AllShop = ShopItemManager.GetAll(); this.vShopSelector.Items.Add(new ListItem("請選擇", "")); this.vShopSelector.Items.AddRange(AllShop.Select(s => new ListItem(s.Name, s.Id)).ToArray()); string BranchManagerShop = _BranchManager.Profiles[ProfileKey.分店]; if (AllShop.FirstOrDefault(s => s.Name == BranchManagerShop) != null) { this.vShopSelector.Items.FindByText(BranchManagerShop).Selected = true; } //備註 this.vRemark.Text = _BranchManager.Profiles[ProfileKey.備註]; //vDelete this.vDelete.OnClientClick = "return confirm('確定要刪除?');"; this.vDelete.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { _Argument = LeftHand.Gadget.Encoder.DictionaryDecoder(Server.UrlDecode(Request.QueryString.ToString())); } _ShopItem = ShopItemManager.GetById(_Argument["Id"]); }
protected void vDelete_Click(object sender, EventArgs e) { try { ShopItemManager.Remove(_ShopItem); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Message", "alert('刪除成功');window.parent.$.fancybox.close();", true); } catch (Exception ex) { LeftHand.Gadget.Dialog.Alert(ex.Message); } }
public string GetSelectedShopItemName() { string name = ""; for (int count = 0; count < ShopButtons.Count; count++) { ShopItemManager shopIM = ShopButtons [count].GetComponent <ShopItemManager> (); if (shopIM.IsSelected()) { name = shopIM.itemName; break; } } return(name); }
private void Render_ShopItemList() { List <ShopItem> ShopItems = new List <ShopItem>(); if (_CurrentUser.Roles.Contains(RoleKey.Manager) == true) { ShopItems = ShopItemManager.GetAll(); } else if (_CurrentUser.Roles.Contains(RoleKey.BranchManager) == true) { ShopItems = ShopItemManager.GetAll().Where(s => s.Name == _CurrentUser.Profiles[ProfileKey.分店]).ToList(); } this.vShopItemList.DataSource = ShopItems; this.vShopItemList.DataBind(); }
protected void vDelete_Click(object sender, EventArgs e) { try { LinkButton vDelete = (LinkButton)sender; string RoundItemId = vDelete.CommandArgument.ToString(); _ShopItem.RoundItems.Remove(_ShopItem.RoundItems.FirstOrDefault(r => r.Id == RoundItemId)); ShopItemManager.Save(_ShopItem); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Message", "window.parent.$.fancybox.update();", true); } catch (Exception ex) { LeftHand.Gadget.Dialog.Alert(ex.Message); } }
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))); } } }
//選擇Shop protected void vShopItem_Click(object sender, EventArgs e) { LinkButton LinkButton = (LinkButton)sender; ShopItem ShopItem = ShopItemManager.GetById(LinkButton.CommandArgument); _CurrentOrderItem.ShopId = ShopItem.Id; _CurrentOrderItem.ShopName = ShopItem.Name; _CurrentOrderItem.ShopPhone = ShopItem.Phone; _CurrentOrderItem.ShopAddress = ShopItem.Address; _CurrentOrderItem.Shoplatitude = ShopItem.Latitude; _CurrentOrderItem.Shoplongitude = ShopItem.Longitude; //OrderRound _CurrentOrderItem.OrderRound = ""; //UpdateGoogleMap string Url = string.Format("http://maps.google.com.tw/maps?f=q&hl=zh-TW&geocode=&q={0},{1}({2})&z=16&output=embed&t=p", ShopItem.Latitude, ShopItem.Longitude, ShopItem.Name); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "UpdateGoogleMap", "UpdateGoogleMap('" + Url + "');", true); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { _Argument = LeftHand.Gadget.Encoder.DictionaryDecoder(Server.UrlDecode(Request.QueryString.ToString())); } switch (_Argument["Mode"]) { case "Add": _ShopItem = new ShopItem("", "", "", "", ""); break; case "Edit": _ShopItem = ShopItemManager.GetById(_Argument["Id"]); break; } //_AreaItems _AreaItems = AreaItemManager.GetAll(); //_SchoolItems _SchoolItems = SchoolItemManager.GetAll(); }
protected void vAdd_Click(object sender, EventArgs e) { try { List <string> Errors = new List <string>(); //StartTime TimeSpan AddStartTime; if (TimeSpan.TryParse(this.vAddStartTimeHour.Text.Trim() + ":" + this.vAddStartTimeMinute.Text.Trim(), out AddStartTime) == false) { Errors.Add("開始時間格式錯誤"); } if (_ShopItem.RoundItems.FirstOrDefault(r => AddStartTime >= r.StartTime && AddStartTime <= r.EndTime) != null) { Errors.Add("時間區間重疊"); } //EndTime TimeSpan AddEndTime; if (TimeSpan.TryParse(this.vAddEndTimeHour.Text.Trim() + ":" + this.vAddEndTimeMinute.Text.Trim(), out AddEndTime) == false) { Errors.Add("結束時間格式錯誤"); } if (AddStartTime >= AddEndTime) { Errors.Add("結束時間不可早於開始時間"); } if (_ShopItem.RoundItems.FirstOrDefault(r => AddEndTime >= r.StartTime && AddEndTime <= r.EndTime) != null) { Errors.Add("時間區間重疊"); } if (_ShopItem.RoundItems.FirstOrDefault(r => AddStartTime <= r.StartTime && AddEndTime >= r.EndTime) != null) { Errors.Add("時間區間重疊"); } //vAddLimitPairAmount int AddLimitPairAmount; if (int.TryParse(this.vAddLimitPairAmount.Text, out AddLimitPairAmount) == false) { Errors.Add("限制人數格式錯誤,請輸入整數數字"); } if (Errors.Count > 0) { throw new Exception(string.Join("\\r\\n", Errors.Distinct())); } _ShopItem.RoundItems.Add(new RoundItem(_ShopItem, AddStartTime, AddEndTime, AddLimitPairAmount)); ShopItemManager.Save(_ShopItem); this.vAddStartTimeHour.Text = ""; this.vAddStartTimeMinute.Text = ""; this.vAddEndTimeHour.Text = ""; this.vAddEndTimeMinute.Text = ""; this.vAddLimitPairAmount.Text = ""; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Message", "alert('新增成功');window.parent.$.fancybox.update();", true); } catch (Exception ex) { LeftHand.Gadget.Dialog.Alert(ex.Message); } }
//送出預約 protected void vSendButton_Click(object sender, EventArgs e) { try { //檢查是否所有資都填了 List <string> Errors = new List <string>(); #region MemberInfo //vMemberName string MemberName = this.vMemberName.Text.Replace(" ", ""); if (string.IsNullOrWhiteSpace(MemberName) == true) { Errors.Add("請輸入 大學生姓名"); } //MemberIdCardNumber string MemberIdCardNumber = this.vMemberAccount.Text.Replace(" ", "").ToUpper(); if (string.IsNullOrWhiteSpace(MemberIdCardNumber) == true) { Errors.Add("請輸入 身分證字號"); } else if (UserManager.IdCheck(MemberIdCardNumber) == false) { Errors.Add("身分證字號m錯誤"); } else if (ConfigManager.GetByConfigKey(ConfigKey.黑名單).Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Contains(MemberIdCardNumber) == true) { Errors.Add("身份證字號無效"); } //vMemberPhone string MemberPhone = this.vMemberPhone.Text.Replace(" ", ""); if (string.IsNullOrWhiteSpace(MemberPhone) == true) { Errors.Add("請輸入 行動電話"); } else if (MemberPhone.Contains("09") == false) { Errors.Add("行動電話格式不正確"); } #endregion #region MemberArea string Area = this.vAreaSelector.SelectedItem.Text; if (Area == "請選擇") { Errors.Add("請選擇 地區"); } string School = this.vSchoolSelector.SelectedItem.Text; if (School == "請選擇") { Errors.Add("請選擇 學校"); } #endregion #region ShopInfos if (string.IsNullOrWhiteSpace(_CurrentOrderItem.ShopId) == true) { Errors.Add("請選擇 預約LOHAS門市"); } else if (string.IsNullOrWhiteSpace(_CurrentOrderItem.ShopName) == true) { Errors.Add("請選擇 預約LOHAS門市"); } else if (string.IsNullOrWhiteSpace(_CurrentOrderItem.ShopPhone) == true) { Errors.Add("請選擇 預約LOHAS門市"); } else if (string.IsNullOrWhiteSpace(_CurrentOrderItem.ShopAddress) == true) { Errors.Add("請選擇 預約LOHAS門市"); } else if (string.IsNullOrWhiteSpace(_CurrentOrderItem.Shoplatitude) == true) { Errors.Add("請選擇 預約LOHAS門市"); } else if (string.IsNullOrWhiteSpace(_CurrentOrderItem.Shoplongitude) == true) { Errors.Add("請選擇 預約LOHAS門市"); } #endregion #region OrderRound DateTime OrderDate; if (DateTime.TryParse(this.vSelectedDate.Value.Trim(), out OrderDate) == false) { Errors.Add("請選擇 預約日期"); } if (string.IsNullOrWhiteSpace(_CurrentOrderItem.OrderRound) == true) { Errors.Add("請選擇 預約時段"); } #endregion if (Errors.Count > 0) { throw new Exception(string.Join("\\r\\n", Errors)); } //檢查 重複報名 if (_IsUpdateMode == false && OrderItemManager.Get(MemberIdCardNumber, MemberPhone) != null) { Errors.Add("每人僅有一次機會,不可重複預約"); } if (Errors.Count > 0) { throw new Exception(string.Join("\\r\\n", Errors)); } //檢查 是否額滿 int SameRoundOrderAmount = OrderItemManager.GetRoundCount(_CurrentOrderItem.ShopId, (DateTime)_CurrentOrderItem.OrderDate, _CurrentOrderItem.OrderRound); int LimitPairAmount = ShopItemManager.GetById(_CurrentOrderItem.ShopId).RoundItems.FirstOrDefault(r => r.Name == _CurrentOrderItem.OrderRound).LimitPairAmount; if ((SameRoundOrderAmount + 1) > LimitPairAmount) { Errors.Add("場次已經額滿,請挑選新的場次"); } if (Errors.Count > 0) { throw new Exception(string.Join("\\r\\n", Errors)); } _CurrentOrderItem.MemberName = MemberName; _CurrentOrderItem.MemberAccount = MemberIdCardNumber; _CurrentOrderItem.MemberPhone = MemberPhone; _CurrentOrderItem.MemberArea = Area; _CurrentOrderItem.MemberSchool = School; _CurrentOrderItem.OrderDate = OrderDate; OrderItemManager.SaveTemp(_CurrentOrderItem); ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Message", "top.location.replace('Questionnaire_Form.aspx');", true); //OrderItemManager.Save(_CurrentOrderItem); //ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Message", "top.location.replace('Finish_Form.aspx?" + Server.UrlEncode(LeftHand.Gadget.Encoder.AES_Encryption(_CurrentOrderItem.Id.ToString())) + "');", true); } catch (Exception ex) { LeftHand.Gadget.Dialog.Alert(ex.Message); } }
void RewardFunction() { //Reward Function Code ShopItemManager.Rent(selectedPowerUp); }
public ShopController(ShopItemManager shopItemManager, DataContext dataContext, AchievementService achievementService) { _shopItemManager = shopItemManager; _dataContext = dataContext; _achievementService = achievementService; }
private void Render_ShopItemList() { this.vShopList.DataSource = ShopItemManager.GetAll(); this.vShopList.DataBind(); }
protected void Page_PreRender(object sender, EventArgs e) { if (Page.IsPostBack == false) { this.vMemberName.Text = _CurrentOrderItem.MemberName; this.vMemberAccount.Text = _CurrentOrderItem.MemberAccount; this.vMemberPhone.Text = _CurrentOrderItem.MemberPhone; } //vAreaSelector this.vAreaSelector.Items.Clear(); this.vAreaSelector.Items.Add(new ListItem("請選擇", "")); this.vAreaSelector.Items.AddRange(_AllAreas.Select(a => new ListItem(a.Name, a.Id)).ToArray()); ListItem AreaListItem = this.vAreaSelector.Items.FindByText(_CurrentOrderItem.MemberArea); if (AreaListItem != null) { AreaListItem.Selected = true; } //vSchoolSelector this.vSchoolSelector.Items.Clear(); this.vSchoolSelector.Items.Add(new ListItem("請選擇", "")); this.vSchoolSelector.Items.AddRange(SchoolItemManager.GetByArea(AreaItemManager.GetByName(_CurrentOrderItem.MemberArea)).Select(a => new ListItem(a.Name, a.Id)).ToArray()); ListItem SchoolListItem = this.vSchoolSelector.Items.FindByText(_CurrentOrderItem.MemberSchool); if (SchoolListItem != null) { SchoolListItem.Selected = true; } //vShopList this.vShopList.DataSource = ShopItemManager.GetBySchool(SchoolItemManager.GetByName(_CurrentOrderItem.MemberSchool)); this.vShopList.DataBind(); //Calandar DateTime MinDate = DateTime.Now.Date.AddDays(1); string MinDateString = string.Format("new Date({0},{1},{2})", MinDate.Year, MinDate.Month - 1, MinDate.Day); DateTime MaxDate = DateTime.Now.AddDays(60).Date; string MaxDateString = string.Format("new Date({0},{1},{2})", MaxDate.Year, MaxDate.Month - 1, MaxDate.Day); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "BindCalander", string.Format("BindCalander({0},{1});", MinDateString, MaxDateString), true); if (string.IsNullOrWhiteSpace(this.vSelectedDate.Value) == false) { _CurrentOrderItem.OrderDate = DateTime.Parse(this.vSelectedDate.Value).Date; } //RoundList ShopItem SelectedShop = ShopItemManager.GetById(_CurrentOrderItem.ShopId); if (SelectedShop != null && SelectedShop.RoundItems != null && _CurrentOrderItem.OrderDate != null) { //還沒有額滿的回合,包含當日還沒有愈時的 List <RoundItem> NotFullRounds = new List <RoundItem>(); Dictionary <string, int> RoundCount = OrderItemManager.GetRoundCount(_CurrentOrderItem.ShopId, (DateTime)_CurrentOrderItem.OrderDate); foreach (RoundItem Round in SelectedShop.RoundItems) { DateTime OrderDate = (DateTime)_CurrentOrderItem.OrderDate; if (OrderDate <= DateTime.Now && Round.StartTime < DateTime.Now.TimeOfDay) { continue; } if (RoundCount.ContainsKey(Round.Name) == false) { NotFullRounds.Add(Round); continue; } if (RoundCount[Round.Name] < Round.LimitPairAmount == true) { NotFullRounds.Add(Round); continue; } } if (NotFullRounds.Count > 0) { this.vNoRound.Text = ""; this.vRoundList.DataSource = NotFullRounds; this.vRoundList.DataBind(); } else { this.vNoRound.Text = "所有時段都已被預訂,請選擇其他日期或其他分店。"; this.vRoundList.DataSource = null; this.vRoundList.DataBind(); } } this.vSendButton.Text = "下一步"; //Bind_IdCardNumberCheck ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Bind_IdCardNumberCheck", "Bind_IdCardNumberCheck();", true); }
private void Awake() { shopItemManager = GetComponent <ShopItemManager>(); }
protected void vSave_Click(object sender, EventArgs e) { try { List <string> Errors = new List <string>(); //名稱 string Name = this.vName.Text.Trim(); if (string.IsNullOrWhiteSpace(Name) == true) { Errors.Add("名稱不能為空"); } //電話 string Phone = this.vPhone.Text.Trim(); if (string.IsNullOrWhiteSpace(Phone) == true) { Errors.Add("電話不能為空"); } //地址 string Address = this.vAddress.Text.Trim(); if (string.IsNullOrWhiteSpace(Address) == true) { Errors.Add("地址不能為空"); } //緯度 string Latitude = this.vLatitude.Text.Trim(); if (string.IsNullOrWhiteSpace(Latitude) == true) { Errors.Add("緯度不能為空"); } //經度 string Longitude = this.vLongitude.Text.Trim(); if (string.IsNullOrWhiteSpace(Longitude) == true) { Errors.Add("經度不能為空"); } //排序 int Sort; if (int.TryParse(this.vSort.Text, out Sort) == false) { Errors.Add("排序格式錯誤,請輸入整數數字"); } //學校 List <string> SchoolItemIds = new List <string>(); foreach (RepeaterItem RepeaterItem in vAreaList.Items) { CheckBoxList vSchoolList = (CheckBoxList)RepeaterItem.FindControl("vSchoolList"); foreach (ListItem ListItem in vSchoolList.Items) { if (ListItem.Selected == false) { continue; } SchoolItemIds.Add(ListItem.Value); } } if (Errors.Count > 0) { throw new Exception(string.Join("\\r\\n", Errors.ToArray())); } _ShopItem.SchoolItemIds = SchoolItemIds; _ShopItem.Name = Name; _ShopItem.Phone = Phone; _ShopItem.Address = Address; _ShopItem.Latitude = Latitude; _ShopItem.Longitude = Longitude; _ShopItem.Sort = Sort; ShopItemManager.Save(_ShopItem); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Message", "alert('儲存成功');window.parent.$.fancybox.close();", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Exception", "alert('" + ex.Message + "');", true); } }
public ShopItemController(ShopItemManager shopItemManager) { _shopItemManager = shopItemManager; }