Example #1
0
 private void FillListBox()
 {
     Userods.RefreshCache();
     UserGroups.RefreshCache();
     GroupPermissions.RefreshCache();
     listUser.BeginUpdate();
     listUser.Items.Clear();
     if (PrefC.GetBool(PrefName.UserNameManualEntry))
     {
         //Because _listUsers is used to verify the user name typed in, we need to include both non-hidden and CEMT users for offices that type in their credentials instead of picking.
         _listUsers = Userods.GetUsers(true);
     }
     else if (checkShowCEMTUsers.Checked)             //Only show list of CEMT users.
     {
         _listUsers = Userods.GetUsersForCEMT().Where(x => !x.IsHidden).ToList();
     }
     else              //This will be the most common way to fill the user list.  Only includes non-hidden, non-CEMT users.
     {
         _listUsers = Userods.GetUsers();
     }
     _listUsers.ForEach(x => listUser.Items.Add(x));
     if (UserNumPrompt > 0)
     {
         listUser.SelectedIndex = _listUsers.FindIndex(x => x.UserNum == UserNumPrompt);            //can be -1 if not found
     }
     else if (Security.CurUser != null)
     {
         listUser.SelectedIndex = _listUsers.FindIndex(x => x.UserNum == Security.CurUser.UserNum); //can be -1 if not found
     }
     if (listUser.SelectedIndex == -1 && listUser.Items.Count > 0)                                  //It is possible there are no users in the list if all users are CEMT users.
     {
         listUser.SelectedIndex = 0;
     }
     listUser.EndUpdate();
 }
Example #2
0
        private void FillGrid()
        {
            EmailAddresses.RefreshCache();
            _listEmailAddresses = EmailAddresses.GetDeepCopy();
            //Add user specific email addresses to the list
            List <Userod> listUsers = new List <Userod>();

            if (Security.IsAuthorized(Permissions.SecurityAdmin, true) && !IsSelectionMode)
            {
                listUsers.AddRange(Userods.GetUsers());                //If authorized, get all non-hidden users.
            }
            else
            {
                listUsers.Add(Security.CurUser);                //Otherwise, just this user.
            }
            foreach (Userod user in listUsers)
            {
                EmailAddress userAddress = EmailAddresses.GetForUser(user.UserNum);
                if (userAddress != null)
                {
                    _listEmailAddresses.Insert(0, userAddress);
                }
            }
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col;

            col = new GridColumn(Lan.g(this, "User Name"), 240);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Sender Address"), 270);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "User"), 135);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Default"), 50, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Notify"), 0, HorizontalAlignment.Center);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow row;

            foreach (EmailAddress emailAddress in _listEmailAddresses)
            {
                row = new GridRow();
                row.Cells.Add(emailAddress.EmailUsername);
                row.Cells.Add(emailAddress.SenderAddress);
                row.Cells.Add(Userods.GetName(emailAddress.UserNum));
                row.Cells.Add((emailAddress.EmailAddressNum == PrefC.GetLong(PrefName.EmailDefaultAddressNum))?"X":"");
                row.Cells.Add((emailAddress.EmailAddressNum == PrefC.GetLong(PrefName.EmailNotifyAddressNum))?"X":"");
                row.Tag = emailAddress;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
Example #3
0
 private void FormWebChatSurveys_Load(object sender, EventArgs e)
 {
     SetFilterControlsAndAction(() => { FillGridWebChatSurveys(); }, textSessionNum, textSurveyTextContains, dateRangeWebChat, comboUsers);
     dateRangeWebChat.SetDateTimeFrom(DateTime.Now.AddDays(-7));
     dateRangeWebChat.SetDateTimeTo(DateTime.Now);
     comboUsers.Items.Clear();
     foreach (Userod user in Userods.GetUsers())
     {
         comboUsers.Items.Add(new ODBoxItem <Userod>(user.UserName, user));
         if (Security.CurUser.UserNum == user.UserNum)               //Select the current user by default.
         {
             comboUsers.SetSelected(comboUsers.Items.Count - 1, true);
         }
     }
     FillGridWebChatSurveys();
 }
Example #4
0
        /// <summary></summary>
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g(this, "User"), 70);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Del"), 25);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Saved"), 80);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            List <WikiPageHist> listWikiPageHists = WikiPageHists.GetByTitleNoPageContent(PageTitleCur);
            WikiPage            wp = WikiPages.GetByTitle(PageTitleCur);

            if (wp != null)
            {
                listWikiPageHists.Add(WikiPages.PageToHist(wp));
            }
            Dictionary <long, string> dictUsers = Userods.GetUsers(listWikiPageHists.Select(x => x.UserNum).Distinct().ToList()) //gets from cache, very fast
                                                  .ToDictionary(x => x.UserNum, x => x.UserName);                                //create dictionary of key=UserNum, value=UserName for fast lookup

            foreach (WikiPageHist wPage in listWikiPageHists)
            {
                ODGridRow row = new ODGridRow();
                string    userName;
                if (!dictUsers.TryGetValue(wPage.UserNum, out userName))
                {
                    userName = "";
                }
                row.Cells.Add(userName);
                row.Cells.Add((wPage.IsDeleted?"X":""));
                row.Cells.Add(wPage.DateTimeSaved.ToString());
                row.Tag = wPage;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            gridMain.SetSelected(gridMain.Rows.Count - 1, true); //There will always be at least one page in the history (the current revision of the page)
            gridMain.ScrollToEnd();                              //in case there are LOTS of revisions
        }
