Exemplo n.º 1
0
        public OrderEntity GetOrderBaseInfoByID(string orderid, string agentid, string clientid)
        {
            DataSet ds = OrdersDAL.BaseProvider.GetOrderBaseInfoByID(orderid, agentid, clientid);
            OrderEntity model = new OrderEntity();
            if (ds.Tables["Order"].Rows.Count > 0)
            {

                model.FillData(ds.Tables["Order"].Rows[0]);

                model.StatusStr = CommonBusiness.GetEnumDesc((EnumOrderStageStatus)model.Status);
                if (!string.IsNullOrEmpty(model.CategoryID))
                {
                    model.CategoryName = ProductsBusiness.BaseBusiness.GetCategoryByID(model.BigCategoryID).CategoryName + ">" + ProductsBusiness.BaseBusiness.GetCategoryByID(model.CategoryID).CategoryName;
                }

                model.Details = new List<OrderDetail>();
                if (ds.Tables["Details"].Rows.Count > 0)
                {
                    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);
                    }
                }
            }
            return model;
        }
Exemplo n.º 2
0
        public OrderEntity GetOrderForFentReport(string orderid, string agentid, string clientid)
        {
            DataSet ds = OrdersDAL.BaseProvider.GetOrderForFentReport(orderid, agentid, clientid);
            OrderEntity model = new OrderEntity();
            if (ds.Tables["Order"].Rows.Count > 0)
            {

                model.FillData(ds.Tables["Order"].Rows[0]);

                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.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.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;

                    }
                    var city = CommonBusiness.GetCityByCode(detail.ProviderCityCode);
                    if (city != null)
                    {
                        detail.ProviderAddress = city.Description + detail.ProviderAddress;
                    }
                    model.Details.Add(detail);
                }

                model.OrderCoss = new List<OrderCostEntity>();
                foreach (DataRow dr in ds.Tables["OrderCoss"].Rows)
                {
                    OrderCostEntity cos = new OrderCostEntity();
                    cos.FillData(dr);

                    model.OrderCoss.Add(cos);
                }


            }
            return model;
        }
Exemplo n.º 3
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;
        }