private Order NottifyOnProcassOrder(Order order, User user) { order.ProcessDateTime = DateTime.Now.ToString(); order.OrderStatus = new OrderStatus() { IsInProgress = true }; order = OrdersRepository.SaveOrUpdate(order); NotificateEmployee(order); user.Orders.Remove(order); user.OrdersHistory.Add(order); UserRepository.SaveOrUpdate(user); return order; }
private Order UpdateOrder(OrderMakerModel model, Order order) { if (string.IsNullOrEmpty(model.Comments)) { order.Comments = model.Comments; } if (string.IsNullOrEmpty(model.Email)) { order.Email = model.Comments; } order = OrdersRepository.SaveOrUpdate(order); return order; }
private Order AddOrderToBascet(User user, Product product) { Order order = new Order() { Email = !string.IsNullOrEmpty(user.Email) ? user.Email : "*****@*****.**", User = user, Product = product, Comments = DefaultComments }; order = OrdersRepository.SaveOrUpdate(order); user.AddOrder(order); UserRepository.SaveOrUpdate(user); return order; }
private static void NotificateEmployee(Order order) { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("mail.infobox.ru"); SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "atlzatlz1"); SmtpServer.Port = 25; //SmtpServer.EnableSsl = true; mail.From = new MailAddress("*****@*****.**"); mail.To.Add(order.Product.Employee.Email); mail.Subject = "Замовлення від" + order.Email; mail.Body = @"Ваш товаор " + order.Product.Name + " замовили." + "Пошта замовника: " + order.Email + "Замовлення здійснена" + order.ProcessDateTime; if (order.Comments != DefaultComments) { mail.Body = mail.Body + "Замрвник додав коментар." + order.Comments; } SmtpServer.Send(mail); }
public virtual Order DeleteOrder(Order order) { order.User = null; Orders.Remove(order); return order; }
public virtual Order AddOrdersHistory(Order order) { OrdersHistory.Add(order); return order; }
public virtual Order AddOrder(Order order) { Orders.Add(order); order.User = this; return order; }