protected void lnkBtnSave_Click(object sender, EventArgs e) { string promoteName = PromoteName.Text; string discount = Discount.Text; if ((!promote.PromoteName.Equals(promoteName)) && (BLLPromote.checkPromoteExistName(promoteName) != 0)) { ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Promote Name existed. Please try again');", true); } else { Promote newPromote = new Promote(); newPromote.PromoteID = promote.PromoteID; newPromote.PromoteName = promoteName; newPromote.Discount = Int32.Parse(discount); if (cbStatus.Checked) { newPromote.Status = true; } else { newPromote.Status = false; } BLLPromote.UpdatePromote(newPromote); Response.Redirect("PromoteList.aspx"); } }
public async void SavePromoteToCloud(Promote promote) { if (!AppService.IsConnected()) { return; } try { //var items = AppDatabase.Current.RetrieveSolutionsByGrouping(sessionId); //foreach (var item in items) //{ AzureMobileService.Current.PushToCloud(promote); //} Messenger.Default.Send <GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE" }); } catch { Messenger.Default.Send <GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR" }); } }
protected virtual void PromoteMenuSelect() { board.Mark(currentlySelectedPiece.GetPiecePosition(), Promote.Promotes(promoteType, (Pawn)currentlySelectedPiece)); drawPiece.ChangeModelType(currentlySelectedPiece.GetPiecePosition(), promoteType, currentlySelectedPiece.GetTeam()); DrawPiece.ClearHighlight(); promoteMenu.SetActive(false); //SwitchTurnDisplay(); }
public void removeEvents(IValidationEvents ievents) { EventPromote -= new Promote(ievents.Promotion); EventIsMated -= new IsMated(ievents.KingIsMated); EventIsStaleMated -= new IsStaleMated(ievents.KingIsStaleMated); EventIsInCheck -= new IsInCheck(ievents.KingIsInCheck); EventIsFree -= new IsFree(ievents.KingIsFree); EventMovePiece -= new movePiece(ievents.updateBoard); }
protected void Page_Load(object sender, EventArgs e) { int promoteId = Convert.ToInt32(Request.QueryString["PromoteID"].ToString()); promote = BLLPromote.getPromoteByID(promoteId)[0]; if (!Page.IsPostBack) { FillData(); } }
public ActionResult Create(Promote promote) { if (ModelState.IsValid) { db.AddToPromoteSet(promote); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(promote)); }
public void addEvents(IValidationEvents ievents) { EventPromote += new Promote(ievents.Promotion); EventIsMated += new IsMated(ievents.KingIsMated); EventIsStaleMated += new IsStaleMated(ievents.KingIsStaleMated); EventIsInCheck += new IsInCheck(ievents.KingIsInCheck); EventIsFree += new IsFree(ievents.KingIsFree); EventIsDone += new IsDone(ievents.finishedMove); EventMovePiece += new movePiece(ievents.updateBoard); }
protected void TogglePromoteMenu() { if (Promote.IsPromotable(currentlySelectedPiece)) { promoteMenu.SetActive(true); } else { promoteMenu.SetActive(false); } }
public ActionResult Edit(int id, FormCollection collection) { Promote promote = db.PromoteSet.FirstOrDefault(p => p.PromoteId == id); if (ModelState.IsValid) { UpdateModel(promote); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(promote)); }
protected void bntNext(object sender, EventArgs e) { if (MultiView1.ActiveViewIndex == 1) { MultiView1.ActiveViewIndex++; } else if (MultiView1.ActiveViewIndex == 2) { MultiView1.ActiveViewIndex++; } if (MultiView1.ActiveViewIndex == 3) { Promote promote = new Promote(); string age = (MultiView1.Views[2].FindControl("tbBirthday") as TextBox).Text; int age2 = tinhtuoi(age); int idPromote = 0; ArrayList arrSeart = (ArrayList)ViewState["CountSeat"]; //kiem tra tuoi if (age2 <= 5) { idPromote = 1; } else if (5 < age2 & age2 <= 12) { idPromote = 2; } else if (12 < age2 & age2 <= 50) { idPromote = 3; } else if (50 < age2) { idPromote = 4; } ViewState["promoteID"] = idPromote; promote = BLLPromote.getPromoteByID(idPromote); lbDiscount.Text = promote.PromoteName.ToString(); lbCustomer2.Text = tbName.Text; lbPromotePrent.Text = promote.Discount.ToString(); lbNumberSeat.Text = arrSeart.Count.ToString(); int countTicket = int.Parse(lbNumberSeat.Text); string litPrice = (MultiView1.Views[1].FindControl("lbPrice2") as Label).Text; float price = float.Parse(litPrice.ToString()); int discount = int.Parse(lbPromotePrent.Text.ToString()); float discoutPrent = (price * discount * countTicket) / 100; ViewState["totalFare"] = price * countTicket; float total = price * countTicket - discoutPrent; //litPromote.Text = discoutPrent.ToString(); lbTotalPrice.Text = total.ToString(); } }
public ActionResult Create(Promote promote) { try { _wineRepository.AddPromote(promote); _wineRepository.Save(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(string id, FormCollection collection) { Promote promote = _wineRepository.FindPromoteById(id); try { UpdateModel(promote); return(RedirectToAction("Index")); } catch { return(View(promote)); } }
public static int UpdatePromote(Promote promote) { int result = 0; try { result = DataAccessHelper.GetPromoteDA().UpdatePromote(promote); } catch (Exception ex) { throw ex; } return(result); }
// // GET: /AdminPromote/Delete/5 public ActionResult Delete(int id, FormCollection collection) { Promote promote = db.PromoteSet.FirstOrDefault(p => p.PromoteId == id); try { db.DeleteObject(promote); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View("Error")); } }
public ActionResult Delete(string id, FormCollection collection) { Promote promote = _wineRepository.FindPromoteById(id); try { _wineRepository.DeletePromote(promote); _wineRepository.Save(); return(RedirectToAction("Index")); } catch { return(View()); } }
public int InsertPromote(Promote promote) { int result = 0; try { String[] columns = { promoteName, discount, status }; Object[] values = { promote.PromoteName, promote.Discount, promote.Status }; result = DALBase.InsertTable(tableName, columns, values); } catch (Exception ex) { throw ex; } return(result); }
public int UpdatePromote(Promote promote) { int result = 0; try { String[] columnNames = { promoteName, discount, status }; Object[] values = { promote.PromoteName, promote.Discount, promote.Status }; String[] keyColumnNames = { promoteID }; Object[] keyColumnValues = { promote.PromoteID }; result = DALBase.UpdateTable(tableName, columnNames, values, keyColumnNames, keyColumnValues); } catch (Exception ex) { throw ex; } return(result); }
protected void lnkBtnSave_Click(object sender, EventArgs e) { string promoteName = PromoteName.Text; string discount = Discount.Text; if (BLLPromote.checkPromoteExistName(promoteName) != 0) { ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Promote Name existed. Please try again');", true); } else { Promote promote = new Promote(); promote.PromoteName = promoteName; promote.Discount = Int32.Parse(discount); promote.Status = true; BLLPromote.InsertPromote(promote); Response.Redirect("PromoteList.aspx"); } }
protected void bntNext(object sender, EventArgs e) { if (MultiView1.ActiveViewIndex == 1) { MultiView1.ActiveViewIndex++; } else if (MultiView1.ActiveViewIndex == 2) { MultiView1.ActiveViewIndex++; } if (MultiView1.ActiveViewIndex == 3) { Promote promote = new Promote(); string age = (MultiView1.Views[2].FindControl("tbBirthday") as TextBox).Text; int age2 = tinhtuoi(age); int idPromote = 0; ArrayList arrSeart = (ArrayList)ViewState["CountSeat"]; //kiem tra tuoi if (age2<=5) idPromote =1; else if (5<age2 & age2<=12) idPromote =2; else if (12< age2 & age2 <=50) idPromote = 3; else if (50 < age2) idPromote = 4; ViewState["promoteID"] = idPromote; promote = BLLPromote.getPromoteByID(idPromote); lbDiscount.Text = promote.PromoteName.ToString(); lbCustomer2.Text = tbName.Text; lbPromotePrent.Text =promote.Discount.ToString(); lbNumberSeat.Text = arrSeart.Count.ToString(); int countTicket = int.Parse(lbNumberSeat.Text); string litPrice = (MultiView1.Views[1].FindControl("lbPrice2") as Label).Text; float price = float.Parse(litPrice.ToString()); int discount = int.Parse(lbPromotePrent.Text.ToString()); float discoutPrent = (price * discount * countTicket) / 100; ViewState["totalFare"] = price * countTicket; float total = price * countTicket - discoutPrent; //litPromote.Text = discoutPrent.ToString(); lbTotalPrice.Text = total.ToString(); } }
protected void lnkBtnSave_Click(object sender, EventArgs e) { string promoteName = PromoteName.Text; string discount = Discount.Text; if (BLLPromote.checkPromoteExistName(promoteName)!= 0) { ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Promote Name existed. Please try again');", true); } else { Promote promote = new Promote(); promote.PromoteName = promoteName; promote.Discount = Int32.Parse(discount); promote.Status = true; BLLPromote.InsertPromote(promote); Response.Redirect("PromoteList.aspx"); } }
public async void PushToCloud(Promote promote) { if (!AppService.IsConnected()) { return; } try { if (!string.IsNullOrEmpty(promote.MSId)) { string id = promote.Id; promote.Id = promote.MSId; promote.MSId = id; await mstPromote.UpdateAsync(promote); promote.Id = id; } else { promote.Id = string.Empty; promote.MSId = string.Empty; await mstPromote.InsertAsync(promote); //AppDatabase.Current.UpdateFavouriteField(favourite.AggregateId, "MSId", favourite.Id, false); } Messenger.Default.Send <GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE" }); } catch { Messenger.Default.Send <GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR" }); } }
protected override void Start() { base.Start(); promote = PromoteController.instance.GetPromote(PromoteType.PopupDialog); StartCoroutine(CUtils.LoadPicture(promote.featureUrl, LoadPictureComplete, promote.featureWidth, promote.featureHeight)); if (!string.IsNullOrEmpty(promote.message)) { promoteMessage.text = promote.message; RectTransform parent = promoteMessage.transform.parent.GetComponent <RectTransform>(); parent.sizeDelta = new Vector2(promoteMessage.preferredWidth + 30, parent.sizeDelta.y); if (promote.rewardType == RewardType.RemoveAds && CUtils.IsAdsRemoved()) { HideText(); } } else { HideText(); } }
private void Reward(string package) { CPlayerPrefs.SetBool(package + "_rewarded", true); Promote promote = promotes.Find(x => x.package == package); if (promote == null) { return; } switch (promote.rewardType) { case RewardType.RemoveAds: CUtils.SetRemoveAds(true); Toast.instance.ShowMessage(promote.rewardMessage); break; case RewardType.Currency: CurrencyController.CreditBalance(promote.rewardValue); Toast.instance.ShowMessage(promote.rewardMessage); break; } }
public ActionResult Edit(string id) { Promote promote = _wineRepository.FindPromoteById(id); return(View(promote)); }
public override List <Move> GenerateMoves(Board board) { var moves = new List <Move>(); Move move; if (Color == Color.White) { var upSquare = From.To(Coordinate.Directions.North); if (upSquare.IsEmpty(board) && From.Rank != 7)//Pawn can go up if it is empty square { move = new Ordinary(board, this, upSquare); moves.Add(move); var twoUpSquare = upSquare.To(Coordinate.Directions.North); if (From.Rank == 2 && twoUpSquare.IsEmpty(board))//Check can jump 2 square when it is on rank 2 { move = new Ordinary(board, this, twoUpSquare); moves.Add(move); } } if (From.Rank != 7) { Coordinate crossSquare = From.To(Coordinate.Directions.NorthEast); //Check for capture if (crossSquare.IsOnboard() && !crossSquare.IsEmpty(board) && crossSquare.GetPiece(board).Color == Color.Black) { moves.Add(new Ordinary(board, this, crossSquare)); } crossSquare = From.To(Coordinate.Directions.NorthWest); if (crossSquare.IsOnboard() && !crossSquare.IsEmpty(board) && crossSquare.GetPiece(board).Color == Color.Black) { moves.Add(new Ordinary(board, this, crossSquare)); } } if (From.Rank == 5)//Check possibility of enpassant move { var crossSquare = From.To(Coordinate.Directions.NorthEast); if (crossSquare.IsOnboard() && crossSquare.Equals(board.EnPassantSquare)) { moves.Add(new EnPassant(board, this, crossSquare)); } else { crossSquare = From.To(Coordinate.Directions.NorthWest); if (crossSquare.IsOnboard() && crossSquare.Equals(board.EnPassantSquare)) { moves.Add(new EnPassant(board, this, crossSquare)); } } } if (From.Rank == 7)//Check pawn promotions { upSquare = From.To(Coordinate.Directions.North); if (upSquare.IsEmpty(board)) { moves.AddRange(Promote.AllPossiblePromotions(board, this, upSquare)); } var crossSquare = From.To(Coordinate.Directions.NorthEast); if (crossSquare.IsOnboard() && !crossSquare.IsEmpty(board) && crossSquare.GetPiece(board).Color == Color.Black) { moves.AddRange(Promote.AllPossiblePromotions(board, this, crossSquare)); } crossSquare = From.To(Coordinate.Directions.NorthWest); if (crossSquare.IsOnboard() && !crossSquare.IsEmpty(board) && crossSquare.GetPiece(board).Color == Color.Black) { moves.AddRange(Promote.AllPossiblePromotions(board, this, crossSquare)); } } } else // For black pawn { var downSquare = From.To(Coordinate.Directions.South); if (downSquare.IsEmpty(board) && From.Rank != 2) { moves.Add(new Ordinary(board, this, downSquare)); var twoDownSquare = downSquare.To(Coordinate.Directions.South); if (From.Rank == 7 && twoDownSquare.IsEmpty(board)) { moves.Add(new Ordinary(board, this, twoDownSquare)); } } if (From.Rank != 2) { var crossSquare = From.To(Coordinate.Directions.SouthEast); if (crossSquare.IsOnboard() && !crossSquare.IsEmpty(board) && crossSquare.GetPiece(board).Color == Color.White) { moves.Add(new Ordinary(board, this, crossSquare)); } crossSquare = From.To(Coordinate.Directions.SouthWest); if (crossSquare.IsOnboard() && !crossSquare.IsEmpty(board) && crossSquare.GetPiece(board).Color == Color.White) { moves.Add(new Ordinary(board, this, crossSquare)); } } if (From.Rank == 4) { var crossSquare = From.To(Coordinate.Directions.SouthEast); if (crossSquare.IsOnboard() && crossSquare.Equals(board.EnPassantSquare)) { moves.Add(new EnPassant(board, this, crossSquare)); } else { crossSquare = From.To(Coordinate.Directions.SouthWest); if (crossSquare.IsOnboard() && crossSquare.Equals(board.EnPassantSquare)) { moves.Add(new EnPassant(board, this, crossSquare)); } } } if (From.Rank == 2) { downSquare = From.To(Coordinate.Directions.South); if (downSquare.IsEmpty(board)) { moves.AddRange(Promote.AllPossiblePromotions(board, this, downSquare)); } var crossSquare = From.To(Coordinate.Directions.SouthEast); if (crossSquare.IsOnboard() && !crossSquare.IsEmpty(board) && crossSquare.GetPiece(board).Color == Color.White) { moves.AddRange(Promote.AllPossiblePromotions(board, this, crossSquare)); } crossSquare = From.To(Coordinate.Directions.SouthWest); if (crossSquare.IsOnboard() && !crossSquare.IsEmpty(board) && crossSquare.GetPiece(board).Color == Color.White) { moves.AddRange(Promote.AllPossiblePromotions(board, this, crossSquare)); } } } return(moves); }
public void AddPromote(Promote promote) { db.Promote.InsertOnSubmit(promote); }
public ActionResult Create() { Promote promote = new Promote(); return(View(promote)); }
public static void CallPromote(int amout) => Promote.Invoke(amout);
public async void SavePromoteToCloud(Promote promote) { if (!AppService.IsConnected()) return; try { //var items = AppDatabase.Current.RetrieveSolutionsByGrouping(sessionId); //foreach (var item in items) //{ AzureMobileService.Current.PushToCloud(promote); //} Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE" }); } catch { Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR" }); } }
public async void PushToCloud(Promote promote) { if (!AppService.IsConnected()) return; try { if (promote.MSId != 0) { int id = promote.Id; promote.Id = promote.MSId; promote.MSId = id; await mstPromote.UpdateAsync(promote); promote.Id = id; } else { promote.Id = 0; await mstPromote.InsertAsync(promote); //AppDatabase.Current.UpdateFavouriteField(favourite.AggregateId, "MSId", favourite.Id, false); } Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE" }); } catch { Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR" }); } }
// // GET: /AdminPromote/Edit/5 public ActionResult Edit(int id) { Promote promote = db.PromoteSet.FirstOrDefault(p => p.PromoteId == id); return(View(promote)); }
public static int InsertPromote(Promote promote) { int result = 0; try { result = DataAccessHelper.GetPromoteDA().InsertPromote(promote); } catch (Exception ex) { throw ex; } return result; }
public int InsertPromote(Promote promote) { int result = 0; try { String[] columns = {promoteName, discount, status }; Object[] values = {promote.PromoteName, promote.Discount, promote.Status}; result = DALBase.InsertTable(tableName, columns, values) ; } catch (Exception ex) { throw ex; } return result; }
public int UpdatePromote(Promote promote) { int result = 0; try { String[] columnNames = { promoteName, discount, status }; Object[] values = { promote.PromoteName, promote.Discount, promote.Status}; String[] keyColumnNames = { promoteID }; Object[] keyColumnValues = {promote.PromoteID}; result = DALBase.UpdateTable(tableName, columnNames, values, keyColumnNames, keyColumnValues); } catch (Exception ex) { throw ex; } return result; }
public void DeletePromote(Promote promote) { db.Promote.DeleteOnSubmit(promote); }