Ejemplo n.º 1
0
        private static PriceSetEntity TranslatePriceSetEntity(PriceSetInfo info)
        {
            PriceSetEntity entity = new PriceSetEntity();

            if (info != null)
            {
                entity.PriceSetID    = info.PriceSetID;
                entity.CustomerID    = info.CustomerID;
                entity.StorageID     = info.StorageID;
                entity.CarrierID     = info.CarrierID;
                entity.ReceivingType = info.ReceivingType;
                entity.ReceivingID   = info.ReceivingID;
                entity.TemType       = info.TemType;

                entity.configPrice       = info.configPrice;
                entity.configHandInAmt   = info.configHandInAmt;
                entity.configSortPrice   = info.configSortPrice;
                entity.configCosting     = info.configCosting;
                entity.configHandOutAmt  = info.configHandOutAmt;
                entity.configSortCosting = info.configSortCosting;

                entity.DeliveryModel = info.DeliveryModel;
                entity.Remark        = info.Remark;
                entity.Status        = info.Status;
                entity.CreateDate    = info.CreateDate;
                entity.ChangeDate    = info.ChangeDate;

                entity.customer = CustomerService.GetCustomerById(info.CustomerID);
                entity.storage  = StorageService.GetStorageEntityById(info.StorageID);
                entity.carrier  = CarrierService.GetCarrierById(info.CarrierID);
                entity.receiver = ReceiverService.GetReceiverById(info.ReceivingID);
                //if (!string.IsNullOrEmpty(entity.ReceivingType))
                //{
                //    if ("仓库".Equals(entity.ReceivingType))
                //    {
                //        StorageEntity sentity= StorageService.GetStorageEntityById(entity.ReceivingID);
                //        if (sentity != null)
                //        {
                //            entity.ReceivingName = sentity.StorageName;
                //        }
                //    }
                //    if ("门店".Equals(entity.ReceivingType))
                //    {
                //        StorageEntity sentity = StorageService.GetStorageEntityById(entity.ReceivingID);
                //        if (sentity != null)
                //        {
                //            entity.ReceivingName = sentity.StorageName;
                //        }
                //    }
                //}
            }

            return(entity);
        }
Ejemplo n.º 2
0
        private static ReceiverEntity TranslateReceiverEntity(ReceiverInfo info, bool isRead = true)
        {
            ReceiverEntity entity = new ReceiverEntity();

            if (info != null)
            {
                entity.CustomerID       = info.CustomerID;
                entity.ReceiverType     = info.ReceiverType;
                entity.DefaultCarrierID = info.DefaultCarrierID;
                entity.DefaultStorageID = info.DefaultStorageID;
                entity.ProvinceID       = info.ProvinceID;
                entity.CityID           = info.CityID;
                entity.Address          = info.Address;
                entity.Remark           = info.Remark;

                entity.OperatorID   = info.OperatorID;
                entity.ReceiverName = info.ReceiverName;
                entity.ReceiverNo   = info.ReceiverNo;
                entity.Status       = info.Status;
                entity.CreateDate   = info.CreateDate;
                entity.ChangeDate   = info.ChangeDate;
                entity.ReceiverID   = info.ReceiverID;

                if (isRead)
                {
                    City     city     = BaseDataService.GetAllCity().FirstOrDefault(t => t.CityID == info.CityID) ?? new City();
                    Province province = BaseDataService.GetAllProvince().FirstOrDefault(t => t.ProvinceID == info.ProvinceID) ?? new Province();
                    entity.province = province;
                    entity.city     = city;
                    entity.customer = new CustomerEntity();
                    entity.customer = CustomerService.GetCustomerById(info.CustomerID);

                    CarrierEntity carrier = CarrierService.GetCarrierById(info.DefaultCarrierID);
                    entity.Carrier = carrier;

                    StorageEntity storage = StorageService.GetStorageEntityById(info.DefaultStorageID);
                    entity.Storage = storage;
                }
                //获取联系人信息
                entity.listContact = ContactService.GetContactByRule(UnionType.Receiver.ToString(), info.ReceiverID);
            }

            return(entity);
        }