private void InitializeData() { _business = new RegularOrderBusiness(SystemParam.CurrentUser); _orderItemBusiness = new OrderItemBusiness(); _revenueBusiness = new RevenueBusiness(SystemParam.CurrentUser); _checkedRows = new Collection <DataGridViewRow>(); dgvOrdersList.AutoGenerateColumns = false; dgvItemsList.AutoGenerateColumns = false; chkUseAdjustment.Checked = false; tbAdjustmentAmount.Enabled = false; tbAdjustmentReason.Enabled = false; // Initializes header checkbox _chkOrdersListHeaderSelectAll = new CheckBox(); var orderListFirstColumnHeaderCell = this.dgvOrdersList.Columns[0].HeaderCell; _chkOrdersListHeaderSelectAll.BackColor = orderListFirstColumnHeaderCell.Style.BackColor; _chkOrdersListHeaderSelectAll.Checked = true; _chkOrdersListHeaderSelectAll.Location = new Point(9, 5); _chkOrdersListHeaderSelectAll.Size = new Size(16, 16); _chkOrdersListHeaderSelectAll.CheckedChanged += new EventHandler(chkOrdersListHeaderSelectAll_CheckedChanged); this.dgvOrdersList.Controls.Add(_chkOrdersListHeaderSelectAll); }
private void InitializeData() { _business = new OrderItemBusiness(); _transportPriceBusiness = new TransportPriceConfigurationBusiness(); _guaranteeFeeBusiness = new GuaranteeFeeConfigurationBusiness(); _transportPriceConfigurations = new Collection <TransportPriceConfiguration>(_transportPriceBusiness.GetAll().ToList()); if (_transportPriceConfigurations.Count == 0) { tbWeight.Enabled = false; cboSize.Enabled = false; } _guaranteeFeeConfigurations = new Collection <GuaranteeFeeConfiguration>(_guaranteeFeeBusiness.GetAll().ToList()); if (_guaranteeFeeConfigurations.Count == 0) { tbValuePrice.Enabled = false; } List <string> sizes = new List <string>(); sizes.Add("XS"); sizes.Add("S"); sizes.Add("M"); sizes.Add("L"); sizes.Add("XL"); this.cboSize.DataSource = sizes; }
public IActionResult AddOrderItem([FromRoute] OrderItemDTO orderItem) { try { var orderService = new OrderItemBusiness(unitOfWork); var addedOrder = orderService.AddOrderItem(orderItem); return(Ok(new RequestResult() { IsSucceeded = true, Result = addedOrder, Message = "OrderItem successfully added" })); } catch (InvalidObjectException exception) { return(BadRequest(new RequestResult() { IsSucceeded = false, Result = exception.InvalidObject, Message = $"{exception.ObjectName} : {exception.ErrorMessages.ToArray().ToString()}", })); } catch (Exception exception) { return(BadRequest(new RequestResult() { IsSucceeded = false, Result = orderItem, Message = exception.Message })); } }
public List <TOrderItem> SyncOrderItem() { try { IEnumerable <OrderHistory> changedOrderIds; using (ThanhVanTranSysEntities context = new ThanhVanTranSysEntities()) using (OrderItemBusiness business = new OrderItemBusiness()) { changedOrderIds = context.OrderHistories .Where(i => i.date_time.Year == DateTime.Now.Year && i.date_time.Month == DateTime.Now.Month && i.date_time.Day == DateTime.Now.Day) .OrderBy(i => i.order_id).ThenBy(i => i.date_time); var orderItems = (from oi in business.GetAll() join co in changedOrderIds on oi.order_id equals co.order_id select ThriftUtil.ConvertToTOrderItem(oi, co.action == Constants.DELETE_ACTION)).ToList(); return(orderItems); } } catch (Exception exc) { ServerLogger.logError("[SyncOrderItem]", exc); return(new List <TOrderItem>()); } }
public string SyncOrderItems() { string errorMessage = string.Empty; try { List <TOrderItem> torderitem = ServerConnector.GetInstance().SyncOrderItemRequest(); using (OrderItemBusiness business = new OrderItemBusiness()) { foreach (var item in torderitem) { business.DeleteByOrderId(item.OrderId); } } //TOrderItem AppLogger.logInfo("SyncOrderItems", "[TOrderItem]"); errorMessage = SyncObject <TOrderItem, OrderItem>(torderitem); } catch (Exception exc) { AppLogger.logError("SyncOrderItems", exc); return(exc.Message); } return(errorMessage); }
public PaymentDetailPresenter(IPaymentDetailView view, Order order, Customer customer) { _businessOrder = new OrderBusiness(Singleton <PosEngine> .Instance.Resolve <IRepository <Order> >()); _businessOrderItem = new OrderItemBusiness(Singleton <PosEngine> .Instance.Resolve <IRepository <OrderItem> >()); _businessCustmer = new CustomerBusiness(Singleton <PosEngine> .Instance.Resolve <IRepository <Customer> >()); _view = view; _model = new PaymentDetailModel(order, customer); _view.InitView(_model); }
public SalePresenter(ISaleView view) { _business = new OrderBusiness(Singleton <PosEngine> .Instance.Resolve <IRepository <Order> >()); _businessItems = new OrderItemBusiness(Singleton <PosEngine> .Instance.Resolve <IRepository <OrderItem> >()); _businessCustomer = new CustomerBusiness(Singleton <PosEngine> .Instance.Resolve <IRepository <Customer> >()); _businessProduct = new ProductBusiness(Singleton <PosEngine> .Instance.Resolve <IRepository <Product> >()); _view = view; _model = new SaleModel(new Customer()); _view.InitView(_model); }
public string CreateOrder(TOrder torder, List <TOrderItem> torderItems, string userId) { try { //Check Order string errorMessage = CheckOrder(torder); //check OrderItem List <OrderItem> orderItems = ThriftUtil.ConvertToOrderItemList(torderItems); errorMessage += CheckOrderItems(orderItems); if (string.IsNullOrEmpty(errorMessage) == false) { return(errorMessage); } string orderId = string.Empty; //Insert Order if (torder.Type == Constants.VALUE_ORDER_TYPE_REGULAR) { using (RegularOrderBusiness business = new RegularOrderBusiness()) { business.Insert(ThriftUtil.ConvertToRegualrOrder(torder)); } } else { using (IrregularOrderBusiness business = new IrregularOrderBusiness()) { business.Insert(ThriftUtil.ConvertToIrregularOrder(torder)); } } using (OrderItemBusiness business = new OrderItemBusiness()) { business.Insert(orderItems); } //notify to the others client station //torder.OrderId = orderId; //BroadcastToClient(ClientAction.CreateOrder,order,orderItems); return(""); } catch (Exception exc) { ServerLogger.logError("[CreateOrder]", exc); return(exc.Message); } }
public List <TOrderItem> LoadOrderItem() { try { using (OrderItemBusiness business = new OrderItemBusiness()) { return(business.GetAll().ToList().Select(i => ThriftUtil.ConvertToThriftObject(i) as TOrderItem).ToList()); } } catch (Exception exc) { ServerLogger.logError("[LoadOrderItem]", exc); return(new List <TOrderItem>()); } }
public string UpdateOrderInfo(TOrder torder, List <TOrderItem> orderItems, string userId) { try { //Check Order string errorMessage = CheckOrder(torder, true); //check OrderItem errorMessage += orderItems.Count == 0 ? "Không có thông tin hàng hóa" : ""; if (string.IsNullOrEmpty(errorMessage) == false) { return(errorMessage); } if (torder.Type == Constants.VALUE_ORDER_TYPE_REGULAR) { using (RegularOrderBusiness business = new RegularOrderBusiness()) { business.Update(ThriftUtil.ConvertToEntityObject(torder) as RegularOrder); } } else { using (IrregularOrderBusiness business = new IrregularOrderBusiness()) { business.Update(ThriftUtil.ConvertToEntityObject(torder) as IrregularOrder); } } using (OrderItemBusiness business = new OrderItemBusiness()) { business.DeleteByOrderId(torder.OrderId); business.Insert(ThriftUtil.ConvertToOrderItemList(orderItems).Cast <OrderItem>()); } //notify to the others client station //BroadcastToClient(ClientAction.UpdateOrder,order,orderItems); return(""); } catch (Exception exc) { ServerLogger.logError("[UpdateOrderInfo]", exc); return(exc.Message); } }
/// <summary> /// CompleteOrder (just using for Irregular Order) /// </summary> /// <param name="order"></param> /// <returns></returns> public string DeleteOrder(TOrder order, string userId) { try { // Check Order string errorMessage = CheckOrder(order, true); if (string.IsNullOrEmpty(errorMessage) == false) { return(errorMessage); } // Delete if (order.Type == Constants.VALUE_ORDER_TYPE_REGULAR) { RegularOrderBusiness business = new RegularOrderBusiness(); business.Delete(order.OrderId); } else { IrregularOrderBusiness business = new IrregularOrderBusiness(); business.Delete(order.OrderId); } OrderItemBusiness itemBusiness = new OrderItemBusiness(); itemBusiness.DeleteByOrderId(order.OrderId); ////notify to the others client station ////BroadcastToClient(ClientAction.CompleteOrder,order); return(""); } catch (Exception exc) { ServerLogger.logError("[DeleteOrder]", exc); return(exc.Message); } }