public IActionResult AddPrice(AddPrice obj)
        {
            Follow_Up_Type b = new Follow_Up_Type();

            b.Name = obj.ServiceName;

            var NameExist = _auc.Follow_Ups_Types.ToList().Any(u => u.Name == b.Name);

            if (NameExist)
            {
                ViewBag.Fail = "This service already exists.";
                return(View());
            }

            else
            {
                b.Price = obj.ServicePrice;

                _auc.Add(b);
                _auc.SaveChanges();
                ViewBag.Success = "Service is added successfully";

                return(View());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 报价
        /// </summary>
        private void AddPrice()
        {
            int    num       = 0;
            string price     = CRequest.GetString("price");
            string productId = CRequest.GetString("productId");

            if (price != "" && productId != "")
            {
                UserInfo user = Session["user"] as UserInfo;
                if (user != null)
                {
                    AddPrice ad = new AddPrice();
                    ad.productId = Convert.ToInt32(productId);
                    ad.price     = Convert.ToDouble(price);
                    ad.addUser   = user.id;
                    ad.addTime   = DateTime.Now;
                    ad.status    = 0;
                    ad.remark    = "";
                    ad.infoType  = 0;
                    num          = AddPriceService.Add(ad);
                }
            }
            if (num > 0)
            {
                Response.Write("success");
            }
            else
            {
                Response.Write("fail");
            }
        }
Ejemplo n.º 3
0
 private void AddingButton_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(AddName.Text) && !string.IsNullOrWhiteSpace(AddDescription.Text) && !string.IsNullOrWhiteSpace(AddPrice.Text) && !string.IsNullOrWhiteSpace(AddQuantity.Text))
     {
         try
         {
             string InsertQuery = "insert into items(ITEM_NAME,ITEM_PRICE,ITEM_DESCRIPTION,ITEM_QUANTATY) VALUES('" + AddName.Text + "','" + int.Parse(AddPrice.Text) + "','" + AddDescription.Text + "'," + int.Parse(AddQuantity.Text) + ")";
             connection.Open();
             MySqlCommand cmd = new MySqlCommand(InsertQuery, connection);
             cmd.ExecuteNonQuery();
         }
         catch (MySqlException ex)
         {
             MessageBox.Show(ex.ToString());
         }
         finally
         {
             connection.Close();
             MessageBox.Show("Successfully Added", "Success");
             AddName.Clear();
             AddDescription.Clear();
             AddPrice.Clear();
             AddQuantity.Clear();
         }
     }
     else
     {
         MessageBox.Show("incorrect input", "ERROR");
     }
 }
Ejemplo n.º 4
0
        private async void ChangeLitrage(object sender, RoutedEventArgs e)
        {
            var menuItem = (MenuItem)e.Source;
            var menu     = (ContextMenu)menuItem.Parent;
            var key      = ((FuelCard)(((DockPanel)menu.PlacementTarget).DataContext)).FuelGuid;

            var wind = new AddPrice(key)
            {
                Owner = Window.GetWindow(this)
            };

            wind.ShowDialog();
            await Refresh();
        }
        public IActionResult Deleteprice(AddPrice vm)
        {
            var NameExist = _auc.Follow_Ups_Types.ToList().Any(u => u.Name == vm.ServiceName);

            if (NameExist)
            {
                var serviceName = _auc.Follow_Ups_Types.Where(f => f.Name == vm.ServiceName)
                                  .Select(s => s.Id).Single();

                var model = _auc.Follow_Ups_Types.Find(serviceName);
                _auc.Remove(model);

                _auc.SaveChanges();
                ViewBag.Success = "This service is deleted successfully";
                return(View());
            }
            else
            {
                ViewBag.fail = "This Service doesn't exist";
                return(View());
            }
        }
Ejemplo n.º 6
0
 public void Add(float price)
 {
     prices.Add(price);
     AddPrice?.Invoke(this, price);
 }
Ejemplo n.º 7
0
        public void newPrice(Product product)
        {
            var ap = new AddPrice();

            ap.newPrice(product);
        }