/// <summary> /// Update an order. /// </summary> /// <param name="orderId">Id of the order.</param> /// <param name="description">Description of the order.</param> /// <param name="method">Payment method of the order.</param> /// <param name="paymentDate">Payment date of the order.</param> /// <param name="billDate">Bill date of the order.</param> /// <param name="status">Status of the order.</param> public void UpdateOrder(Guid orderId, String description, String method, String paymentDate, String billDate, int status) { OrderOfService order = OD.GetOrder(orderId); if (description != null) { order.OrderOfService_Description = description; } if (method != null) { order.OrderOfService_PaymentMethod = method; } if (paymentDate != null) { order.OrderOfService_PaymentDate = DateTime.Parse(paymentDate); } if (billDate != null) { order.OrderOfService_BillDate = DateTime.Parse(billDate); } order.OrderOfService_Status = status; int result = OD.UpdateOrder(order); if (result == -1) { throw new Exception("An error occurred while executing this operation."); } }
public OutputStockFunerary StartMapper(OrderOfService orderOfService) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <OrderOfService, OutputStockFunerary>() .ForMember(x => x.CompanyControl, opt => opt.Ignore()) .ForMember(x => x.CompanyControlId, opt => opt.Ignore()) .ForMember(x => x.DateRegistration, opt => opt.Ignore()) .ForMember(x => x.DateUpdate, opt => opt.Ignore()) .ForMember(x => x.Id, opt => opt.Ignore()) .ForMember(x => x.Integration, opt => opt.Ignore()) .ForMember(x => x.Status, opt => opt.Ignore()) .ForMember(x => x.UserControl, opt => opt.Ignore()) .ForMember(x => x.UserControlId, opt => opt.Ignore()) .ForMember(x => x.OrderOfServiceId, opt => opt.MapFrom(x => x.Id)) .ForMember(x => x.DateInput, opt => opt.MapFrom(x => x.DateOfIssure)) .ForMember(x => x.PersonId, opt => opt.MapFrom(x => x.ContractorId)) .ForMember(x => x.TypeIntegration, opt => opt.MapFrom(x => TypeIntegration.OutputStock)) .ForMember(x => x.TypeIntegrationId, opt => opt.MapFrom(x => (int)TypeIntegration.OutputStock)) .ForMember(x => x.Code, opt => opt.MapFrom(x => x.NumberOs)) .ForMember(x => x.Origin, opt => opt.MapFrom(x => typeof(OrderOfService).Name)); }); IMapper mapper = config.CreateMapper(); var obj = mapper.Map <OrderOfService, OutputStockFunerary>(orderOfService); return(obj); }
/// <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> /// Restore an order. /// </summary> /// <param name="orderId">Id of the order.</param> public void RestoreOrder(Guid orderId) { try { String where = "OrderOfService_Id = '{0}'"; if (orderId != null) { where = String.Format(where, orderId.ToString()); } else { where = ""; } OrderOfService order = OD.GetOrder(orderId); order.OrderOfService_IsDelete = false; int result = OD.UpdateOrder(order); if (result == -1) { throw new Exception("An error occurred while executing this operation."); } // Restore order details. RestoreOrderDetails(orderId); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// Get all orders in database. /// </summary> /// <param name="isDelete">True if these oders is deleted, false otherwise.</param> /// <returns>A list object of order type.</returns> public List <OrderOfService> GetOrders(bool isDelete) { List <OrderOfService> list = new List <OrderOfService>(); List <Object> listObj = DBHelper.Instance.Select("OrderOfService", String.Format("OrderOfService_IsDelete = '{0}'", isDelete), null, -1, -1); foreach (Object item in listObj) { OrderOfService oos = (OrderOfService)item; list.Add(oos); } return(list); }
/// <summary> /// Get an order by order's id. /// </summary> /// <param name="id">Id of order.</param> /// <returns>An order object.</returns> public Order GetOrder(Guid id) { try { Order order = new Order(); OrderOfService orderService = OD.GetOrder(id); FillDataToOrder(order, orderService); return(order); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// Remove an order. /// </summary> /// <param name="orderId">Id of the order.</param> public void RemoveOrder(Guid orderId) { try { // Remove order's details. RemoveOrderDetails(orderId); OrderOfService order = OD.GetOrder(orderId); order.OrderOfService_IsDelete = true; int result = OD.UpdateOrder(order); if (result == -1) { throw new Exception("An error occurred while executing this operation."); } } catch (Exception ex) { throw new Exception(ex.Message); } }
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); }
/// <summary> /// Get all orders in database by id. /// </summary> /// <param name="isDelete">True if these oders is deleted, false otherwise.</param> /// <param name="type">Type of id.</param> /// <returns>A list object of order type.</returns> public List <OrderOfService> GetOrders(Guid id, String type, bool isDelete) { String content = "{0}_Id = '{1}' AND"; if (id != null && !String.IsNullOrEmpty(type)) { content = String.Format(content, type, id); } else { content = ""; } List <OrderOfService> list = new List <OrderOfService>(); List <Object> listObj = DBHelper.Instance.Select("OrderOfService", String.Format("{0} OrderOfService_IsDelete = '{1}'", content, isDelete), null, -1, -1); foreach (Object item in listObj) { OrderOfService oos = (OrderOfService)item; list.Add(oos); } return(list); }
public bool InsertOrUpdate(OrderOfService OrderOfService) { return(_epr.InsertOrUpdate(OrderOfService)); }
public bool Save(OrderOfService OrderOfService) { _OrderOfServiceApp.InsertOrUpdate(OrderOfService); return(_connection.Save()); }
/// <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()))); }
/// <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)); }