public void AddDealer(object Parameter) { dealer ob = new dealer(); ob.id = 0; ob.dealer_address = DealerAddress; ob.dealer_name = DealerName; List <dealer> temp = DelarServices.GetDelarByName(ob.dealer_name.Trim()); if (temp.Count == 0) { int temp_dealerid = DelarServices.AddUpdateDealer(ob); if (temp_dealerid > 0) { // MessageBox.Show("Dealer added successfully"); InventoryHelper.SuccessAlert("Success", "Dealer added successfully"); DealerAddress = ""; DealerName = ""; } } else { InventoryHelper.SimpleAlert("Warning", "Dealer Name already Exist"); //MessageBox.Show("Dealer Name already Exist"); } }
public ActionResult DeleteConfirmed(int id) { dealer dealer = db.dealers.Find(id); db.dealers.Remove(dealer); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "dealernr,naam")] dealer dealer) { if (ModelState.IsValid) { db.Entry(dealer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dealer)); }
public ActionResult Create([Bind(Include = "dealernr,naam")] dealer dealer) { if (ModelState.IsValid) { db.dealers.Add(dealer); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dealer)); }
// GET: dealers/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } dealer dealer = db.dealers.Find(id); if (dealer == null) { return(HttpNotFound()); } return(View(dealer)); }
private void RegisterDealerFn(object sender, RoutedEventArgs e) { CarDealershipAppDBEntities db = new CarDealershipAppDBEntities(); dealer dealerObj = new dealer() { name = txtName.Text, surname = txtSurname.Text, pesel = txtPesel.Text, employment_date = int.Parse(txtDate.Text), }; db.dealers.Add(dealerObj); db.SaveChanges(); MessageBox.Show("Dealer registered!"); }
public void UpdateDealer(object parameter) { int delar_id = 0; TextBox tb = (TextBox)parameter; int.TryParse(tb.Text, out delar_id); if (delar_id > 0) { dealer ob_dealer = Delars.Where(s => s.id == delar_id).First(); List <dealer> temp_list = DelarServices.GetDelarByName(ob_dealer.dealer_name.Trim()); if (temp_list.Count == 0 || temp_list.Count == 1) { if (temp_list.Count == 1) { dealer temp = temp_list.FirstOrDefault(); if (temp.id != ob_dealer.id) { BindGrid(); RaisedPropertyChanged("Delars"); return; } } int temp_delar_id = DelarServices.AddUpdateDealer(ob_dealer); if (temp_delar_id == ob_dealer.id) { //MessageBox.Show("Dealer " + ob_dealer.dealer_name + " is Updated"); InventoryHelper.SuccessAlert("Success", "Dealer " + ob_dealer.dealer_name + " is Updated"); BindGrid(); RaisedPropertyChanged("Delars"); } } else { // MessageBox.Show("Dealer Name already Exist"); InventoryHelper.SimpleAlert("Warning", "Dealer Name already Exist"); } } }
//private string NextCard; //Deck myDeck = new Deck(); //private string[] hand = { "", "" }; //public string[] Hands //{ // get { return hand; } //} // Default constructor: //public DealCards2() //{ // this.hand[0] = "h7"; // this.hand[1] = "dq"; //} public DealCards2(int iplayers, player player1, player player2, player player3, dealer dealer, Game.Deck myDeck) { // DrawCard DrawCard = new DrawCard(); // for (int i = 0; i < iplayers; i++) // { // switch (i) // { // case 0: // this.Players[i] = player1; // this.Players[i].Cards.Add(DrawCard.NewCard(myDeck)); // this.Players[i].Cards.Add(DrawCard.NewCard(myDeck)); // //this.Players[i].Cards.Add(myDeck.NextCard()); // //this.Players[i].Cards.Add(myDeck.NextCard()); // //this.Players[i].Name = player1.Name; // break; // case 1: // this.Players[i] = player2; // this.Players[i].Cards.Add(DrawCard.NewCard(myDeck)); // this.Players[i].Cards.Add(DrawCard.NewCard(myDeck)); // //this.Players[i].Name = player2.Name; // break; // case 2: // this.Players[i] = player3; // this.Players[i].Cards.Add(DrawCard.NewCard(myDeck)); // this.Players[i].Cards.Add(DrawCard.NewCard(myDeck)); // //Players[i].Cards.Add( // //this.Players[i].Name = player3.Name; // break; // } // } // this.DealerHand = dealer; // this.DealerHand.Cards.Add(DrawCard.NewCard(myDeck)); // this.DealerHand.Cards.Add(DrawCard.NewCard(myDeck)); //} //public class DrawCard //{ // private string sDrawCard; // public string Drawcard // { // get { return sDrawCard; } // } // public string NewCard(Game.Deck myDeck) // { // Random random = new Random(); // int num; // if (myDeck.CardsInDeck > 0) // { // num = random.Next(myDeck.CardsInDeck); // } // else // { // myDeck = new Game.Deck(); // num = random.Next(myDeck.CardsInDeck); // } // sDrawCard = myDeck.NextCard(); // myDeck.Remove(sDrawCard); // myDeck.CardsInDeck--; // return sDrawCard; // } }
public static int AddUpdateDealer(dealer ob) { return(DelarProvider.AddUpdateDealer(ob)); }