Example #5
0
 private void FormSupplyOrderEdit_Load(object sender, EventArgs e)
 {
     textSupplier.Text = Suppliers.GetName(ListSuppliersAll, SupplyOrderCur.SupplierNum);
     if (SupplyOrderCur.DatePlaced.Year > 2200)
     {
         textDatePlaced.Text    = DateTime.Today.ToShortDateString();
         SupplyOrderCur.UserNum = Security.CurUser.UserNum;
     }
     else
     {
         textDatePlaced.Text = SupplyOrderCur.DatePlaced.ToShortDateString();
     }
     textAmountTotal.Text    = SupplyOrderCur.AmountTotal.ToString("n");
     textShippingCharge.Text = SupplyOrderCur.ShippingCharge.ToString("n");
     if (SupplyOrderCur.DateReceived.Year > 1880)
     {
         textDateReceived.Text = SupplyOrderCur.DateReceived.ToShortDateString();
     }
     textNote.Text = SupplyOrderCur.Note;
     comboUser.Items.AddNone <Userod>();
     comboUser.Items.AddList(Userods.GetUsers().FindAll(x => !x.IsHidden), x => x.UserName);         //the abbr parameter is usually skipped. <T> is inferred.
     comboUser.SetSelectedKey <Userod>(SupplyOrderCur.UserNum, x => x.UserNum, x => Userods.GetName(x));
 }
