public int CreateOrder(RunLog run, List <int> products) { log.LogStart(); SERVDataContract.DbLinq.RunLog runLog = new SERVDataContract.DbLinq.RunLog(); runLog.CallDateTime = DateTime.Now; runLog.CallFromLocationID = run.CallFromLocationID; runLog.CollectionLocationID = run.CollectionLocationID; runLog.ControllerMemberID = 0; //TODO System COntroller Id; runLog.CreateDate = DateTime.Now; runLog.CreatedByUserID = run.CreatedByUserID; runLog.DeliverToLocationID = run.DeliverToLocationID; runLog.DutyDate = run.DutyDate; runLog.FinalDestinationLocationID = run.FinalDestinationLocationID; runLog.OriginLocationID = run.OriginLocationID; runLog.Urgency = run.Urgency; runLog.Notes = run.Notes; runLog.Boxes = products.Count; runLog.CallerNumber = run.CallerNumber.Trim().Replace(" ", ""); runLog.CallerExt = run.CallerExt.Trim().Replace(" ", ""); runLog.RiderMemberID = null; runLog.CollectDateTime = null; runLog.DeliverDateTime = null; runLog.HomeSafeDateTime = null; runLog.VehicleTypeID = null; return(SERVDALFactory.Factory.RunLogDAL().CreateRunLog(runLog, products)); }
public RunLog(SERVDataContract.DbLinq.RunLog metal) { PropertyMapper.MapProperties(metal, this); if (metal.Member != null) { this.MemberName = metal.Member.FirstName + " " + metal.Member.LastName; } this.DeliverToDestinationName = metal.Location.Location1; }
public bool CreateRunLog(DateTime callDateTime, int callFromLocationId, DateTime collectDateTime, int collectionLocationId, int controllerMemberId, int createdByUserId, DateTime deliverDateTime, int deliverToLocationId, DateTime dutyDate, int finalDestinationLocationId, int originLocationId, int riderMemberId, int urgency, int vehicleTypeId, string productIdCsv, DateTime?homeSafeDateTime, string notes, string callerNumber, string callerExt) { log.LogStart(); List <int> prods = new List <int>(); foreach (string p in productIdCsv.Split(',')) { if (p.Trim() != string.Empty) { prods.Add(int.Parse(p)); } } SERVDataContract.DbLinq.RunLog runLog = new SERVDataContract.DbLinq.RunLog(); runLog.CallDateTime = callDateTime; runLog.CallFromLocationID = callFromLocationId; runLog.CollectDateTime = collectDateTime; runLog.CollectionLocationID = collectionLocationId; runLog.ControllerMemberID = controllerMemberId; runLog.CreateDate = DateTime.Now; runLog.CreatedByUserID = createdByUserId; runLog.DeliverDateTime = deliverDateTime; runLog.DeliverToLocationID = deliverToLocationId; runLog.DutyDate = dutyDate; runLog.FinalDestinationLocationID = finalDestinationLocationId; runLog.IsTransfer = 0; runLog.OriginLocationID = originLocationId; runLog.RiderMemberID = riderMemberId; runLog.Urgency = urgency; runLog.VehicleTypeID = vehicleTypeId; runLog.HomeSafeDateTime = homeSafeDateTime; runLog.Notes = notes; runLog.Boxes = prods.Count; runLog.CallerNumber = callerNumber.Trim().Replace(" ", ""); runLog.CallerExt = callerExt.Trim().Replace(" ", ""); // Not completed run if (riderMemberId == -1) { runLog.RiderMemberID = null; runLog.CollectDateTime = null; runLog.DeliverDateTime = null; runLog.HomeSafeDateTime = null; runLog.VehicleTypeID = null; } return(SERVDALFactory.Factory.RunLogDAL().CreateRunLog(runLog, prods) > 0); }
private static void UpdatePropertyValues(RunLog source, RunLog destination) { destination.CollectDateTime = source.CollectDateTime; destination.CollectionLocationID = source.CollectionLocationID; destination.CollectionPostcode = source.CollectionPostcode; destination.ControllerMemberID = source.ControllerMemberID; destination.DeliverDateTime = source.DeliverDateTime; destination.DeliverToLocationID = source.DeliverToLocationID; destination.DeliverToPostcode = source.DeliverToPostcode; destination.DutyDate = source.DutyDate; destination.FinalDestinationLocationID = source.FinalDestinationLocationID; destination.HomeSafeDateTime = source.HomeSafeDateTime; destination.Notes = source.Notes; destination.OriginLocationID = source.OriginLocationID; destination.RiderMemberID = source.RiderMemberID; destination.RunLogType = source.RunLogType; destination.VehicleTypeID = source.VehicleTypeID; }
public RunLog Get(int runLogID) { log.LogStart(); SERVDataContract.DbLinq.RunLog metal = SERVDALFactory.Factory.RunLogDAL().Get(runLogID); RunLog ret = new RunLog(metal); ret.Products = new Dictionary <string, int>(); foreach (SERVDataContract.DbLinq.RunLogProduct rlp in metal.RunLogProduct) { if (ret.Products.ContainsKey(rlp.ProductID.ToString())) { ret.Products[rlp.ProductID.ToString()] = ret.Products[rlp.ProductID.ToString()] + rlp.Quantity; } else { ret.Products.Add(rlp.ProductID.ToString(), rlp.Quantity); } } ret.Vehicle = metal.VehicleTypeID != null ? metal.VehicleType.VehicleType1 : ""; return(ret); }
public bool CreateAARunLog(DateTime dutyDate, DateTime collectDateTime, int controllerMemberId, int createdByUserId, DateTime deliverDateTime, DateTime returnDateTime, int riderMemberId, int vehicleTypeId, string boxesOutCsv, string boxesInCsv, string notes) { log.LogStart(); List <int> prodsOut = new List <int>(); foreach (string p in boxesOutCsv.Split(',')) { if (p.Trim() != string.Empty) { prodsOut.Add(int.Parse(p)); } } List <int> prodsIn = new List <int>(); foreach (string p in boxesInCsv.Split(',')) { if (p.Trim() != string.Empty) { prodsIn.Add(int.Parse(p)); } } // Out trip if (prodsOut.Count > 0) { SERVDataContract.DbLinq.RunLog runLog = new SERVDataContract.DbLinq.RunLog(); runLog.CallDateTime = null; runLog.CallFromLocationID = FindAADeliverLocationID(); runLog.CollectDateTime = collectDateTime; runLog.CollectionLocationID = FindAAPickupLocationID(); runLog.ControllerMemberID = controllerMemberId; runLog.CreateDate = DateTime.Now; runLog.CreatedByUserID = createdByUserId; runLog.DeliverDateTime = deliverDateTime; runLog.DeliverToLocationID = FindAADeliverLocationID(); runLog.DutyDate = dutyDate; runLog.FinalDestinationLocationID = FindAADeliverLocationID(); runLog.IsTransfer = 0; runLog.OriginLocationID = FindAAPickupLocationID(); runLog.RiderMemberID = riderMemberId; runLog.Urgency = 1; runLog.VehicleTypeID = vehicleTypeId; runLog.Notes = notes; runLog.Boxes = prodsOut.Count; SERVDALFactory.Factory.RunLogDAL().CreateRunLog(runLog, prodsOut); } // In Trip if (prodsIn.Count > 0) { SERVDataContract.DbLinq.RunLog log = new SERVDataContract.DbLinq.RunLog(); log.CallDateTime = null; log.CallFromLocationID = FindAADeliverLocationID(); log.CollectDateTime = deliverDateTime; log.CollectionLocationID = FindAADeliverLocationID(); log.ControllerMemberID = controllerMemberId; log.CreateDate = DateTime.Now; log.CreatedByUserID = createdByUserId; log.DeliverDateTime = returnDateTime; log.DeliverToLocationID = FindAAPickupLocationID(); log.DutyDate = dutyDate; log.FinalDestinationLocationID = FindAAPickupLocationID(); log.IsTransfer = 0; log.OriginLocationID = FindAADeliverLocationID(); log.RiderMemberID = riderMemberId; log.Urgency = 1; log.VehicleTypeID = vehicleTypeId; log.Notes = notes; log.Boxes = prodsIn.Count; SERVDALFactory.Factory.RunLogDAL().CreateRunLog(log, prodsIn); } return(true); }