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 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);
            }
        }