public List <TransferAssetRoutingInfoDTO> ToRoutingInfosDTO(IEnumerable <TransferAssetRoutingInfo> list) { var vos = new List <TransferAssetRoutingInfoDTO>(); foreach (var o in list) { if (o.GetType() == typeof(TransferAssetByHolderRoutingInfo)) { var obj = o as TransferAssetByHolderRoutingInfo; if (obj != null) { var vo = new TransferAssetByHolderRoutingInfoDTO(); ClassCopier.Instance.Copy(obj, vo); if (obj.OldContract != null) { vo.OldContract = ToOldContractDTO(obj.OldContract); } if (obj.NewContract != null) { vo.NewContract = ToNewContractDTO(obj.NewContract); } if (obj.Routings.Count > 0) { vo.Routings = ToRoutingsDTO(obj.Routings); } vos.Add(vo); } } else if (o.GetType() == typeof(TransferAssetByLocationRoutingInfo)) { var obj = o as TransferAssetByLocationRoutingInfo; if (obj != null) { var vo = new TransferAssetByLocationRoutingInfoDTO(); ClassCopier.Instance.Copy(obj, vo); if (obj.OldContract != null) { vo.OldContract = ToOldContractDTO(obj.OldContract); } if (obj.UpdContract != null) { vo.UpdContract = ToUpdatedContractDTO(obj.UpdContract); } if (obj.Routings.Count > 0) { vo.Routings = ToRoutingsDTO(obj.Routings); } vos.Add(vo); } } else { throw new Exception(Properties.Settings.Default.WrongDataType); } } return(vos); }
public TransferAssetRequestDTO GetDummyData(TicketVo t) { var workflow = new List <RoutingItemDTO> { new RoutingItemDTO { ActualDate = DateTime.Now, BaseDate = DateTime.Now, Division = "Warehouse", DivisionStatus = false, Instruction = "Fixed the information please!", PlanDate = DateTime.Now, Response = "Muke gile...", RoutingStatus = ERoutingStatus.IN_PROGRESS, SaStatus = false, Step = 1 }, new RoutingItemDTO { ActualDate = DateTime.Now, BaseDate = DateTime.Now, Division = "Sales Admin", DivisionStatus = false, Instruction = "Fixed the information please!", PlanDate = DateTime.Now, Response = "Muke gile juga!", RoutingStatus = ERoutingStatus.IN_PROGRESS, SaStatus = false, Step = 2 } }; var routings = new List <TransferAssetRoutingInfoDTO>(); var rbh = new TransferAssetByHolderRoutingInfoDTO { CreateDate = DateTime.Now, CurrentStep = 1, IdrWebNumber = "123456", NewContract = new TransferAssetNewContractDTO { DeliveryOrderToUser = "******", Device = "Laptop", DeviceSn = "343234", EquipDesc = "Laptop Lenovo i3", Equipment = "234324", NewHolderName = "Bromo Kunto Adji", NewLineNumber = "32", NewLocation = "Jakarta", NewNumber = "NEW-54534534", NewSalaryNumber = "SAL-2234324", ReturnDeliveryNumber = "RET-2343224", SoDeliveryNumber = "SOD-2342344" }, OldContract = new TransferAssetOldContractDTO { Device = "Laptop", DeviceSn = "343234", EquipDesc = "Laptop Lenovo i3", Equipment = "234324", OldHolderName = "Indra Birowo", OldLineNumber = "32", OldLocation = "Jakarta", OldNumber = "OLD-54534534", OldSalaryNumber = "SAL-4323423", }, RoutingMemo = "Please dikerjakan semua ya!", Routings = workflow, SubScenario = ESubScenario.BY_HOLDER_NAME }; routings.Add(rbh); var rbl = new TransferAssetByLocationRoutingInfoDTO { CreateDate = DateTime.Now, CurrentStep = 1, IdrWebNumber = "123456", UpdContract = new TransferAssetUpdatedContractDTO { Device = "Laptop", DeviceSn = "343234", EquipDesc = "Laptop Lenovo i3", Equipment = "234324", OldHolderName = "Indra Birowo", OldLineNumber = "32", OldLocation = "Jakarta", OldNumber = "OLD-54534534", OldSalaryNumber = "SAL-4323423", UpdLocation = "Bangka Belitung" }, OldContract = new TransferAssetOldContractDTO { Device = "Laptop", DeviceSn = "343234", EquipDesc = "Laptop Lenovo i3", Equipment = "234324", OldHolderName = "Indra Birowo", OldLineNumber = "32", OldLocation = "Jakarta", OldNumber = "OLD-54534534", OldSalaryNumber = "SAL-4323423", }, RoutingMemo = "Please dikerjakan semua ya!", Routings = workflow, SubScenario = ESubScenario.BY_HOLDER_NAME }; routings.Add(rbl); var req = new TransferAssetRequestDTO { Id = _indexDao.NewServiceRequestId(), RequestInfo = new TransferAssetRequestInfoDTO { Company = t.Company, DetailCategory = t.DetailCategory, Email = t.Email, Id = t.IdNumber, Location = t.Location, RequestMemo = t.Problem, RequestedBy = t.ReportBy, RequestedDate = DateTime.ParseExact(t.ReportDate, Properties.Settings.Default.HelpdeskDateFormat, System.Globalization.CultureInfo.InvariantCulture), RequestedVia = t.ReportVia, SnOrIdNumber = t.IdNumber, TicketCategory = t.Category }, IssuedBy = "Helpdesk", IssuedDate = DateTime.Now, Scenario = EScenario.TRANSFER_ASSET, State = EServiceRequestState.DRAFT, Routings = routings }; return(req); }