public OpportunityEntity GetOpportunityByID(string opportunityid, string agentid, string clientid)
        {
            DataSet ds = OpportunityDAL.BaseProvider.GetOpportunityByID(opportunityid, agentid, clientid);
            OpportunityEntity model = new OpportunityEntity();
            if (ds.Tables["Opportunity"].Rows.Count > 0)
            {

                model.FillData(ds.Tables["Opportunity"].Rows[0]);
                model.OrderType = SystemBusiness.BaseBusiness.GetOrderTypeByID(model.TypeID, model.AgentID, model.ClientID);
                model.Owner = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, model.AgentID);

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

                model.Stage = SystemBusiness.BaseBusiness.GetOpportunityStageByID(model.StageID, agentid, clientid);

                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>();
                if (ds.Tables["Details"].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables["Details"].Rows)
                    {
                        OrderDetail detail = new OrderDetail();
                        detail.FillData(dr);
                        model.Details.Add(detail);
                    }
                }
            }
            return model;
        }
        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.OrderType = SystemBusiness.BaseBusiness.GetOrderTypeByID(model.TypeID, model.AgentID, model.ClientID);
                model.Owner = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, model.AgentID);

                model.StatusStr = model.Status == 0 ? "草案订单"
                                : model.Status == 1 ? "未审核"
                                : model.Status == 2 ? "已审核"
                                : model.Status == 9 ? "已删除"
                                : "";

                model.ExpressTypeStr = model.ExpressType == 0 ? "邮寄"
                                : model.ExpressType == 1 ? "海运"
                                : model.ExpressType == 2 ? "空运"
                                : model.ExpressType == 3 ? "自提"
                                : "";

                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>();
                if (ds.Tables["Details"].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables["Details"].Rows)
                    {
                        OrderDetail detail = new OrderDetail();
                        detail.FillData(dr);
                        model.Details.Add(detail);
                    }
                }
            }
            return model;
        }