public async void ExecuteOpenQuotationCommand(RecentItemViewModel recentItem)
        {
            string errorMessage = string.Empty;
            string quotationNo  = recentItem.Model.QuotationNo;
            //DataSet quotationDataSet = quotationDb.GetNRICDetails(nric, out errorMessage);

            DataSet quotationDataSet = quotationDb.GetMIQuoationDetails(quotationNo, out errorMessage);

            if (!string.IsNullOrEmpty(errorMessage))
            {
                await this.Container.Resolve <IMetroMessageDisplayService>(ServiceNames.MetroMessageDisplayService).ShowMessageAsnyc("Open Recent Item", errorMessage);

                return;
            }
            else if (quotationDataSet != null && quotationDataSet.Tables.Count == 4 && quotationDataSet.Tables[0].Rows.Count > 0)
            {
                this.RegionManager.RequestNavigate(RegionNames.MainRegion, WindowNames.MotorViewQuotation);
                this.EventAggregator.GetEvent <OpenQuotationEvent>().Publish(new QuotationEventArgs
                {
                    QuotationDataSet = quotationDataSet,
                    RegionName       = RegionNames.MotorQuotationRegion,
                    Source           = WindowNames.MotorSummaryDetail
                });
            }
            else
            {
                await this.Container.Resolve <IMetroMessageDisplayService>(ServiceNames.MetroMessageDisplayService).ShowMessageAsnyc("Open Recent Item", "Quotation record does not exist");

                return;
            }
        }
예제 #2
0
        public async void ExecuteAddQuotationCommand()
        {
            MIQuotation insuranceDetail = this.QuotationViewModel.CurrentInsuranceDetail.Model;

            if (insuranceDetail != null)
            {
                string quotationNo = DbUtility.GetNewQuotationNumber(quotationDb);

                insuranceDetail.NRIC           = this.QuotationViewModel.OwnerDetail.NRIC;
                insuranceDetail.InsuranceQtnNo = quotationNo;
                var errorInfo = quotationDb.AddInsuranceDetails(insuranceDetail);
                if (errorInfo.Code == 0)
                {
                    this.IsQuotationAdded = false;
                    string errorMessage;
                    this.QuotationDataSet = quotationDb.GetMIQuoationDetails(quotationNo, out errorMessage);
                    //if(String.IsNullOrEmpty(errorMessage) == true)
                    //{
                    //    NavigationParameters navParameters = new NavigationParameters();
                    //    navParameters.Add("ReportDataSet", quotationDataSet);

                    //    this.RegionManager.RequestNavigate(RegionNames.MotorWizardRegion, PopupNames.ReportModule_Motor, navParameters);
                    //}
                    //else
                    //{
                    //    await this.Container.Resolve<IMetroMessageDisplayService>(ServiceNames.MetroMessageDisplayService).ShowMessageAsnyc("Renew Quotation", errorMessage);
                    //    return;
                    //}
                }
                else
                {
                    await this.Container.Resolve <IMetroMessageDisplayService>(ServiceNames.MetroMessageDisplayService).ShowMessageAsnyc("Renew Quotation", errorInfo.Info);

                    return;
                }

                //On Successfully creating a new quotation
                this.EventAggregator.GetEvent <NewQuotationEvent>().Publish(new QuotationEventArgs
                {
                    QuotationNumber  = insuranceDetail.InsuranceQtnNo,
                    OwnerName        = this.QuotationViewModel.OwnerDetail.Name,
                    NRICNumber       = insuranceDetail.NRIC,
                    QuotationDataSet = quotationDataSet
                });
            }
            else
            {
                await this.Container.Resolve <IMetroMessageDisplayService>(ServiceNames.MetroMessageDisplayService).ShowMessageAsnyc("Renew Quotation", "Unable to add Insurance details");

                return;
            }
        }
예제 #3
0
        public async void ExecuteSearchQuotationCommand()
        {
            try
            {
                ClearRegions(RegionNames.MotorSearchRegion);

                string errorMessage = string.Empty;
                searchDataSet = null;
                switch (SearchType)
                {
                case "Quotation No":
                {
                    searchDataSet = quotationDb.GetMIQuoationDetails(this.SearchText, out errorMessage);
                    break;
                }

                case "NRIC":
                {
                    searchDataSet = quotationDb.GetNRICDetails(this.SearchText, out errorMessage);
                    break;
                }
                }

                if (!string.IsNullOrEmpty(errorMessage))
                {
                    await this.Container.Resolve <IMetroMessageDisplayService>(ServiceNames.MetroMessageDisplayService).ShowMessageAsnyc("Search", errorMessage);

                    return;
                }
                else
                {
                    if (searchDataSet != null && searchDataSet.Tables.Count == 4 && searchDataSet.Tables[0].Rows.Count > 0)
                    {
                        this.QuotationViewModel = new QuotationViewModel(quotationDb, searchDataSet);
                        this.RegionManager.RequestNavigate(RegionNames.MotorSearchRegion, WindowNames.MotorSummaryDetail);
                    }
                    else
                    {
                        await this.Container.Resolve <IMetroMessageDisplayService>(ServiceNames.MetroMessageDisplayService).ShowMessageAsnyc("Search", errorInfo);

                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                this.ErrorInfo = ex.Message;
                await this.Container.Resolve <IMetroMessageDisplayService>(ServiceNames.MetroMessageDisplayService).ShowMessageAsnyc("Search", string.Format("ERROR: {0}", ex.Message));
            }
        }
예제 #4
0
        public async Task <IHttpActionResult> GetMIQuoationDetails(string insuranceQtnNo)
        {
            try
            {
                DataSet dataSet = await Task.Run(() => quotationDb.GetMIQuoationDetails(insuranceQtnNo));

                if (dataSet == null)
                {
                    return(NotFound());
                }

                return(Ok(dataSet));
            }
            catch (Exception)
            {
                return(InternalServerError());
            }
        }