/// <summary> /// Similar to CreateStatusReport but with no Status information /// </summary> /// <param name="_projects"></param> public void zCreateProjectReport(FullyObservableCollection <Models.ProjectReportSummary> _projects) { ClosedXML.Excel.XLWorkbook workbook; workbook = new XLWorkbook(XLEventTracking.Disabled); workbook.Worksheets.Add("ProjectListReport"); var worksheet = workbook.Worksheet("ProjectListReport"); worksheet.Cell(1, 1).Value = "ID"; worksheet.Cell(1, 2).Value = "Status"; worksheet.Cell(1, 3).Value = "Project"; worksheet.Cell(1, 4).Value = "Customer"; worksheet.Cell(1, 5).Value = "Targeted Sales"; worksheet.Cell(1, 6).Value = "Associate"; for (int i = 0; i < _projects.Count; i++) { worksheet.Cell(i + 2, 1).Value = _projects[i].ID; worksheet.Cell(i + 2, 2).Value = _projects[i].ProjectStatus; worksheet.Cell(i + 2, 3).Value = _projects[i].ProjectName; worksheet.Cell(i + 2, 4).Value = _projects[i].Customer; worksheet.Cell(i + 2, 5).Value = _projects[i].EstimatedAnnualSales; worksheet.Cell(i + 2, 6).Value = _projects[i].Associate; } var rangeheader = worksheet.Range(1, 1, 1, 6); rangeheader.Style.Fill.BackgroundColor = XLColor.Blue; rangeheader.Style.Font.FontColor = XLColor.White; rangeheader.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; //Set data range background var datarange = worksheet.Range(2, 1, _projects.Count + 1, 6); datarange.Style.Fill.BackgroundColor = XLColor.AliceBlue; worksheet.Column(1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; //Format currency data cells var currencyrange = worksheet.Range(2, 5, _projects.Count, 5); currencyrange.Style.NumberFormat.Format = "$ #,##0"; currencyrange.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; worksheet.Column(5).Width = 15; var textrange = worksheet.Range(2, 2, _projects.Count, 4); textrange.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; worksheet.Column(2).Width = 25; worksheet.Columns("3:4").Width = 25; var assocrange = worksheet.Range(2, 6, _projects.Count, 6); assocrange.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; worksheet.Column(6).Width = 25; SaveWorkbook(ref workbook); }
private void LoadAssociates(int salesdivisionid) { FullyObservableCollection <UserModel> associatess = DatabaseQueries.GetUsers(); FilterListItem fi; Associates?.Clear(); var q = from associat in associatess where !associat.Deleted && associat.BusinessUnits.Split(',').ToList().Contains(salesdivisionid.ToString()) select associat; if (CurrentUser.ShowOthers) { foreach (UserModel ag in q) { fi = new FilterListItem(); { fi.ID = ag.ID; fi.Name = ag.Name; fi.IsSelected = false; fi.VisibleState = Visibility.Visible; fi.PropertyChanged += FlAssociates_PropertyChanged; Associates.Add(fi); } } foreach (FilterListItem fil in associates) { if (fil.ID == CurrentUser.ID) { fil.IsSelected = true; } } } else { fi = new FilterListItem(); { fi.ID = CurrentUser.ID; fi.Name = CurrentUser.Name; fi.IsSelected = true; fi.VisibleState = Visibility.Visible; fi.PropertyChanged += FlAssociates_PropertyChanged; Associates.Add(fi); } } }
public static FullyObservableCollection <FilterPopupDataModel> SortPopup(FullyObservableCollection <FilterPopupDataModel> coll) { try { if (coll?.Count > 0) { List <FilterPopupDataModel> sorted = coll.OrderBy(x => x.Description).ToList(); for (int i = 0; i < sorted.Count(); i++) { coll.Move(coll.IndexOf(sorted[i]), i); } } } catch { } return(coll); }
public static FullyObservableCollection <FilterPopupDataModel> SortSFStagePopup(FullyObservableCollection <FilterPopupDataModel> coll) { try { if (coll?.Count > 0) { List <FilterPopupDataModel> sorted = coll.OrderBy(x => Convert.ToInt16(x.Description.Remove(x.Description.IndexOf("-")))).ToList(); if (sorted == null || sorted.Count == 0) { sorted = coll.OrderBy(x => x.Description).ToList(); } for (int i = 0; i < sorted.Count(); i++) { coll.Move(coll.IndexOf(sorted[i]), i); } } } catch { } return(coll); }
public static void InitializeApp() { try { if (GetCurrentUser()) { LogAccess(CurrentUser.ID); var(versionok, mustupgrade, url, executable) = GetVersion(); if (!versionok) { if (!string.IsNullOrEmpty(url)) { Clipboard.SetText(url); } if (mustupgrade) { UpdateVersion.Update(url, executable); //App.splashScreen.AddMessage("This version has expired.\nPlease upgrade now\nThe program will shut down in 3 seconds.", 3000); //App.splashScreen?.LoadComplete(); //App.CloseProgram(); } else { App.splashScreen.AddMessage("This version has been retired.\nPlease upgrade", 3000); } } try { GetUserPermissions(); CreateSystemConstants(); Config = GetSetup(); ActivityStatusCodes = GetActivityStatusCodes(); TrialStatuses = GetTrialStatuses(); ProjectTypes = GetProjectTypes(); BusinessUnits = GetBusinessUnits(); } catch { try { App.splashScreen.AddMessage("Unable to load settings.\nProgram is shutting down.", 3000); App.splashScreen?.LoadComplete(); App.CloseProgram(); } catch { Environment.Exit(-1); } } } else { try { App.splashScreen.AddMessage("The user was unable to be authenticated\nCheck the internet and VPN connection\nThe program will now close", 4000); App.splashScreen?.LoadComplete(); App.CloseProgram(); } catch { Environment.Exit(-1); } } } catch { try { App.splashScreen.AddMessage("The program was unable to start", 4000); App.splashScreen?.LoadComplete(); App.CloseProgram(); } catch { Environment.Exit(-1); } } }
private void LoadCountries() { Countries = DatabaseQueries.GetCountries(); }