private async void DoLoadWorkflow(object obj) { Responses = new ObservableCollection <QueryResponseVM>(); if (FormQuery != null && FormQuery.Id > 0) { try { var result = await RestHub.QueryWorkflow(FormQuery.Id); if (result.UserObject != null) { QueryWorkflowDTO dto = result.UserObject as QueryWorkflowDTO; if (dto != null) { AllowSubmit = dto.AllowSubmit; AllowReject = dto.AllowReject; string before = String.IsNullOrEmpty(dto.PreviousUser) ? String.Empty : dto.PreviousUser + " <img src='http://www.iconsdb.com/icons/download/icon-sets/web-2-blue/arrow-11-24.jpg'/>"; string after = String.IsNullOrEmpty(dto.NextUser) ? String.Empty : "<img src='http://www.iconsdb.com/icons/download/orange/arrow-11-24.jpg'/>" + dto.NextUser; QueryWorkflow = $"{before} <b>{dto.CurrentUser}</b> {after}"; } } else { MessageBox.Show("Can't Load Responses . ."); } } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Error while Loading Responses . .", ex.ToString()); } } }
private async void DoLoadResponsesAsync(object obj) { Responses = new ObservableCollection <QueryResponseVM>(); if (FormQuery != null && FormQuery.Id > 0) { try { var result = await RestHub.Responses(FormQuery.Id); if (result.UserObject != null) { foreach (var response in result.UserObject as List <QueryResponseDTO> ) { Responses.Add(new QueryResponseVM { Id = response.Id, Response = response.Response, Timestamp = response.TimeStamp, User = response.User }); } } else { MessageBox.Show("Can't Load Responses . ."); } } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Error while Loading Responses . .", ex.ToString()); } } }
private async void DoSubmitAsync(object obj) { if (FormQuery != null && FormQuery.Id > 0) { if (String.IsNullOrEmpty(Response)) { MessageBox.Show("Please Add Your Message . ."); return; } try { var result = await RestHub.Submit(FormQuery.Id, Response); if (result.UserObject != null && (bool)result.UserObject) { ClearQuery.Execute(this); MessageBox.Show(result.StatusMessage); RefreshQueries.Execute(this); } else { MessageBox.Show("Can't Submitting Query . ."); } } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Error while Submitting Query . .", ex.ToString()); } } else { MessageBox.Show("Please save query or select already created query to proceed . ."); } }
private async void DoSearch(object obj) { Loading = true; UserEntries = new ObservableCollection <QueryReportEntryVM>(); if (From != null && To != null) { var result = await RestHub.QueryReport(new QueryReportRequestDTO { From = From, To = To }); if (result.UserObject != null) { var dtos = result.UserObject as List <QueryReportEntryDTO>; if (dtos != null) { foreach (var dto in dtos) { UserEntries.Add(new QueryReportEntryVM { User = dto.User, Created = dto.Created, Responded = dto.Responded }); } } } else { AppErrorBox.ShowErrorMessage("Error While Loading Report . .", result.StatusMessage); } } else { MessageBox.Show("Please select dates . ."); } Loading = false; }
private async void DoGenerateNextBatchNumber(object obj) { try { WorkInProgress = true; var status = await RestHub.GenerateNextBatchNumber(NextBatch); if (status.HttpCode == System.Net.HttpStatusCode.OK) { AppInfoBox.ShowInfoMessage(status.StatusMessage); LoadDeliveryBatches(); } else { AppErrorBox.ShowErrorMessage("Can't Generate New Batch Number. .", status.HttpResponse); } } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Can't Generate New Batch Number . .", ex.ToString()); } finally { WorkInProgress = false; } }
async private void DoGenerateZip(object obj) { try { WorkInProgress = true; if (DeliveryBatch != null) { DeliveryInProgress = Visibility.Visible; var result = await RestHub.GenerateZIP(DeliveryBatch.Id, MaxZipSize * 1000 * 1000); if (result.HttpCode == System.Net.HttpStatusCode.OK) { ZipResultDTO zipResult = (ZipResultDTO)result.UserObject; ZipResult.ShowResult(zipResult); } else { AppErrorBox.ShowErrorMessage("Error While Generating ZIP . .", result.HttpResponse); } DeliveryInProgress = Visibility.Hidden; } else { MessageBox.Show("From Batch, From Category, Delivery Batch Number Is Required . . ."); } WorkInProgress = false; } catch (Exception ex) { Log.This(ex); } }
private async Task LoadRoles(string userName) { try { LoginEnable = false; Roles.Clear(); RestStatus status = await RestHub.UserRoles(UserName); if (status.HttpCode == System.Net.HttpStatusCode.OK) { List <ProductRole> listRoles = (List <ProductRole>)status.UserObject; if (listRoles.Count > 0) { SelectIndex = 0; foreach (ProductRole productRole in listRoles) { Roles.Add(productRole); } LoginEnable = true; } } else { AppErrorBox.ShowErrorMessage("Can't Load Roles", status.StatusMessage); } } catch (Exception ex) { Log.This(ex); } }
private async void DoMarkAsDelivered(object obj) { if (DeliveryBatch != null) { try { WorkInProgress = true; var status = await RestHub.UpdateDeliveryStatus(DeliveryBatch.Id); if (status.HttpCode == System.Net.HttpStatusCode.OK) { AppInfoBox.ShowInfoMessage(status.StatusMessage); } else { AppErrorBox.ShowErrorMessage("Can't Update delivery status . .", status.HttpResponse); } } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Can't Update delivery status . .", ex.ToString()); } finally { WorkInProgress = false; } } else { AppInfoBox.ShowInfoMessage("Please select atleast one batch to update delivery status"); } }
private async void DoSearchTans(object obj) { try { WorkInProgress = true; BatchTansView = null; TotalTans = 0; BatchTans = new ObservableCollection <BatchTanVM>(); BatchTans.CollectionChanged += BatchTans_CollectionChanged; if (FromBatch != null && ToBatch != null && FromCategory != null) { var result = await RestHub.TansBetweenBatches(FromBatch.Name, ToBatch.Name, (int)FromCategory.Value); if (result.HttpCode == System.Net.HttpStatusCode.OK) { var tans = (List <BatchTanDto>)result.UserObject; foreach (var tan in tans) { BatchTans.Add(new BatchTanVM { Id = tan.Id, BatchNum = tan.BatchNumber, TanNumber = tan.TanNumber, TanCategory = new TanCategoryVM { Value = (int)tan.TanCategory, Description = tan.TanCategory.DescriptionAttribute() }, TanType = tan.TanType, Nums = tan.Nums, Rxns = tan.Rxns, Stages = tan.Stages, Curator = tan.Curator, Reviewer = tan.Reviewer, QC = tan.QC, IsDoubtRaised = tan.IsDoubtRaised.ToString(), TanState = tan.TanState }); } BatchTansView = new QueryableCollectionView(BatchTans); } else { AppErrorBox.ShowErrorMessage(result.StatusMessage, result.HttpResponse); } } else { MessageBox.Show("From Batch, To Batch, Category Are Required . ."); } UpdateSummary(BatchTans); } catch (Exception ex) { Log.This(ex); AppErrorBox.ShowErrorMessage("Error while searching TANs", ex.ToString()); } finally { WorkInProgress = false; } }
private async void DoLoadUsers(object obj) { Loading = true; try { var result = await RestHub.Users(); if (result.UserObject != null) { List <string> dto = result.UserObject as List <string>; if (dto != null) { Usernames = new ObservableCollection <string>(dto); } } else { MessageBox.Show("Can't Load Users . ."); } } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Error While Loading Users . .", ex.ToString()); } Loading = false; }
private async void DoRefreshQueriesAsync(object obj) { Loading = true; try { ClearQuery.Execute(this); Queries = new ObservableCollection <QueryVM>(); var result = await RestHub.MyQueries(); if (result.UserObject != null) { MyQueriesDTO myQueriesDto = (MyQueriesDTO)result.UserObject; List <QueryDTO> dtos = myQueriesDto.Queries; foreach (var dto in dtos) { Queries.Add(new QueryVM { Id = dto.Id, TanId = dto.TanId, DocumentPath = dto.DocumentPath, TanNumber = dto.TanNumber, Comment = dto.Comment, Page = dto.Page, QueryType = dto.QueryType, Title = dto.Title }); } } } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Error while loading Queries", ex.ToString()); } Loading = false; }
public async Task LoadKeywords() { RestStatus status = await RestHub.TanKeyWords(); if (status.UserObject != null) { keyWordsList = (List <TanKeywords>)status.UserObject; } }
private async void DoAllowReview(object obj) { if (SelectedBatches.Any()) { var result = await RestHub.AllowForReview(SelectedBatches.Select(b => b.Name).ToList()); if (result.UserObject != null) { AppInfoBox.ShowInfoMessage("Status updated Succeesfully"); } } }
async private void DoGenerateMail(object obj) { try { WorkInProgress = true; if (DeliveryBatch != null) { var result = await RestHub.GenerateEmail(DeliveryBatch.Id); if (result.HttpCode == System.Net.HttpStatusCode.OK) { try { Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem mailItem = (Microsoft.Office.Interop.Outlook.MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); mailItem.To = "*****@*****.**"; mailItem.CC = "[email protected];[email protected]"; mailItem.Subject = "Reactions Mail"; mailItem.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML; mailItem.HTMLBody = result.UserObject.ToString(); mailItem.Display(false); } catch (Exception ex) { var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), $"{DeliveryBatch.BatchNumber}.html"); File.WriteAllText(path, result.UserObject.ToString()); AppInfoBox.ShowInfoMessage($"Unfortunately Outlook is not accessible. The prepared report will open in web browser, you may copy and paste in email manually."); Process.Start(path); } } else { AppErrorBox.ShowErrorMessage("Error While Generating Email . .", Environment.NewLine + result.HttpResponse); } DeliveryInProgress = Visibility.Hidden; } else { MessageBox.Show("From Batch, From Category, Delivery Batch Number Is Required . . ."); } WorkInProgress = false; } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Can't generate mail report . .", ex.ToString()); } finally { WorkInProgress = false; } }
private async void DoMoveToDelivery(object obj) { try { WorkInProgress = true; if (BatchTans != null && SelectedTans != null && SelectedTans.Count() > 0) { var InValidTans = SelectedTans.Where(t => (((BatchTanVM)t).TanState.HasValue && S.UnDelivarableTanStates.Contains(((BatchTanVM)t).TanState.Value)) || ((BatchTanVM)t).IsDoubtRaised.ToLower().Equals("true")).ToList(); if (InValidTans.Any()) { AppInfoBox.ShowInfoMessage("Selected Tan Contains NotAssigned/Curation In progress/Doubt Raised tans."); return; } if (DeliveryBatch != null) { var moveTansDto = new MoveTansDTO(); moveTansDto.TanIds = SelectedTans.Select(t => ((BatchTanVM)t).Id).ToList(); moveTansDto.TargetCategory = DeliveryBatch.Id; var status = await RestHub.MoveToDelivery(moveTansDto); if (status.HttpCode == System.Net.HttpStatusCode.OK) { SearchTans.Execute(this); var result = MessageBox.Show(status.StatusMessage, "Status", MessageBoxButton.OKCancel); } else { AppErrorBox.ShowErrorMessage("Can't Move TANs To Delivery . .", status.HttpResponse); } } else { AppInfoBox.ShowInfoMessage("Delivery Batch Not Selected."); } } else { AppInfoBox.ShowInfoMessage("Please Load and Select TANs To Proceed . ."); } WorkInProgress = false; } catch (Exception ex) { Log.This(ex); AppErrorBox.ShowErrorMessage("Can't Move TANs To Delivery . .", ex.ToString()); } finally { WorkInProgress = false; } }
private async void DoShowComments(object obj) { try { Loading8085Comments = true; S8580CommentsView = null; if (FromBatch != null) { var result = await RestHub.S8580Comments(SelectedDeliveryBatch.Id, FromCategory.Value); if (result.HttpCode == System.Net.HttpStatusCode.OK) { List <S8580CommentsDTO> dtos = (List <S8580CommentsDTO>)result.UserObject; S8580Comments = new ObservableCollection <S8580CommentsVM>(); foreach (var dto in dtos) { S8580Comments.Add(new S8580CommentsVM { TanNumber = dto.TanNumber, TanCategory = dto.TanCategory, Comment = dto.Comment, CommentType = dto.CommentType, UserComment = dto.UserComment }); } S8580CommentsView = new ListCollectionView(S8580Comments); S8580CommentsView.SortDescriptions.Add(new SortDescription("TanNumber", ListSortDirection.Ascending)); } else { MessageBox.Show(result.StatusMessage); } } } catch (Exception ex) { Log.This(ex); AppErrorBox.ShowErrorMessage("Error while loading 8580 Comments", ex.ToString()); } finally { Loading8085Comments = false; } }
private async void DoMoveToCategory(object obj) { try { WorkInProgress = true; if (BatchTans != null && SelectedTans != null && SelectedTans.Count() > 0) { if (FromBatch != null && ToCategory != null) { var moveTansDto = new MoveTansDTO(); moveTansDto.TanIds = SelectedTans.Select(t => ((BatchTanVM)t).Id).ToList(); moveTansDto.TargetCategory = ToCategory.Value; var status = await RestHub.MoveToCategory(moveTansDto); if (status.HttpCode == System.Net.HttpStatusCode.OK) { SearchTans.Execute(this); var result = MessageBox.Show(status.StatusMessage, "Status", MessageBoxButton.OKCancel); } else { AppErrorBox.ShowErrorMessage("Can't Move TANs To Category . .", status.HttpResponse); } } else { AppInfoBox.ShowInfoMessage("From Batch, To Category Should Be Selected, And Must Be Different To Proceed. ."); } } else { AppInfoBox.ShowInfoMessage("Please Load and Select TANs To Proceed . ."); } } catch (Exception ex) { Log.This(ex); AppErrorBox.ShowErrorMessage("Can't Move TANs To Category . .", ex.ToString()); } finally { WorkInProgress = false; } }
async private void DoGetVersions(object obj) { try { FromHistory = new ObservableCollection <TanHistoryVM>(); ToHistory = new ObservableCollection <TanHistoryVM>(); if (!String.IsNullOrEmpty(TanNumber)) { Loading = true; var result = await RestHub.Versions(TanNumber); if (result.HttpCode == System.Net.HttpStatusCode.OK) { List <TanHistoryDTO> dtos = (List <TanHistoryDTO>)result.UserObject; foreach (var dto in dtos) { FromHistory.Add(new Core.TanHistoryVM { Id = dto.Id, Text = dto.Text }); ToHistory.Add(new Core.TanHistoryVM { Id = dto.Id, Text = dto.Text }); } } else { AppInfoBox.ShowInfoMessage("Error While Versions . ." + Environment.NewLine + result.HttpResponse); } Loading = false; } else { AppInfoBox.ShowInfoMessage("Please Enter TAN Number . ."); } } catch (Exception ex) { Log.This(ex); } }
public async Task LoadData() { try { RestStatus status = await RestHub.Shipments(); if (status.UserObject != null) { List <BatchDTO> batches = (List <BatchDTO>)status.UserObject; Batches = new ObservableCollection <Delivery.BatchVM>(); foreach (var batch in batches) { Batches.Add(new BatchVM { DateCreated = batch.DateCreated, DocumentsPath = batch.DocumentsPath, Id = batch.Id, Name = batch.Name }); } } status = await RestHub.GetAllCurators(); if (status.UserObject != null) { List <UserDTO> curators = (List <UserDTO>)status.UserObject; Curators = new ObservableCollection <Tasks.UsersVM>(); foreach (var user in curators) { Curators.Add(new UsersVM { UserId = user.UserID, Role = user.Role, Name = user.Name }); } } } catch (Exception ex) { Log.This(ex); } }
private async void DoRevert(object obj) { if (String.IsNullOrEmpty(DeliveryMessage)) { AppInfoBox.ShowInfoMessage("Delivery message is mandatory . ."); return; } if (System.Windows.MessageBox.Show("Confirm Revert Action . .", "Confirm", MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } if (Role != null && TAN != null) { WorkInProgress = true; try { var result = await RestHub.RevertDeliveryTAN(TAN.Id, Role.Role, DeliveryMessage); if (result.HttpCode == System.Net.HttpStatusCode.OK) { AppInfoBox.ShowInfoMessage(result.StatusMessage); Search.Execute(this); } else { AppErrorBox.ShowErrorMessage("Error While Reverting TAN . .", result.StatusMessage); } } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Error While Reverting TAN . .", ex.ToString()); } finally { WorkInProgress = false; } } else { System.Windows.MessageBox.Show("Select Role and TAN"); } }
private async Task UserReactionsReports(int Roleid) { try { var mainVm = (App.Current.MainWindow as MainWindow).DataContext as MainVM; RestStatus status = await RestHub.UserReactionsReports(RoleId); if (status.HttpCode == System.Net.HttpStatusCode.OK) { List <UserReportsDTO> userReportDto = (List <UserReportsDTO>)status.UserObject; mainVm.UserReports = new ObservableCollection <ViewModels.Extended.UserResportsVM>(); mainVm.AllUserReports = new ObservableCollection <ViewModels.Extended.UserResportsVM>(); foreach (var userReport in userReportDto.Where(ur => ur.SingleUser)) { mainVm.UserReports.Add(new ViewModels.Extended.UserResportsVM { Date = userReport.Date, ReactionsCount = userReport.ReactionsCount }); } mainVm.UserReports.Add(new ViewModels.Extended.UserResportsVM { Date = DateTime.Now.AddDays(1).Date.ToString("dd-MM"), ReactionsCount = 0 }); foreach (var userReport in userReportDto.Where(ur => !ur.SingleUser)) { mainVm.AllUserReports.Add(new ViewModels.Extended.UserResportsVM { Date = userReport.Date, ReactionsCount = userReport.ReactionsCount }); } mainVm.AllUserReports.Add(new ViewModels.Extended.UserResportsVM { Date = DateTime.Now.AddDays(1).Date.ToString("dd-MM"), ReactionsCount = 0 }); } else { AppErrorBox.ShowErrorMessage("User Report Can't Be Loaded", status.StatusMessage); } } catch (Exception ex) { Log.This(ex); } }
private async void DoShow8000NameLocations(object obj) { try { Loading8000Data = true; S8000NameLocationView = null; var result = await RestHub.S8000NameLocations(SelectedDeliveryBatch.Id, FromCategory.Value); if (result.HttpCode == System.Net.HttpStatusCode.OK) { List <S8000NameLocationDTO> dtos = (List <S8000NameLocationDTO>)result.UserObject; S8000NameLocations = new ObservableCollection <S8000NameLocationVM>(); foreach (var dto in dtos) { S8000NameLocations.Add(new S8000NameLocationVM { TanNumber = dto.TanNumber, TanSeries = dto.TanSeries, TanCategory = dto.TanCategory, SubstanceName = dto.SubstanceName, SubstanceLocation = dto.SubstanceLocation }); } S8000NameLocationView = new ListCollectionView(S8000NameLocations); S8000NameLocationView.SortDescriptions.Add(new SortDescription("TanNumber", ListSortDirection.Ascending)); } else { MessageBox.Show(result.StatusMessage); } } catch (Exception ex) { Log.This(ex); AppErrorBox.ShowErrorMessage("Error while loading 8000 names", ex.ToString()); } finally { Loading8000Data = false; } }
private async void DoSaveRsns(object obj) { try { LoadingRSNs = true; if (ExtractedRsns != null && MessageBox.Show("Confirm Update . .", "Confirm Save", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { List <FreeTextUpdateDto> dtos = new List <FreeTextUpdateDto>(); foreach (var rsn in ExtractedRsns) { dtos.Add(new FreeTextUpdateDto { Id = rsn.Id, FreeText = rsn.FreeText }); } FreeTextBulkDto bulkDto = new FreeTextBulkDto(); bulkDto.BatchId = SelectedDeliveryBatch.Id; bulkDto.CategoryId = FromCategory.Value; bulkDto.Dtos = dtos; var status = await RestHub.UpdateFreeTextBulk(bulkDto); if (status.HttpCode == System.Net.HttpStatusCode.OK) { ExtractRsns.Execute(this); var result = MessageBox.Show("RSNs Updated Successfully . .", "Status", MessageBoxButton.OKCancel); } else { AppErrorBox.ShowErrorMessage("Can't Update RSNs . .", status.HttpResponse); } } } catch (Exception ex) { Log.This(ex); AppErrorBox.ShowErrorMessage("Error while Updating RSNs", ex.ToString()); } finally { LoadingRSNs = false; } }
private async void LoadTans() { if (BatchSummary != null) { TANs.Clear(); WorkInProgress = true; try { var result = await RestHub.TansOfDelivery(BatchSummary.Id, IsZeroRxns, IsQueried); if (result.HttpCode == System.Net.HttpStatusCode.OK) { List <DeliveryTanDTO> dtos = (List <DeliveryTanDTO>)result.UserObject; foreach (var dto in dtos) { TANs.Add(new DeliveryTanVM { Id = dto.Id, TanNumber = dto.TanNumber, RXNCount = dto.RXNCount, IsQueried = dto.IsQueried, DeliveryRevertMessage = dto.DeliveryRevertMessage }); } } else { AppErrorBox.ShowErrorMessage("Error While Batches . .", result.StatusMessage); } } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Error While Batches . .", ex.ToString()); } finally { WorkInProgress = false; } } }
private async void DoSaveQueryAsync(object obj) { Loading = true; if (FormQuery != null && FormQuery.TanId > 0 && !String.IsNullOrEmpty(FormQuery.TanNumber) && !String.IsNullOrEmpty(FormQuery.Title) && !String.IsNullOrEmpty(FormQuery.Comment) && U.RoleId != 4) { try { QueryDTO dto = new QueryDTO() { Comment = FormQuery.Comment, Id = FormQuery.Id, Page = FormQuery.Page, QueryType = FormQuery.QueryType, TanId = FormQuery.TanId, Title = FormQuery.Title, }; var result = await RestHub.SaveQuery(dto); if (result.UserObject != null && (bool)result.UserObject) { MessageBox.Show(result.StatusMessage); RefreshQueries.Execute(this); ClearQuery.Execute(this); } else { MessageBox.Show("Can't Save Query . ."); } } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Error while saving Query . .", ex.ToString()); } } else { AppInfoBox.ShowInfoMessage("Query can't be created without all required information . ."); } Loading = false; }
private async void DoRefresh(object obj) { Loading = true; Workflows = new ObservableCollection <QueryWorkflowVM>(); Workflows.CollectionChanged += Workflows_CollectionChanged; try { var result = await RestHub.QueryWorkflows(); if (result.UserObject != null) { List <QueryWorkflowUserDTO> dto = result.UserObject as List <QueryWorkflowUserDTO>; if (dto != null) { foreach (var username in Usernames) { var workflow = dto.Where(w => w.L1User == username).FirstOrDefault(); Workflows.Add(new QueryWorkflowVM { L1user = username, L2user = workflow?.L2User, L3user = workflow?.L3User, L4user = workflow?.L4User, L5user = workflow?.L5User, }); } Workflows.UpdateDisplayOrder(); } } else { MessageBox.Show("Can't Load Users . ."); } } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Error While Loading Users . .", ex.ToString()); } Loading = false; }
private async Task loginUser() { try { RestStatus status = await RestHub.LoginUser(userName, password); if (status.HttpCode == System.Net.HttpStatusCode.OK) { Hide = Visibility.Hidden; U.UserName = userName; U.RoleId = RoleId; U.UserRole = (from r in Roles where r.RoleId == RoleId select r.RoleName).FirstOrDefault(); await UserPermissionInfo(RoleId); await UserReactionsReports(RoleId); ((App.Current.MainWindow as MainWindow).DataContext as MainVM).UserName = (U.UserName + " \\ " + U.UserRole).ToUpper(); try { HubClient.InitHub(); HubClient.NotificationReceived += HubClient_NotificationReceived; ((App.Current.MainWindow as MainWindow).DataContext as MainVM).SignalRId = HubClient.signalRId; } catch (Exception ex) { AppErrorBox.ShowErrorMessage("Error while conneciton to live server . .", ex.ToString()); }; } else { AppInfoBox.ShowInfoMessage(status.StatusMessage); LoginEnable = true; } } catch (Exception ex) { Log.This(ex); } }
async private void DoGenerateXML(object obj) { try { WorkInProgress = true; if (DeliveryBatch != null) { DeliveryInProgress = Visibility.Visible; var result = await RestHub.GenerateXML(DeliveryBatch.Id); if (result.HttpCode == System.Net.HttpStatusCode.OK) { var dto = result.UserObject as GenerateXMLDTO; if (dto.IsSuccess) { GenerateXMLSuccessBox.ShowStatus(dto.OutXmlPath); } } else { AppErrorBox.ShowErrorMessage(result.StatusMessage, result.HttpResponse); } DeliveryInProgress = Visibility.Hidden; } else { MessageBox.Show("From Batch, From Category, Delivery Batch Number Is Required . . ."); } } catch (Exception ex) { Log.This(ex); AppErrorBox.ShowErrorMessage("Can't Generate XML", ex.ToString()); } finally { WorkInProgress = false; } }
private async void LoadDeliveryBatches() { DeliveryBatches = new ObservableCollection <DeliveryBatchVM>(); var deliveryResult = await RestHub.DeleveryBatches(); if (deliveryResult.HttpCode == System.Net.HttpStatusCode.OK) { List <DeliveryBatchDTO> deliveryBatches = (List <DeliveryBatchDTO>)deliveryResult.UserObject; foreach (var batchDto in deliveryBatches) { DeliveryBatches.Add(new DeliveryBatchVM { Id = batchDto.Id, BatchNumber = batchDto.BatchNumber }); } DeliveryBatch = DeliveryBatches.FirstOrDefault(); } else { AppErrorBox.ShowErrorMessage("Can't Load Delivery Batches . .", deliveryResult.StatusMessage); } }
private async Task UserPermissionInfo(int RoleId) { try { RestStatus status = await RestHub.UserPermissionsInfo(RoleId); if (status.HttpCode == System.Net.HttpStatusCode.OK) { UserInfoDTO userInfoDTO = (UserInfoDTO)status.UserObject; U.CanApprove = userInfoDTO.canApprove; U.CanReject = userInfoDTO.canReject; U.CanSubmit = userInfoDTO.canSubmit; } else { AppErrorBox.ShowErrorMessage("Unable to load user permission", status.StatusMessage); } } catch (Exception ex) { Log.This(ex); } }