private void UpdateCheckListFromModel(CheckListOfProperty target, CheckListOfPropertyModel source) { target.CheckListPropertyId = source.CheckListPropertyId; target.CheckListId = source.CheckListId; target.PropertyCheckListId = source.PropertyCheckListId; target.Mandatory = source.Mandatory; target.Delete = source.Delete; if (source.Documents == null) { return; } List <PropertyCheckListDocuments> docList = new List <PropertyCheckListDocuments>(); foreach (var obj in source.Documents) { var doc = new PropertyCheckListDocuments(); UpdateDocumentFromModel(doc, obj); docList.Add(doc); } target.Documents = docList; }
static public async Task <PropertyCheckListModel> CreatePropertyCheckListModelWithDocsAsync(PropertyCheckList source) { var model = new PropertyCheckListModel() { PropertyCheckListId = source.PropertyCheckListId, PropertyGuid = source.PropertyGuid, PropertyName = source.PropertyName, TalukId = source.TalukId.ToString(), HobliId = source.HobliId.ToString(), VillageId = source.VillageId.ToString(), DocumentTypeId = source.DocumentTypeId.ToString(), PropertyTypeId = source.PropertyTypeId.ToString(), SurveyNo = source.SurveyNo, PropertyGMapLink = source.PropertyGMapLink, LandAreaInputAcres = source.LandAreaInputAcres.ToString(), LandAreaInputGuntas = source.LandAreaInputGuntas.ToString(), LandAreaInputAanas = source.LandAreaInputAanas.ToString(), LandAreaInAcres = source.LandAreaInAcres.ToString(), LandAreaInGuntas = source.LandAreaInGuntas.ToString(), LandAreaInSqMts = source.LandAreaInSqMts.ToString(), LandAreaInSqft = source.LandAreaInSqft.ToString(), AKarabAreaInputAcres = source.AKarabAreaInputAcres.ToString(), AKarabAreaInputGuntas = source.AKarabAreaInputGuntas.ToString(), AKarabAreaInputAanas = source.AKarabAreaInputAanas.ToString(), AKarabAreaInAcres = source.AKarabAreaInAcres.ToString(), AKarabAreaInGuntas = source.AKarabAreaInGuntas.ToString(), AKarabAreaInSqMts = source.AKarabAreaInSqMts.ToString(), AKarabAreaInSqft = source.AKarabAreaInSqft.ToString(), BKarabAreaInputAcres = source.BKarabAreaInputAcres.ToString(), BKarabAreaInputGuntas = source.BKarabAreaInputGuntas.ToString(), BKarabAreaInputAanas = source.BKarabAreaInputAanas.ToString(), BKarabAreaInAcres = source.BKarabAreaInAcres.ToString(), BKarabAreaInGuntas = source.BKarabAreaInGuntas.ToString(), BKarabAreaInSqMts = source.BKarabAreaInSqMts.ToString(), BKarabAreaInSqft = source.BKarabAreaInSqft.ToString(), CompanyID = source.CompanyID.ToString(), CompanyName = source.CompanyName, VillageName = source.VillageName, PropertyDescription = source.PropertyDescription, CheckListMaster = source.CheckListMaster, TotalArea = source.TotalArea }; //if (source.PropertyCheckListDocuments != null && source.PropertyCheckListDocuments.Count > 0) //{ // var docList = new ObservableCollection<PropertyCheckListDocumentsModel>(); // foreach (var obj in source.PropertyCheckListDocuments) // { // docList.Add(new PropertyCheckListDocumentsModel // { // PropertyCheckListBlobId = obj.PropertyCheckListBlobId, // guid = obj.PropertyGuid, // ImageBytes = obj.FileBlob, // FileName = obj.FileName, // ContentType = obj.FileType, // FileCategoryId = obj.FileCategoryId, // UploadTime = obj.UploadTime, // DueDate = obj.DueDate, // ActualCompletionDate = obj.ActualCompletionDate, // Remarks = obj.Remarks // }); // } // model.PropertyCheckListDocuments =docList; //} if (source.CheckListOfProperties != null && source.CheckListOfProperties.Count > 0) { var checkList = new ObservableCollection <CheckListOfPropertyModel>(); foreach (var obj in source.CheckListOfProperties) { var checkItem = new CheckListOfPropertyModel { CheckListPropertyId = obj.CheckListPropertyId, PropertyCheckListId = obj.PropertyCheckListId, CheckListId = obj.CheckListId, Mandatory = obj.Mandatory, Name = obj.Name }; var docList = new ObservableCollection <PropertyCheckListDocumentsModel>(); foreach (var doc in obj.Documents) { docList.Add(new PropertyCheckListDocumentsModel { PropertyCheckListBlobId = doc.PropertyCheckListBlobId, CheckListPropertyId = doc.CheckListPropertyId, guid = doc.PropertyGuid, ImageBytes = doc.FileBlob, FileName = doc.FileName, ContentType = doc.FileType, FileCategoryId = doc.FileCategoryId, UploadTime = doc.UploadTime, DueDate = doc.DueDate, ActualCompletionDate = doc.ActualCompletionDate, Remarks = doc.Remarks }); } checkItem.Documents = docList; checkList.Add(checkItem); } model.CheckListOfProperties = checkList; } if (source.PropertyCheckListVendors != null && source.PropertyCheckListVendors.Count > 0) { var vendors = new ObservableCollection <PropertyCheckListVendorModel>(); foreach (var obj in source.PropertyCheckListVendors) { vendors.Add(new PropertyCheckListVendorModel { VendorId = obj.VendorId, VendorName = obj.VendorName, PropertyCheckListId = obj.PropertyCheckListId, CheckListVendorId = obj.CheckListVendorId, IsGroup = obj.IsGroup, IsPrimaryVendor = obj.IsPrimaryVendor }); } model.PropertyCheckListVendors = vendors; } return(model); }