Пример #1
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);
        }