public static TblRFSDetailItem MapToModel(RFSHeaderItem objectToBeMapped) { var temp = new TblRFSDetailItem(); temp.ItemCode = objectToBeMapped.SelectedRFQItem.Code; temp.Description = objectToBeMapped.Description; temp.Image = objectToBeMapped.SelectedRFQItem.Image; temp.Size = objectToBeMapped.SelectedRFQItem.Size; temp.Configuration = objectToBeMapped.SelectedRFQItem.Config; temp.Batch = objectToBeMapped.SelectedRFQItem.Batch; temp.Name = objectToBeMapped.SelectedRFQItem.Name; temp.Source = objectToBeMapped.SelectedRFQItem.ItemGroup; temp.tblRFSDetail = objectToBeMapped.ParentID; if (objectToBeMapped.Iserial != null) { temp.Iserial = (int)objectToBeMapped.Iserial; } return(temp); }
public static TblRFSHeader MapToModel(RFSViewModel objectToBemapped, bool isFullObjectMapper) { var temp = new TblRFSHeader { BrandCode = objectToBemapped.BrandCode, SeasonCode = objectToBemapped.SeasonCode, SupplierCode = objectToBemapped.SupplierID }; if (objectToBemapped.TransID != null) { temp.TransID = (int)objectToBemapped.TransID; } temp.DocNumber = objectToBemapped.DocNum ?? " "; temp.TblRFSDetails = new ObservableCollection <TblRFSDetail>(); foreach (var item in objectToBemapped.RFQHeaderList) { var stemp = new TblRFSDetail { Description = item.Desc, Image = item.HeaderImage }; if (item.MainHeaderTransID != null) { stemp.tblRFSHeader = item.MainHeaderTransID; } stemp.StyleCode = item.Style; stemp.ColorCode = item.ColorCode; stemp.SizeCode = item.SizeCode; if (item.SubHeaderSerial != null) { stemp.Iserial = (int)item.SubHeaderSerial; } stemp.TblRFSDetailServices = new ObservableCollection <TblRFSDetailService>(); foreach (var sItem in item.HeaderServices) { var hsTemp = new TblRFSDetailService { Image = sItem.Image }; if (sItem.Iserial != null) { hsTemp.Iserial = (int)sItem.Iserial; } hsTemp.Notes = sItem.Notes; if (sItem.ServiceCode != null) { hsTemp.ServiceCode = sItem.ServiceCode; } if (sItem.ParentID != null) { hsTemp.Iserial = (int)sItem.ParentID; } stemp.TblRFSDetailServices.Add(hsTemp); } stemp.TblRFSDetailItems = new ObservableCollection <TblRFSDetailItem>(); foreach (var iItems in item.HeaderItems) { var iTemp = new TblRFSDetailItem { ItemCode = iItems.SelectedRFQItem.Code, Description = iItems.Description, Image = iItems.Image, Size = iItems.SelectedRFQItem.Size, Configuration = iItems.SelectedRFQItem.Config, Batch = iItems.SelectedRFQItem.Batch, Name = iItems.SelectedRFQItem.Name, Source = iItems.SelectedRFQItem.ItemGroup }; if (iItems.Iserial != null) { iTemp.Iserial = (int)iItems.Iserial; } iTemp.ItemCode = iItems.ItemCode; if (iItems.ParentID != null) { iTemp.tblRFSDetail = iItems.ParentID; } stemp.TblRFSDetailItems.Add(iTemp); } temp.TblRFSDetails.Add(stemp); } return(temp); }
public static TblRFSDetail MapToModel(RFSSubHeader objectToBeMapped) { var stemp = new TblRFSDetail { Description = objectToBeMapped.Desc, Image = objectToBeMapped.HeaderImage, StyleCode = objectToBeMapped.Style }; if (objectToBeMapped.SubHeaderSerial != null) { stemp.Iserial = (int)objectToBeMapped.SubHeaderSerial; } if (objectToBeMapped.MainHeaderTransID != null) { stemp.tblRFSHeader = objectToBeMapped.MainHeaderTransID; } stemp.StyleCode = objectToBeMapped.Style; stemp.ColorCode = objectToBeMapped.ColorCode; stemp.SizeCode = objectToBeMapped.SizeCode; stemp.TblRFSDetailServices = new ObservableCollection <TblRFSDetailService>(); foreach (var sItem in objectToBeMapped.HeaderServices) { var hsTemp = new TblRFSDetailService { Image = sItem.Image }; if (sItem.Iserial != null) { hsTemp.Iserial = (int)sItem.Iserial; } hsTemp.Notes = sItem.Notes; if (sItem.ServiceCode != null) { hsTemp.ServiceCode = sItem.ServiceCode; } if (sItem.ParentID != null) { hsTemp.tblRFSDetail = sItem.ParentID; } stemp.TblRFSDetailServices.Add(hsTemp); } stemp.TblRFSDetailItems = new ObservableCollection <TblRFSDetailItem>(); foreach (var iItems in objectToBeMapped.HeaderItems) { var iTemp = new TblRFSDetailItem { Description = iItems.Description, Image = iItems.Image }; if (iItems.Iserial != null) { iTemp.Iserial = (int)iItems.Iserial; } iTemp.ItemCode = iItems.ItemCode; if (iItems.ParentID != null) { iTemp.tblRFSDetail = iItems.ParentID; } stemp.TblRFSDetailItems.Add(iTemp); } return(stemp); }