Ejemplo n.º 1
0
 public void Add(Department department)
 {
     if (Get(department.Title) != null)
     {
         throw new Exception("This Department is Aready Exist");
     }
     Management.Add(department);
 }
Ejemplo n.º 2
0
 public void Add(Contract contrat)
 {
     if (Get(contrat.Employee_ID) != null)
     {
         throw new Exception($"Contract Aready Exist");
     }
     Management.Add(contrat);
 }
Ejemplo n.º 3
0
 public void Add(Category category)
 {
     if (Get(category.ID) != null)
     {
         throw new Exception($"This Category ({category.Name}) is Aready Exist");
     }
     Management.Add(category);
 }
Ejemplo n.º 4
0
 public void Add(Producer producer)
 {
     if (Get(producer.Name) != null)
     {
         throw new Exception($"This Producer ({producer.Name}) is Aready Exist");
     }
     Management.Add(producer);
 }
Ejemplo n.º 5
0
 public void Add(Employee employee)
 {
     if (Get(employee.ID) != null)
     {
         throw new Exception($"Employee ({employee.ID}) is Aready Exist");
     }
     Management.Add(employee);
 }
Ejemplo n.º 6
0
 public void Add(Product product)
 {
     if (Get(product.ID) != null)
     {
         throw new Exception($"This Prodcut ({product.ID}) is Aready Exist");
     }
     Management.Add(product);
 }
Ejemplo n.º 7
0
        public void Add(Order order, List <OrderInfo> OrderInfo)
        {
            do
            {
                order.ID = GetNewID();
            } while (Get(order.ID) != null);
            Management.Add(order);
            foreach (var item in OrderInfo)
            {
                Management.Add(new OrderInfo()
                {
                    Order_ID   = order.ID,
                    Product_ID = item.Product_ID,
                    Price      = item.Price,
                    Quantity   = item.Quantity
                });

                Product product = Get_Data.Get_Product(item.Product_ID);
                product.Quantity += item.Quantity;
                new MProducts().Update(product);
            }
        }
Ejemplo n.º 8
0
        public void Update(Order order, List <OrderInfo> OrderInfo)
        {
            Order org = Get(order.ID);

            if (org == null)
            {
                throw new Exception($"Order ({order.ID}) is Not Exist");
            }
            var orgOIs = Get_Data.GetOIs_ByOrder(order.ID);

            var uc = new MCategories().GetUNCategory().ID;
            var up = new MProducers().GetUNProducer().ID;

            foreach (var item in orgOIs)
            {
                var ori     = Get_Data.GetOrderInfo(item.Order_ID, item.Product_ID);
                var pi      = OrderInfo.Where(i => i.Product_ID == item.Product_ID).FirstOrDefault();
                var product = Get_Data.Get_Product(item.Product_ID);

                if (pi != null)
                {
                    pi.ID       = ori.ID;
                    pi.Order_ID = order.ID;
                    if (pi.Quantity != item.Quantity)
                    {
                        if (pi.Quantity > item.Quantity)
                        {
                            product.Quantity += (pi.Quantity - item.Quantity);
                        }
                        else if (pi.Quantity < item.Quantity)
                        {
                            product.Quantity -= (item.Quantity - pi.Quantity);
                        }
                        if (product.Quantity < 0)
                        {
                            product.Quantity = 0;
                        }

                        Management.Detach(ori);
                        Management.Update(pi);
                    }
                }
                else
                {
                    product.Quantity -= item.Quantity;
                    Management.Remove(item);
                }
                new MProducts().Update(product);
            }
            foreach (var item in OrderInfo.Where(i => String.IsNullOrEmpty(i.Order_ID)).ToList())
            {
                Management.Add(new OrderInfo()
                {
                    Order_ID   = order.ID,
                    Product_ID = item.Product_ID,
                    Price      = item.Price,
                    Quantity   = item.Quantity
                });

                Product product = Get_Data.Get_Product(item.Product_ID);
                product.Quantity += item.Quantity;
                new MProducts().Update(product);
            }
        }
Ejemplo n.º 9
0
 public void Add(Pharmacy pharmacy)
 {
     Management.Add(pharmacy);
 }
Ejemplo n.º 10
0
 public string Getadd()
 {
     return(Management.Add());
 }
Ejemplo n.º 11
0
        public override Task DivideLine(string line)
        {
            if (line.Length < 5)
            {
                Console.WriteLine("Line too small, skipped.");
            }

            else if (line.Contains("'s application. ("))
            {
                Applications.Add(line);
            }
            else if (line.Contains(" has submitted an application."))
            {
                Applications.Add(line);
            }

            else if (line.Contains(" is promoting "))
            {
                RankChanges.Add(line);
            }
            else if (line.Contains(" is demoting "))
            {
                RankChanges.Add(line);
            }

            else if (line.Contains(") joined the group"))
            {
                JoinsDepartures.Add(line);
            }
            else if (line.Contains(" has kicked "))
            {
                JoinsDepartures.Add(line);
            }
            else if (line.Contains(") left the group as "))
            {
                JoinsDepartures.Add(line);
            }

            else if (line.Contains(" deposited to "))
            {
                Bank.Add(line);
            }
            else if (line.Contains(" in the group bank"))
            {
                Bank.Add(line);
            }
            else if (line.Contains(" group bank for reason:"))
            {
                Bank.Add(line);
            }
            else if (line.Contains(" withdrew "))
            {
                Bank.Add(line);
            }

            else if (line.Contains(") updated the group info"))
            {
                Management.Add(line);
            }
            else if (line.Contains(" has updated group application."))
            {
                Management.Add(line);
            }
            else if (line.Contains(" blacklist."))
            {
                Management.Add(line);
            }
            else if (line.Contains("updated the group whitelist"))
            {
                Management.Add(line);
            }

            else if (line.Contains(") warned "))
            {
                Warnings.Add(line);
            }
            else if (line.Contains(") rewarded "))
            {
                Warnings.Add(line);
            }

            else if (line.Contains(") has promoted group: "))
            {
                Management.Add(line);
            }
            else if (line.Contains(") updated rank: "))
            {
                Management.Add(line);
            }
            else if (line.Contains(") added rank: "))
            {
                Management.Add(line);
            }
            else if (line.Contains(") removed rank: "))
            {
                Management.Add(line);
            }

            else if (line.Contains("custom title"))
            {
                CustomTitle.Add(line);
            }

            else
            {
                Other.Add(line);
            }
            return(Task.CompletedTask);
        }