public void Add(Department department) { if (Get(department.Title) != null) { throw new Exception("This Department is Aready Exist"); } Management.Add(department); }
public void Add(Contract contrat) { if (Get(contrat.Employee_ID) != null) { throw new Exception($"Contract Aready Exist"); } Management.Add(contrat); }
public void Add(Category category) { if (Get(category.ID) != null) { throw new Exception($"This Category ({category.Name}) is Aready Exist"); } Management.Add(category); }
public void Add(Producer producer) { if (Get(producer.Name) != null) { throw new Exception($"This Producer ({producer.Name}) is Aready Exist"); } Management.Add(producer); }
public void Add(Employee employee) { if (Get(employee.ID) != null) { throw new Exception($"Employee ({employee.ID}) is Aready Exist"); } Management.Add(employee); }
public void Add(Product product) { if (Get(product.ID) != null) { throw new Exception($"This Prodcut ({product.ID}) is Aready Exist"); } Management.Add(product); }
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); } }
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); } }
public void Add(Pharmacy pharmacy) { Management.Add(pharmacy); }
public string Getadd() { return(Management.Add()); }
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); }