//View the Selected Vehicle
 private void ViewSelected(object obj)
 {
     if (RequestProcessingList != null)
     {
         var vehicleModel   = RequestProcessingList.FirstOrDefault();
         var home           = new HomeWindowVM();
         var vehicleLocator = new VehicleLocatorVM();
         var vehicleDetails = new VehicleDetail();
         var window         = new Window()
         {
             Content = vehicleDetails
         };
         window.DataContext           = vehicleLocator.VehicalDetailsViewModel;
         vehicleLocator.Vin           = vehicleModel.Vin;
         vehicleLocator.VehicleId     = vehicleModel.VehiclesID;
         vehicleLocator.CustomerID    = vehicleModel.CustomerID;
         vehicleLocator.CreatedBy     = vehicleModel.CreatedBy;
         vehicleLocator.SelectedItems = new ObservableCollection <object>()
         {
             vehicleLocator
         };
         var list = new List <VehicleLocatorVM>()
         {
             vehicleLocator
         };
         DelegateEventVehicle.SetValueListMethod(list);
         DelegateEventVehicle.SetValueMethodTabEnable(false);
         DelegateEventVehicle.SetValueMethodCmd("Edit");
         window.Show();
     }
 }
예제 #2
0
        /// <summary>
        /// sucessor method
        /// </summary>
        /// <param name="data"></param>
        public void ContinueVinClick(object data)
        {
            try
            {
                if (vin != null)
                {
                    DelegateEventVehicle.SetValueMethod(VIN.Replace(" ", ""));

                    foreach (System.Windows.Window window in System.Windows.Application.Current.Windows)
                    {
                        if (window.DataContext == this)
                        {
                            window.Close();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Please! Enter the VIN into Listbox or Click the Cancel Button.");
                }
            }
            catch (Exception ex)
            {
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Function to Search the Customer List.
        /// </summary>
        /// <param name="objLoginProp"></param>
        /// <returns>void</returns>
        /// <createdBy></createdBy>
        /// <createdOn>May 10,2016</createdOn>
        private void CancelWindow(object obj)
        {
            CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                Application.Current.Properties["SearchCount"] = 0;

                OnCloseWindowRequested();

                DelegateEventVehicle.SetValueMethodEnableNew("EnableNew");
            }
            catch (Exception ex)
            {
                LogHelper.LogErrorToDb(ex);
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }

            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }
예제 #4
0
        /// <summary>
        /// Function to update the damage code.
        /// </summary>
        /// <param name="objLoginProp"></param>
        /// <returns>void</returns>
        /// <createdBy></createdBy>
        /// <createdOn>may-19,2016</createdOn>
        private void UpdateDamageCode()
        {
            string userRole = string.Empty;

            CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                if ((DamageCode != null) && (DamageCode.Length == 5))
                {
                    int DamageCodeNum;
                    if (int.TryParse(DamageCode, out DamageCodeNum))
                    {
                        AppWorksService.Properties.PortStorageDamageDetailsProp objDamageCodeProp = new AppWorksService.Properties.PortStorageDamageDetailsProp();
                        objDamageCodeProp.DamageCode = DamageCode;
                        objDamageCodeProp.PSVehicleDamageDetailID = DamageDetailsId;
                        var result = _serviceInstance.EditDamageCode(objDamageCodeProp);
                        if (result <= 0)
                        {
                            MessageBox.Show(Resources.ErrorDamageCode);
                        }
                        else
                        {
                            DelegateEventVehicle.SetValueMethodDamageCode("bindgrid");
                            CancelDamageCode();
                        }
                    }
                    else
                    {
                        MessageBox.Show(Resources.msgDamageCodeValidation);
                    }
                }
                else
                {
                    MessageBox.Show(Resources.msgDamageCodeNumberValidation);
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogErrorToDb(ex);
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }
            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }
예제 #5
0
        /// <summary>
        /// Function to Clear the Customer List.
        /// </summary>
        /// <param name="objLoginProp"></param>
        /// <returns>void</returns>
        /// <createdBy></createdBy>
        /// <createdOn>May 10,2016</createdOn>
        private void Continue(object obj)
        {
            CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                if (SelectedDisRecipientGridItem != null)
                {
                    DelegateEventCustomer.SetCustomerValueMethod(SelectedDisRecipientGridItem);
                    DelegateEventVehicle.SetValueMethodCmd("Add");
                    //int countWindow = 0;
                    Application.Current.Properties["SearchCount"] = 0;
                    OnCloseWindowRequested();
                    //foreach (System.Windows.Window window in System.Windows.Application.Current.Windows)
                    //{
                    //    if (countWindow == 1)
                    //    {
                    //        window.Close();
                    //    }
                    //    countWindow++;
                    //}
                }
                else
                {
                    MessageBox.Show(Resources.MsgSelectUser);
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogErrorToDb(ex);
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }

            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }
예제 #6
0
        /// <summary>
        /// Function to FIll Customer Data on row selection.
        /// </summary>
        /// <param name="objLoginProp"></param>
        /// <returns>void</returns>
        /// <createdBy></createdBy>
        /// <createdOn>May 10,2016</createdOn>
        private void FillData(object obj)
        {
            CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                DelegateEventCustomer.SetCustomerValueMethod(SelectedDisRecipientGridItem);
                DelegateEventVehicle.SetValueMethodCmd("Add");
            }
            catch (Exception ex)
            {
                LogHelper.LogErrorToDb(ex);
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }

            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }
예제 #7
0
        /// <summary>
        /// Method To Save The Data.
        /// </summary>
        public async void Save(object obj)
        {
            try
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
                if (Vin.Length < 1)
                {
                    MessageBox.Show(Resources.msgVINReq);
                }
                else if (InspectionDate == null)
                {
                    MessageBox.Show(Resources.msgInspectionDateReq);
                }
                else if (string.IsNullOrEmpty(damageCode1) && string.IsNullOrEmpty(damageCode2) && string.IsNullOrEmpty(damageCode3) && string.IsNullOrEmpty(damageCode4) && string.IsNullOrEmpty(damageCode5) && string.IsNullOrEmpty(damageCode6) && string.IsNullOrEmpty(damageCode7) && string.IsNullOrEmpty(damageCode8) && string.IsNullOrEmpty(damageCode9) && string.IsNullOrEmpty(damageCode10))
                {
                    MessageBox.Show(Resources.msgDamageCodeReq);
                }
                else if (string.IsNullOrEmpty(SelectedInspectionType) || selectedInspectionType == "Please Select")
                {
                    MessageBox.Show(Resources.msgInspectionTypeReq);
                }
                else
                {
                    if (SelectedInspectionType.ToLower(CultureInfo.CurrentCulture).Equals(Resources.InspectionType1.ToLower(CultureInfo.CurrentCulture)))
                    {
                        SelectedInspectionID = 0;
                    }
                    else if (SelectedInspectionType.ToLower(CultureInfo.CurrentCulture).Equals(Resources.InspectionType2.ToLower(CultureInfo.CurrentCulture)))
                    {
                        SelectedInspectionID = 1;
                    }
                    else if (SelectedInspectionType.ToLower(CultureInfo.CurrentCulture).Equals(Resources.InspectionType3.ToLower(CultureInfo.CurrentCulture)))
                    {
                        SelectedInspectionID = 2;
                    }
                    bool isError = false;

                    List <string> damageCodes = new List <string>();

                    if (!string.IsNullOrEmpty(damageCode1))
                    {
                        if ((damageCode1.Length == 5))
                        {
                            damageCodes.Add(damageCode1);
                        }
                        else
                        {
                            MessageBox.Show(Resources.msgDamageCodeNumberValidation);
                            isError = true;
                        }
                    }
                    if (!string.IsNullOrEmpty(damageCode2))
                    {
                        if ((damageCode2.Length == 5))
                        {
                            damageCodes.Add(damageCode2);
                        }
                        else
                        {
                            MessageBox.Show(Resources.msgDamageCodeNumberValidation);
                            isError = true;
                        }
                    }
                    if (!string.IsNullOrEmpty(damageCode3))
                    {
                        if ((damageCode3.Length == 5))
                        {
                            damageCodes.Add(damageCode3);
                        }
                        else
                        {
                            MessageBox.Show(Resources.msgDamageCodeNumberValidation);
                            isError = true;
                        }
                    }
                    if (!string.IsNullOrEmpty(damageCode4))
                    {
                        if ((damageCode4.Length == 5))
                        {
                            damageCodes.Add(damageCode4);
                        }
                        else
                        {
                            MessageBox.Show(Resources.msgDamageCodeNumberValidation);
                            isError = true;
                        }
                    }
                    if (!string.IsNullOrEmpty(damageCode5))
                    {
                        if ((damageCode5.Length == 5))
                        {
                            damageCodes.Add(damageCode5);
                        }
                        else
                        {
                            MessageBox.Show(Resources.msgDamageCodeNumberValidation);
                            isError = true;
                        }
                    }
                    if (!string.IsNullOrEmpty(damageCode6))
                    {
                        if ((damageCode6.Length == 5))
                        {
                            damageCodes.Add(damageCode6);
                        }
                        else
                        {
                            MessageBox.Show(Resources.msgDamageCodeNumberValidation);
                            isError = true;
                        }
                    }
                    if (!string.IsNullOrEmpty(damageCode7))
                    {
                        if ((damageCode7.Length == 5))
                        {
                            damageCodes.Add(damageCode7);
                        }
                        else
                        {
                            MessageBox.Show(Resources.msgDamageCodeNumberValidation);
                            isError = true;
                        }
                    }
                    if (!string.IsNullOrEmpty(damageCode8))
                    {
                        if ((damageCode8.Length == 5))
                        {
                            damageCodes.Add(damageCode8);
                        }
                        else
                        {
                            MessageBox.Show(Resources.msgDamageCodeNumberValidation);
                            isError = true;
                        }
                    }
                    if (!string.IsNullOrEmpty(damageCode9))
                    {
                        if ((damageCode9.Length == 5))
                        {
                            damageCodes.Add(damageCode9);
                        }
                        else
                        {
                            MessageBox.Show(Resources.msgDamageCodeNumberValidation);
                            isError = true;
                        }
                    }
                    if (!string.IsNullOrEmpty(damageCode10))
                    {
                        if ((damageCode10.Length == 5))
                        {
                            damageCodes.Add(damageCode10);
                        }
                        else
                        {
                            MessageBox.Show(Resources.msgDamageCodeNumberValidation);
                            isError = true;
                        }
                    }

                    //if there is no error then save the damage codes
                    if (!isError)
                    {
                        foreach (var code in damageCodes)
                        {
                            DamageCodeProp objDamageCodeProp = new DamageCodeProp();
                            objDamageCodeProp.PortStorageVehiclesID  = VehicleId;
                            objDamageCodeProp.PSVehicleInspectionID  = SelectedInspectionID;
                            objDamageCodeProp.DamageDescription      = string.Empty;
                            objDamageCodeProp.DamageCode             = code;
                            objDamageCodeProp.InspectedBy            = Application.Current.Properties["LoggedInUserName"].ToString();
                            objDamageCodeProp.InspectionDate         = DateTime.Now;
                            objDamageCodeProp.SelectedInspectionType = SelectedInspectionType;
                            await _serviceInstance.AddDamageCodeAsync(objDamageCodeProp);
                        }

                        Close(null);
                        DelegateEventVehicle.SetValueMethodDamageCode("bindgrid");
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogErrorToDb(ex);
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }

            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }