Exemple #1
0
        private static MenuEntity TranslateMenuEntity(MenuInfo menuInfo)
        {
            MenuEntity menuEntity = new MenuEntity();

            if (menuEntity != null)
            {
                menuEntity.MenuID    = menuInfo.MenuID;
                menuEntity.MenuName  = menuInfo.MenuName;
                menuEntity.PreFlag   = menuInfo.PreFlag ?? "";
                menuEntity.SufFlag   = menuInfo.SufFlag ?? "";
                menuEntity.Remark    = menuInfo.Remark ?? "";
                menuEntity.URL       = menuInfo.URL;
                menuEntity.Status    = menuInfo.Status;
                menuEntity.GroupCode = menuInfo.GroupCode;
                if (!string.IsNullOrEmpty(menuEntity.GroupCode))
                {
                    menuEntity.BaseData = BaseDataService.GetBaseDataByType(menuEntity.GroupCode).FirstOrDefault() ?? new BaseDataEntity();
                }
                else
                {
                    menuEntity.BaseData = new BaseDataEntity();
                }
            }


            return(menuEntity);
        }
Exemple #2
0
        private static StoreEntity TranslateStoreEntity(StoreInfo storeInfo)
        {
            StoreEntity storeEntity = new StoreEntity();

            if (storeInfo != null)
            {
                storeEntity.SupplierID    = storeInfo.SupplierID;
                storeEntity.SupplierName  = storeInfo.SupplierName ?? "";
                storeEntity.SupplierCode  = storeInfo.SupplierCode ?? "";
                storeEntity.SupplierType  = storeInfo.SupplierType;
                storeEntity.CityID        = storeInfo.CityID;
                storeEntity.Address       = storeInfo.Address ?? "";
                storeEntity.Telephone     = storeInfo.Telephone ?? "";
                storeEntity.Mobile        = storeInfo.Mobile ?? "";
                storeEntity.StartTime     = storeInfo.StartTime ?? "";
                storeEntity.EndTime       = storeInfo.EndTime ?? "";
                storeEntity.Coordinate    = storeInfo.Coordinate ?? "";
                storeEntity.Status        = storeInfo.Status;
                storeEntity.AttachmentIDs = storeInfo.AttachmentIDs ?? "";
                storeEntity.CreateDate    = storeInfo.CreateDate;
                storeEntity.ModifyDate    = storeInfo.ModifyDate;
                storeEntity.Operator      = storeInfo.Operator;
                City city = BaseDataService.GetAllCity().FirstOrDefault(t => t.CityID == storeInfo.CityID) ?? new City();
                List <AttachmentEntity> attachments = BaseDataService.GetAttachmentInfoByKyes(storeInfo.AttachmentIDs);
                storeEntity.CityInfo    = city;
                storeEntity.Attachments = attachments;
                storeEntity.imageUrl    = attachments != null && attachments.Count > 0 ? attachments[0].FilePath : "" + "/Images/store.jpg";
            }


            return(storeEntity);
        }
Exemple #3
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);
        }
Exemple #4
0
        /// <summary>
        /// 从info到Entity
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        private static StorageEntity TranslateStorageEntity(StorageInfo info)
        {
            StorageEntity entity = new StorageEntity();

            if (info != null)
            {
                entity.StorageID   = info.StorageID;
                entity.StorageName = info.StorageName;
                entity.StorageNo   = info.StorageNo;
                entity.ProvinceID  = info.ProvinceID;
                entity.CityID      = info.CityID;
                entity.Address     = info.Address;
                entity.OperatorID  = info.OperatorID;
                entity.Status      = info.Status;
                entity.CreateDate  = info.CreateDate;
                entity.ChangeDate  = info.ChangeDate;
                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;
            }
            return(entity);
        }