/// <summary> /// Function to update vehiclestatus for checked rows /// </summary> /// <param name="obj"></param> /// <returns>NA</returns> /// <createdBy></createdBy> /// <createdOn>June-28,2016</createdOn> public void RequestChecked_Click(object obj) { try { CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); string user = Application.Current.Properties["LoggedInUserName"].ToString(); listInventorySelected = ListInventory.Where(x => x.IsSelected == true).ToList(); if (listInventorySelected.Count() > 0) { bool isSuccessfull = _serviceInstance.UpdateRequestCheckedVehicles(ListInventorySelected.ToArray(), user); if (isSuccessfull) { MessageBox.Show(Resources.MsgRecordUpdated); Search_Click(null); } } else { MessageBox.Show(Resources.MsgSelectUser); } } catch (Exception ex) { CommonSettings.logger.LogError(this.GetType(), ex); } finally { CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); } }
/// <summary> /// Function to get inventory details for a vin number/customerid /// </summary> /// <param name="obj"></param> /// <returns>NA</returns> /// <createdBy></createdBy> /// <createdOn>June-28,2016</createdOn> public void Search_Click(object obj) { try { CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); Count = 0; if (CustomerID > 0) { if (obj == null) { CurrentPageIndex = 0; } if (CurrentPageIndex == 0) { Application.Current.Properties["FindUserGridLastScrollOffset"] = 0; Application.Current.Properties["FindUserGridCurrentPageIndex"] = 0; } PortStorageVehicleProp objVehicleProp = new PortStorageVehicleProp(); objVehicleProp.CustomerID = CustomerID; objVehicleProp.VIN = VINNumber; objVehicleProp.CurrentPageIndex = CurrentPageIndex; objVehicleProp.PageSize = CurrentPageIndex > 0 ? _GridPageSizeOnScroll : _GridPageSize;; objVehicleProp.DefaultPageSize = _GridPageSize; var lstInventory = _serviceInstance.GetPortStorageInventoryDetails(objVehicleProp).Select(x => new PortStorageVehicleProp { VIN = x.VIN != null ? x.VIN : string.Empty, VehicleYear = x.VehicleYear != null ? x.VehicleYear : string.Empty, Make = x.Make != null ? x.Make : string.Empty, Model = x.Model != null ? x.Model : string.Empty, Color = x.Color != null ? x.Color : string.Empty, BayLocation = x.BayLocation != null ? x.BayLocation : string.Empty, DateIn = x.DateIn, DateRequested = x.DateRequested, VehicleStatus = x.VehicleStatus != null ? x.VehicleStatus : string.Empty, RequestedBy = x.RequestedBy != null ? x.RequestedBy : string.Empty, DateOut = x.DateOut, PortStorageVehiclesID = x.PortStorageVehiclesID, IsSelected = x.IsSelected, Days = x.DateOut != null ? Convert.ToInt32(Convert.ToDateTime(x.DateOut).Subtract((DateTime)x.DateIn).TotalDays) : (x.DateIn != null ? Convert.ToInt32(DateTime.Now.Subtract((DateTime)x.DateIn).TotalDays) : 0), //(int)x.DateOut.Value.Subtract((DateTime)x.DateIn).TotalDays : 0//(Convert.ToDateTime(x.DateIn) != null ? (int)DateTime.Now.Subtract((DateTime)x.DateIn).TotalDays : 0) TotalPageCount = x.TotalPageCount }); foreach (var item in lstInventory) { IsSelected = item.IsSelected; } if (CurrentPageIndex == 0) { ListInventory = null; ListInventory = new ObservableCollection <PortStorageVehicleProp>(lstInventory); } else { if (ListInventory != null && ListInventory.Count > 0) { foreach (PortStorageVehicleProp ud in new ObservableCollection <PortStorageVehicleProp>(lstInventory)) { ListInventory.Add(ud); } } } VehicleSummary = "Vehicles currently in storage: " + ListInventory.Where(x => x.VehicleStatus != Enums.VehicleStatusType.OutGated.ToString()).Count().ToString() + "(Requested: " + ListInventory.Where(x => x.VehicleStatus == Enums.VehicleStatusType.Requested.ToString()).Count().ToString() + ")"; } else { MessageBox.Show(Resources.MsgSelectUser); } Count = ListInventory.ToList().Where(x => x.TotalPageCount > 0).FirstOrDefault().TotalPageCount; } catch (Exception ex) { CommonSettings.logger.LogError(this.GetType(), ex); } finally { CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); } }