Esempio n. 1
0
        public OrderEntity GetOrderByID(string orderid, string agentid, string clientid)
        {
            DataSet ds = OrdersDAL.BaseProvider.GetOrderByID(orderid, agentid, clientid);
            OrderEntity model = new OrderEntity();
            if (ds.Tables["Order"].Rows.Count > 0)
            {
                
                model.FillData(ds.Tables["Order"].Rows[0]);
                model.Owner = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, model.AgentID);

                model.StatusStr = CommonBusiness.GetEnumDesc((EnumOrderStageStatus)model.Status);
                model.ExpressTypeStr = CommonBusiness.GetEnumDesc((EnumExpressType)model.ExpressType);

                if (model.Status == 2)
                {
                    model.SendStatusStr = CommonBusiness.GetEnumDesc((EnumSendStatus)model.SendStatus);
                }
                else if (model.Status < 2)
                {
                    model.SendStatusStr = "--";
                }


                if (!string.IsNullOrEmpty(model.CategoryID))
                {
                    model.CategoryName = ProductsBusiness.BaseBusiness.GetCategoryByID(model.BigCategoryID).CategoryName + ">" + ProductsBusiness.BaseBusiness.GetCategoryByID(model.CategoryID).CategoryName;
                }
                model.OrderProcess = SystemBusiness.BaseBusiness.GetOrderProcessByID(model.ProcessID, model.AgentID, model.ClientID);
                                
                model.OrderProcess.OrderStages = SystemBusiness.BaseBusiness.GetOrderStages(model.ProcessID, model.AgentID, model.ClientID);

                model.Tasts = new List<IntFactoryEntity.Task.TaskEntity>();
                if (model.Status > 0 && ds.Tables["Tasks"].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables["Tasks"].Rows)
                    {
                        IntFactoryEntity.Task.TaskEntity task = new IntFactoryEntity.Task.TaskEntity();
                        task.FillData(dr);
                        task.Owner = OrganizationBusiness.GetUserByUserID(task.OwnerID, model.AgentID);
                        model.Tasts.Add(task);
                    }
                    
                }
                model.StatusItems = new List<OrderStatusEntity>();
                if (model.Status > 0 && ds.Tables["Status"].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables["Status"].Rows)
                    {
                        OrderStatusEntity status = new IntFactoryEntity.OrderStatusEntity();
                        status.FillData(dr);
                        model.StatusItems.Add(status);
                    }
                }

                model.City = CommonBusiness.GetCityByCode(model.CityCode);

                if (ds.Tables["Customer"].Rows.Count > 0)
                {
                    model.Customer = new CustomerEntity();
                    model.Customer.FillData(ds.Tables["Customer"].Rows[0]);
                }
                model.Details = new List<OrderDetail>();
                foreach (DataRow dr in ds.Tables["Details"].Rows)
                {
                    OrderDetail detail = new OrderDetail();
                    detail.FillData(dr);
                    if (!string.IsNullOrEmpty(detail.UnitID))
                    {
                        detail.UnitName = new ProductsBusiness().GetUnitByID(detail.UnitID).UnitName;
                        
                    }
                    model.Details.Add(detail);
                }
                
                model.OrderGoods = new List<OrderGoodsEntity>();
                if (ds.Tables["Goods"].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables["Goods"].Rows)
                    {
                        OrderGoodsEntity detail = new OrderGoodsEntity();
                        detail.FillData(dr);
                        model.OrderGoods.Add(detail);
                    }
                }  
            }
            return model;
        }
Esempio n. 2
0
        public List<OrderEntity> GetOrdersByMobilePhone(string mobilePhone)
        {
            List<OrderEntity> list = new List<OrderEntity>();
            DataSet ds = OrdersDAL.BaseProvider.GetOrdersByMobilePhone(mobilePhone);

            DataTable dt = ds.Tables["Orders"];
            foreach (DataRow dr in dt.Rows)
            {
                OrderEntity model = new OrderEntity();
                model.FillData(dr);

                //model.Owner = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);

                model.StatusStr = CommonBusiness.GetEnumDesc((EnumOrderStageStatus)model.Status);

                model.SourceTypeStr = CommonBusiness.GetEnumDesc((EnumOrderSourceType)model.SourceType);

                model.Client = IntFactoryBusiness.Manage.ClientBusiness.GetClientDetail(model.ClientID);

                model.StatusItems = new List<OrderStatusEntity>();
                DataTable orderStatus = ds.Tables["Status"];
                if (model.Status > 0 && orderStatus.Rows.Count > 0)
                {
                    foreach (DataRow statu in orderStatus.Select("OrderID='" + model.OrderID + "'"))
                    {
                        OrderStatusEntity status = new IntFactoryEntity.OrderStatusEntity();
                        status.FillData(statu);
                        model.StatusItems.Add(status);
                    }
                }
                list.Add(model);
            }
            return list;
        }