Example #6
0
        private void FillGrid()
        {
            Cursor = Cursors.WaitCursor;
            datePicker.HideCalendars();
            List <int> listLogIndexesFiltered = GetListIndexesFiltered();

            #region Set Grid Columns
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            gridMain.ListGridColumns.Add(new GridColumn("Guarantor", PrefC.HasClinicsEnabled?-200:-300));
            if (PrefC.HasClinicsEnabled)
            {
                gridMain.ListGridColumns.Add(new GridColumn("Clinic", -100));
            }
            gridMain.ListGridColumns.Add(new GridColumn("User", -100));
            gridMain.ListGridColumns.Add(new GridColumn("Trans Type", -80));
            gridMain.ListGridColumns.Add(new GridColumn("Trans Date Time", -120, HorizontalAlignment.Center, GridSortingStrategy.DateParse));
            gridMain.ListGridColumns.Add(new GridColumn("Demand Type", -85));
            gridMain.ListGridColumns.Add(new GridColumn("Service Code", -85));
            gridMain.ListGridColumns.Add(new GridColumn("Client ID", -75));
            gridMain.ListGridColumns.Add(new GridColumn("Trans Amt", -70, HorizontalAlignment.Right, GridSortingStrategy.AmountParse));
            gridMain.ListGridColumns.Add(new GridColumn("Account Bal", -80, HorizontalAlignment.Right, GridSortingStrategy.AmountParse));
            gridMain.ListGridColumns.Add(new GridColumn("Key Type", -100));
            #endregion Set Grid Columns
            #region Fill Grid Rows
            List <Patient> listFilteredPatLims = listLogIndexesFiltered.Where(x => _dictPatLims.ContainsKey(_listTsiTransLogsAll[x].PatNum))         //Just in case.
                                                 .Select(x => _dictPatLims[_listTsiTransLogsAll[x].PatNum]).DistinctBy(x => x.PatNum).ToList();
            Dictionary <long, string> dictPatNames       = listFilteredPatLims.ToDictionary(x => x.PatNum, x => x.GetNameLF());
            Dictionary <long, string> dictClinicAbbrs    = _listClinics.Where(x => x.ClinicNum > 0).ToDictionary(x => x.ClinicNum, x => x.Abbr);
            Dictionary <long, string> dictPatClinicAbbrs = listFilteredPatLims.ToDictionary(x => x.PatNum, x => Clinics.GetAbbr(x.ClinicNum));
            Dictionary <long, string> dictUserNames      = Userods.GetUsers(listLogIndexesFiltered.Select(x => _listTsiTransLogsAll[x].UserNum).Distinct().ToList())
                                                           .ToDictionary(x => x.UserNum, x => x.UserName);
            gridMain.ListGridRows.Clear();
            int     rowToReselect = -1;
            GridRow row;
            foreach (int i in listLogIndexesFiltered)
            {
                TsiTransLog logCur = _listTsiTransLogsAll[i];
                row = new GridRow();
                string patName = "";
                row.Cells.Add((checkShowPatNums.Checked?(logCur.PatNum.ToString() + " - "):"")
                              + (dictPatNames.TryGetValue(logCur.PatNum, out patName)?patName:Patients.GetNameLF(logCur.PatNum)));
                if (PrefC.HasClinicsEnabled)
                {
                    string clinicAbbr = "";
                    row.Cells.Add((dictClinicAbbrs.TryGetValue(logCur.ClinicNum, out clinicAbbr) || dictPatClinicAbbrs.TryGetValue(logCur.PatNum, out clinicAbbr))?clinicAbbr:"");
                }
                string userName = "";
                row.Cells.Add(dictUserNames.TryGetValue(logCur.UserNum, out userName)?userName:"");
                row.Cells.Add(logCur.TransType.GetDescription());
                row.Cells.Add(logCur.TransDateTime.ToString("g"));
                row.Cells.Add(logCur.DemandType.GetDescription());
                row.Cells.Add(logCur.ServiceCode.GetDescription());
                row.Cells.Add(logCur.ClientId);
                row.Cells.Add(logCur.TransAmt.ToString("n"));
                row.Cells.Add(logCur.AccountBalance.ToString("n"));
                row.Cells.Add(logCur.FKeyType.GetDescription());
                row.Tag = i;
                gridMain.ListGridRows.Add(row);
                if (_selectedLog != null && _selectedLog.TsiTransLogNum == logCur.TsiTransLogNum)
                {
                    rowToReselect = gridMain.ListGridRows.Count - 1;
                }
            }
            #endregion Fill Grid Rows
            gridMain.EndUpdate();
            if (_selectedLog != null)           //row was selected before call to FillGrid
            {
                if (rowToReselect > -1)
                {
                    gridMain.SetSelected(rowToReselect, true);
                }
                else                  //row was selected but is no longer in the grid
                {
                    textSelectedFieldName.Clear();
                    textSelectedFieldDetails.Clear();
                    textRawMsg.SelectionChanged -= textRawMsg_SelectionChanged;
                    textRawMsg.Clear();
                    textRawMsg.SelectionChanged += textRawMsg_SelectionChanged;
                    _selectedLog = null;
                }
            }
            Cursor = Cursors.Default;
        }