/// <summary> /// Create an order. /// </summary> /// <param name="order">The object of order that you want to create.</param> public void CreateOrder(Guid OrderOfService_Id, Guid Company_Id, Guid Employee_Id, String OrderOfService_Description, String OrderOfService_PaymentMethod, DateTime OrderOfService_PaymentDate, DateTime OrderOfService_BillDate, int OrderOfService_Status) { try { OrderOfService order = new OrderOfService(); order.Company_Id = Company_Id; order.Employee_Id = Employee_Id; order.OrderOfService_BillDate = OrderOfService_BillDate; order.OrderOfService_Description = OrderOfService_Description; order.OrderOfService_Id = OrderOfService_Id; order.OrderOfService_PaymentDate = OrderOfService_PaymentDate; order.OrderOfService_PaymentMethod = OrderOfService_PaymentMethod; order.OrderOfService_Status = OrderOfService_Status; int result = OD.CreateOrder(order); if (result == -1) { throw new Exception("An error occurred while executing this operation."); } } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// Create an order. /// </summary> /// <param name="order">The object of order that you want to create.</param> /// <returns>Return the number of rows affected or return -1 if occur exception.</returns> public int CreateOrder(OrderOfService order) { return DBHelper.Instance.Insert(order); }
/// <summary> /// Update order's information. /// </summary> /// <param name="order">The order be updated.</param> /// <returns>Return the number of rows affected or return -1 if occur exception.</returns> public int UpdateOrder(OrderOfService order) { return DBHelper.Instance.Update(order, String.Format("OrderOfService_Id = '{0}'", order.OrderOfService_Id.ToString())); }
private void FillDataToOrder(Order order, OrderOfService orderService) { order.OrderOfService_Id = orderService.OrderOfService_Id; order.Company_Id = orderService.Company_Id; order.Employee_Id = orderService.Employee_Id; order.OrderOfService_BillDate = orderService.OrderOfService_BillDate.ToShortDateString(); order.OrderOfService_Description = orderService.OrderOfService_Description; order.OrderOfService_IsDelete = orderService.OrderOfService_IsDelete; order.OrderOfService_PaymentDate = orderService.OrderOfService_PaymentDate.ToShortDateString(); order.OrderOfService_PaymentMethod = orderService.OrderOfService_PaymentMethod; switch (orderService.OrderOfService_Status) { case 0: order.OrderOfService_Status = "Pending"; break; case 99: order.OrderOfService_Status = "In Progress"; break; case 1: order.OrderOfService_Status = "Resolved"; break; default: break; } CompanyBLL CB = new CompanyBLL(); DataRow company = CB.Company_ShowOnewDisplay(orderService.Company_Id.ToString()); order.Company_Name = company["Company_Name"].ToString(); AccountBusiness AB = new AccountBusiness(); Account account = AB.GetAccountOfEmployee(orderService.Employee_Id); order.Account_UserName = account.Account_UserName; CalculateServicesAndCharges(order, order.OrderOfService_IsDelete); }