Ejemplo n.º 1
0
        private void FillUsers()
        {
            UserGroups.Refresh();
            Userods.Refresh();
            SelectedGroupNum = 0;
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableSecurity", "Username"), 90);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Group"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Employee"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Provider"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Clinic"), 90);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;
            string    usertype = "all";

            if (comboUsers.SelectedIndex == 1)
            {
                usertype = "prov";
            }
            if (comboUsers.SelectedIndex == 2)
            {
                usertype = "emp";
            }
            if (comboUsers.SelectedIndex == 3)
            {
                usertype = "other";
            }
            int classNum = 0;

            if (comboSchoolClass.Visible && comboSchoolClass.SelectedIndex > 0)
            {
                classNum = SchoolClasses.List[comboSchoolClass.SelectedIndex - 1].SchoolClassNum;
            }
            table = Userods.RefreshSecurity(usertype, classNum);
            string userdesc;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                row      = new ODGridRow();
                userdesc = table.Rows[i]["UserName"].ToString();
                if (table.Rows[i]["IsHidden"].ToString() == "1")
                {
                    userdesc += Lan.g(this, "(hidden)");
                }
                row.Cells.Add(userdesc);
                row.Cells.Add(UserGroups.GetGroup(PIn.PInt(table.Rows[i]["UserGroupNum"].ToString())).Description);
                row.Cells.Add(Employees.GetNameFL(PIn.PInt(table.Rows[i]["EmployeeNum"].ToString())));
                row.Cells.Add(Providers.GetNameLF(PIn.PInt(table.Rows[i]["ProvNum"].ToString())));
                row.Cells.Add(Clinics.GetDesc(PIn.PInt(table.Rows[i]["ClinicNum"].ToString())));
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
        ///<summary>Fills gridUsers. Public so that it can be called from the Form that implements this control.</summary>
        public void FillGridUsers()
        {
            _isFillingList = true;
            Userod selectedUser = SelectedUser;          //preserve user selection.

            gridUsers.BeginUpdate();
            gridUsers.Columns.Clear();
            string tableName = "TableSecurity";

            gridUsers.Columns.Add(new ODGridColumn(Lan.g(tableName, "Username"), 90));
            gridUsers.Columns.Add(new ODGridColumn(Lan.g(tableName, "Employee"), 90));
            gridUsers.Columns.Add(new ODGridColumn(Lan.g(tableName, "Provider"), 90));
            if (!PrefC.GetBool(PrefName.EasyNoClinics))
            {
                gridUsers.Columns.Add(new ODGridColumn(Lan.g(tableName, "Clinic"), 80));
                gridUsers.Columns.Add(new ODGridColumn(Lan.g(tableName, "Clinic\r\nRestr"), 38, HorizontalAlignment.Center));
            }
            gridUsers.Columns.Add(new ODGridColumn(Lan.g(tableName, "Strong\r\nPwd"), 45, HorizontalAlignment.Center));
            gridUsers.Rows.Clear();
            List <Userod> listFilteredUsers = GetFilteredUsersHelper();

            foreach (Userod user in listFilteredUsers)
            {
                ODGridRow row = new ODGridRow();
                row.Cells.Add(user.UserName);
                row.Cells.Add(Employees.GetNameFL(user.EmployeeNum));
                row.Cells.Add(Providers.GetLongDesc(user.ProvNum));
                if (!PrefC.GetBool(PrefName.EasyNoClinics))
                {
                    row.Cells.Add(Clinics.GetAbbr(user.ClinicNum));
                    row.Cells.Add(user.ClinicIsRestricted?"X":"");
                }
                row.Cells.Add(user.PasswordIsStrong?"X":"");
                row.Tag = user;
                gridUsers.Rows.Add(row);
            }
            gridUsers.EndUpdate();
            _isFillingList = false;          //Done filling the grid.
            //Selection logic has to occur after ODGrid.EndUpdate().
            if (selectedUser == null || !listFilteredUsers.Any(x => x.UserNum == selectedUser.UserNum))
            {
                //No previously selected user, or previous selection not in filtered list.
                gridUsers.SetSelected(0, true); //Default to first user.
            }
            else                                //Previous selection still exists in grid, so select it again.
            {
                SelectedUser = selectedUser;    //Reselect previously selected user.
            }
            RefreshUserTabGroups();
        }
Ejemplo n.º 3
0
        ///<summary>Fills gridUsers. Public so that it can be called from the Form that implements this control.</summary>
        public void FillGridUsers()
        {
            _isFillingList = true;
            Userod selectedUser = SelectedUser;          //preserve user selection.

            gridUsers.BeginUpdate();
            gridUsers.ListGridColumns.Clear();
            string tableName = "TableSecurity";

            gridUsers.ListGridColumns.Add(new GridColumn(Lan.g(tableName, "Username"), 90));
            gridUsers.ListGridColumns.Add(new GridColumn(Lan.g(tableName, "Employee"), 90));
            gridUsers.ListGridColumns.Add(new GridColumn(Lan.g(tableName, "Provider"), 90));
            if (PrefC.HasClinicsEnabled)
            {
                gridUsers.ListGridColumns.Add(new GridColumn(Lan.g(tableName, "Clinic"), 80));
                gridUsers.ListGridColumns.Add(new GridColumn(Lan.g(tableName, "Clinic\r\nRestr"), 38, HorizontalAlignment.Center));
            }
            gridUsers.ListGridColumns.Add(new GridColumn(Lan.g(tableName, "Strong\r\nPwd"), 45, HorizontalAlignment.Center));
            gridUsers.ListGridRows.Clear();
            List <Userod> listFilteredUsers = GetFilteredUsersHelper();

            foreach (Userod user in listFilteredUsers)
            {
                GridRow row = new GridRow();
                row.Cells.Add(user.UserName);
                row.Cells.Add(Employees.GetNameFL(user.EmployeeNum));
                row.Cells.Add(Providers.GetLongDesc(user.ProvNum));
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(user.ClinicNum));
                    row.Cells.Add(user.ClinicIsRestricted?"X":"");
                }
                row.Cells.Add(user.PasswordIsStrong?"X":"");
                row.Tag = user;
                gridUsers.ListGridRows.Add(row);
            }
            gridUsers.EndUpdate();
            _isFillingList = false;          //Done filling the grid.
            //Selection logic has to occur after ODGrid.EndUpdate().
            if (selectedUser != null)
            {
                //Reselect previously selected user.  SelectedUser is allowed to be null (ex. on load).
                SelectedUser = listFilteredUsers.FirstOrDefault(x => x.UserNum == selectedUser.UserNum);
            }
            RefreshUserTabGroups();
        }
        ///<summary>Returns a filtered list of userods that should be displayed. Returns all users when IsCEMT is true.</summary>
        private List <Userod> GetFilteredUsersHelper()
        {
            List <Userod> retVal = Userods.GetDeepCopy();

            if (IsForCEMT)
            {
                return(retVal);
            }
            if (_dictProvNumProvs == null)              //fill the dictionary if needed
            {
                _dictProvNumProvs = Providers.GetMultProviders(Userods.GetDeepCopy().Select(x => x.ProvNum).ToList()).ToDictionary(x => x.ProvNum, x => x);
            }
            retVal.RemoveAll(x => x.UserNumCEMT > 0);          //NEVER show CEMT users when not in the CEMT tool.
            if (!checkShowHidden.Checked)
            {
                retVal.RemoveAll(x => x.IsHidden);
            }
            long classNum = 0;

            if (comboSchoolClass.Visible && comboSchoolClass.SelectedIndex > 0)
            {
                classNum = ((ODBoxItem <SchoolClass>)comboSchoolClass.SelectedItem).Tag.SchoolClassNum;
            }
            switch (((ODBoxItem <UserFilters>)comboShowOnly.SelectedItem).Tag)
            {
            case UserFilters.Employees:
                retVal.RemoveAll(x => x.EmployeeNum == 0);
                break;

            case UserFilters.Providers:
                retVal.RemoveAll(x => x.ProvNum == 0);
                break;

            case UserFilters.Students:
                //might not count user as student if attached to invalid providers.
                retVal.RemoveAll(x => !_dictProvNumProvs.ContainsKey(x.ProvNum) || _dictProvNumProvs[x.ProvNum].IsInstructor);
                if (classNum > 0)
                {
                    retVal.RemoveAll(x => _dictProvNumProvs[x.ProvNum].SchoolClassNum != classNum);
                }
                break;

            case UserFilters.Instructors:
                retVal.RemoveAll(x => !_dictProvNumProvs.ContainsKey(x.ProvNum) || !_dictProvNumProvs[x.ProvNum].IsInstructor);
                if (classNum > 0)
                {
                    retVal.RemoveAll(x => _dictProvNumProvs[x.ProvNum].SchoolClassNum != classNum);
                }
                break;

            case UserFilters.Other:
                retVal.RemoveAll(x => x.EmployeeNum != 0 || x.ProvNum != 0);
                break;

            case UserFilters.AllUsers:
            default:
                break;
            }
            if (comboClinic.SelectedIndex > 0)
            {
                retVal.RemoveAll(x => x.ClinicNum != ((ODBoxItem <Clinic>)comboClinic.SelectedItem).Tag.ClinicNum);
            }
            if (comboGroups.SelectedIndex > 0)
            {
                retVal.RemoveAll(x => !x.IsInUserGroup(((ODBoxItem <UserGroup>)comboGroups.SelectedItem).Tag.UserGroupNum));
            }
            if (!string.IsNullOrWhiteSpace(textPowerSearch.Text))
            {
                switch (((ODBoxItem <UserFilters>)comboShowOnly.SelectedItem).Tag)
                {
                case UserFilters.Employees:
                    retVal.RemoveAll(x => !Employees.GetNameFL(x.EmployeeNum).ToLower().Contains(textPowerSearch.Text.ToLower()));
                    break;

                case UserFilters.Providers:
                case UserFilters.Students:
                case UserFilters.Instructors:
                    retVal.RemoveAll(x => !_dictProvNumProvs[x.ProvNum].GetLongDesc().ToLower().Contains(textPowerSearch.Text.ToLower()));
                    break;

                case UserFilters.AllUsers:
                case UserFilters.Other:
                default:
                    retVal.RemoveAll(x => !x.UserName.ToLower().Contains(textPowerSearch.Text.ToLower()));
                    break;
                }
            }
            return(retVal);
        }
Ejemplo n.º 5
0
 private void FormUserEdit_Load(object sender, System.EventArgs e)
 {
     checkIsHidden.Checked = UserCur.IsHidden;
     textUserName.Text     = UserCur.UserName;
     for (int i = 0; i < UserGroups.List.Length; i++)
     {
         listUserGroup.Items.Add(UserGroups.List[i].Description);
         if (UserCur.UserGroupNum == UserGroups.List[i].UserGroupNum)
         {
             listUserGroup.SelectedIndex = i;
         }
     }
     if (listUserGroup.SelectedIndex == -1)          //never allowed to delete last group, so this won't fail
     {
         listUserGroup.SelectedIndex = 0;
     }
     listEmployee.Items.Clear();
     listEmployee.Items.Add(Lan.g(this, "none"));
     listEmployee.SelectedIndex = 0;
     for (int i = 0; i < Employees.ListShort.Length; i++)
     {
         listEmployee.Items.Add(Employees.GetNameFL(Employees.ListShort[i]));
         if (UserCur.EmployeeNum == Employees.ListShort[i].EmployeeNum)
         {
             listEmployee.SelectedIndex = i + 1;
         }
     }
     listProv.Items.Clear();
     listProv.Items.Add(Lan.g(this, "none"));
     listProv.SelectedIndex = 0;
     for (int i = 0; i < ProviderC.ListShort.Count; i++)
     {
         listProv.Items.Add(ProviderC.ListShort[i].GetLongDesc());
         if (UserCur.ProvNum == ProviderC.ListShort[i].ProvNum)
         {
             listProv.SelectedIndex = i + 1;
         }
     }
     if (PrefC.GetBool(PrefName.EasyNoClinics))
     {
         labelClinic.Visible             = false;
         listClinic.Visible              = false;
         checkClinicIsRestricted.Visible = false;
     }
     else
     {
         listClinic.Items.Clear();
         listClinic.Items.Add(Lan.g(this, "all"));
         listClinic.SelectedIndex = 0;
         for (int i = 0; i < Clinics.List.Length; i++)
         {
             listClinic.Items.Add(Clinics.List[i].Description);
             if (UserCur.ClinicNum == Clinics.List[i].ClinicNum)
             {
                 listClinic.SelectedIndex = i + 1;
             }
         }
         checkClinicIsRestricted.Checked = UserCur.ClinicIsRestricted;
     }
     if (UserCur.Password == "")
     {
         butPassword.Text = Lan.g(this, "Create Password");
     }
 }
Ejemplo n.º 6
0
 ///<summary>Refresh the phone panel every X seconds after it has already been setup.  Make sure to call FillMapAreaPanel before calling this the first time.</summary>
 public void SetPhoneList(List <PhoneEmpDefault> peds, List <Phone> phones, List <PhoneEmpSubGroup> listSubGroups, List <ChatUser> listChatUsers)
 {
     try {
         string title = "Call Center Map - Triage Coord. - ";
         try {                 //get the triage coord label but don't fail just because we can't find it
             SiteLink siteLink = SiteLinks.GetFirstOrDefault(x => x.SiteNum == _mapCur.SiteNum);
             title += Employees.GetNameFL(Employees.GetEmp(siteLink.EmployeeNum));
         }
         catch {
             title += "Not Set";
         }
         labelTriageCoordinator.Text = title;
         labelCurrentTime.Text       = DateTime.Now.ToShortTimeString();
         #region Triage Counts
         //The triage count used to only count up the triage operators within the currently selected room.
         //Now we want to count all operators at the selected site (local) and then all operators across all sites (total).
         int triageStaffCountLocal = 0;
         int triageStaffCountTotal = 0;
         foreach (PhoneEmpDefault phoneEmpDefault in peds.FindAll(x => x.IsTriageOperator && x.HasColor))
         {
             Phone phone = phones.FirstOrDefault(x => x.Extension == phoneEmpDefault.PhoneExt);
             if (phone == null)
             {
                 continue;
             }
             if (phone.ClockStatus.In(ClockStatusEnum.None, ClockStatusEnum.Home, ClockStatusEnum.Lunch, ClockStatusEnum.Break, ClockStatusEnum.Off
                                      , ClockStatusEnum.Unavailable, ClockStatusEnum.NeedsHelp, ClockStatusEnum.HelpOnTheWay))
             {
                 continue;
             }
             //This is a triage operator who is currently here and on the clock.
             if (phoneEmpDefault.SiteNum == _mapCur.SiteNum)
             {
                 triageStaffCountLocal++;
             }
             triageStaffCountTotal++;
         }
         labelTriageOpsCountLocal.Text = triageStaffCountLocal.ToString();
         labelTriageOpsCountTotal.Text = triageStaffCountTotal.ToString();
         #endregion
         for (int i = 0; i < this.mapAreaPanelHQ.Controls.Count; i++)            //loop through all of our cubicles and labels and find the matches
         {
             try {
                 if (!(this.mapAreaPanelHQ.Controls[i] is MapAreaRoomControl))
                 {
                     continue;
                 }
                 MapAreaRoomControl room = (MapAreaRoomControl)this.mapAreaPanelHQ.Controls[i];
                 if (room.MapAreaItem.Extension == 0)                        //This cubicle has not been given an extension yet.
                 {
                     room.Empty = true;
                     continue;
                 }
                 Phone phone = Phones.GetPhoneForExtension(phones, room.MapAreaItem.Extension);
                 if (phone == null)                       //We have a cubicle with no corresponding phone entry.
                 {
                     room.Empty = true;
                     continue;
                 }
                 ChatUser        chatuser        = listChatUsers.Where(x => x.Extension == phone.Extension).FirstOrDefault();
                 PhoneEmpDefault phoneEmpDefault = PhoneEmpDefaults.GetEmpDefaultFromList(phone.EmployeeNum, peds);
                 if (phoneEmpDefault == null)                       //We have a cubicle with no corresponding phone emp default entry.
                 {
                     room.Empty = true;
                     continue;
                 }
                 //we got this far so we found a corresponding cubicle for this phone entry
                 room.EmployeeNum  = phone.EmployeeNum;
                 room.EmployeeName = phone.EmployeeName;
                 if (phone.DateTimeNeedsHelpStart.Date == DateTime.Today)                        //if they need help, use that time.
                 {
                     TimeSpan span      = DateTime.Now - phone.DateTimeNeedsHelpStart + _timeDelta;
                     DateTime timeOfDay = DateTime.Today + span;
                     room.Elapsed = timeOfDay.ToString("H:mm:ss");
                 }
                 else if (phone.DateTimeStart.Date == DateTime.Today && phone.Description != "")                        //else if in a call, use call time.
                 {
                     TimeSpan span      = DateTime.Now - phone.DateTimeStart + _timeDelta;
                     DateTime timeOfDay = DateTime.Today + span;
                     room.Elapsed = timeOfDay.ToString("H:mm:ss");
                 }
                 else if (phone.Description == "" && chatuser != null && chatuser.CurrentSessions > 0)                    //else if in a chat, use chat time.
                 {
                     TimeSpan span = TimeSpan.FromMilliseconds(chatuser.SessionTime) + _timeDelta;
                     room.Elapsed = span.ToStringHmmss();
                 }
                 else if (phone.DateTimeStart.Date == DateTime.Today)                        //else available, use that time.
                 {
                     TimeSpan span      = DateTime.Now - phone.DateTimeStart + _timeDelta;
                     DateTime timeOfDay = DateTime.Today + span;
                     room.Elapsed = timeOfDay.ToString("H:mm:ss");
                 }
                 else                           //else, whatever.
                 {
                     room.Elapsed = "";
                 }
                 if (phone.IsProxVisible)
                 {
                     room.ProxImage = Properties.Resources.Figure;
                 }
                 else if (phone.DateTProximal.AddHours(8) > DateTime.Now)
                 {
                     room.ProxImage = Properties.Resources.NoFigure;                          //TODO: replace image with one from Nathan
                 }
                 else
                 {
                     room.ProxImage = null;
                 }
                 room.IsAtDesk = phone.IsProxVisible;
                 string status = Phones.ConvertClockStatusToString(phone.ClockStatus);
                 //Check if the user is logged in.
                 if (phone.ClockStatus == ClockStatusEnum.None ||
                     phone.ClockStatus == ClockStatusEnum.Home)
                 {
                     status = "Home";
                 }
                 room.Status = status;
                 if (phone.Description == "")
                 {
                     room.PhoneImage = null;
                     if (chatuser != null && chatuser.CurrentSessions != 0)
                     {
                         room.ChatImage = Properties.Resources.gtaicon3;
                     }
                     else
                     {
                         room.ChatImage = null;
                     }
                 }
                 else
                 {
                     room.PhoneImage = Properties.Resources.phoneInUse;
                 }
                 Color outerColor;
                 Color innerColor;
                 Color fontColor;
                 bool  isTriageOperatorOnTheClock;
                 //get the cubicle color and triage status
                 Phones.GetPhoneColor(phone, phoneEmpDefault, true, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
                 if (!room.IsFlashing)                          //if the control is already flashing then don't overwrite the colors. this would cause a "spastic" flash effect.
                 {
                     room.OuterColor = outerColor;
                     room.InnerColor = innerColor;
                 }
                 room.ForeColor = fontColor;
                 if (phone.ClockStatus == ClockStatusEnum.NeedsHelp)                        //turn on flashing
                 {
                     room.StartFlashing();
                 }
                 else                           //turn off flashing
                 {
                     room.StopFlashing();
                 }
                 room.Invalidate(true);
             }
             catch (Exception e) {
                 e.DoNothing();
             }
         }
         refreshCurrentTabHelper(peds, phones, listSubGroups);
     }
     catch {
         //something failed unexpectedly
     }
 }
Ejemplo n.º 7
0
        private void FormUserEdit_Load(object sender, System.EventArgs e)
        {
            checkIsHidden.Checked = UserCur.IsHidden;
            if (UserCur.UserNum != 0)
            {
                textUserNum.Text = UserCur.UserNum.ToString();
            }
            textUserName.Text   = UserCur.UserName;
            textDomainUser.Text = UserCur.DomainUser;
            if (!PrefC.GetBool(PrefName.DomainLoginEnabled))
            {
                labelDomainUser.Visible   = false;
                textDomainUser.Visible    = false;
                butPickDomainUser.Visible = false;
            }
            checkRequireReset.Checked = UserCur.IsPasswordResetRequired;
            _listUserGroups           = UserGroups.GetList();
            _isFillingList            = true;
            for (int i = 0; i < _listUserGroups.Count; i++)
            {
                listUserGroup.Items.Add(new ODBoxItem <UserGroup>(_listUserGroups[i].Description, _listUserGroups[i]));
                if (!_isFromAddUser && UserCur.IsInUserGroup(_listUserGroups[i].UserGroupNum))
                {
                    listUserGroup.SetSelected(i, true);
                }
                if (_isFromAddUser && _listUserGroups[i].UserGroupNum == PrefC.GetLong(PrefName.DefaultUserGroup))
                {
                    listUserGroup.SetSelected(i, true);
                }
            }
            if (listUserGroup.SelectedIndex == -1)          //never allowed to delete last group, so this won't fail
            {
                listUserGroup.SelectedIndex = 0;
            }
            _isFillingList = false;
            securityTreeUser.FillTreePermissionsInitial();
            RefreshUserTree();
            listEmployee.Items.Clear();
            listEmployee.Items.Add(Lan.g(this, "none"));
            listEmployee.SelectedIndex = 0;
            _listEmployees             = Employees.GetDeepCopy(true);
            for (int i = 0; i < _listEmployees.Count; i++)
            {
                listEmployee.Items.Add(Employees.GetNameFL(_listEmployees[i]));
                if (UserCur.EmployeeNum == _listEmployees[i].EmployeeNum)
                {
                    listEmployee.SelectedIndex = i + 1;
                }
            }
            listProv.Items.Clear();
            listProv.Items.Add(Lan.g(this, "none"));
            listProv.SelectedIndex = 0;
            _listProviders         = Providers.GetDeepCopy(true);
            for (int i = 0; i < _listProviders.Count; i++)
            {
                listProv.Items.Add(_listProviders[i].GetLongDesc());
                if (UserCur.ProvNum == _listProviders[i].ProvNum)
                {
                    listProv.SelectedIndex = i + 1;
                }
            }
            _listClinics           = Clinics.GetDeepCopy(true);
            _listUserAlertTypesOld = AlertSubs.GetAllForUser(UserCur.UserNum);
            List <long> listSubscribedClinics;
            bool        isAllClinicsSubscribed = false;

            if (_listUserAlertTypesOld.Select(x => x.ClinicNum).Contains(-1))             //User subscribed to all clinics
            {
                isAllClinicsSubscribed = true;
                listSubscribedClinics  = _listClinics.Select(x => x.ClinicNum).Distinct().ToList();
            }
            else
            {
                listSubscribedClinics = _listUserAlertTypesOld.Select(x => x.ClinicNum).Distinct().ToList();
            }
            List <long> listAlertCatNums = _listUserAlertTypesOld.Select(x => x.AlertCategoryNum).Distinct().ToList();

            listAlertSubMulti.Items.Clear();
            _listAlertCategories = AlertCategories.GetDeepCopy();
            List <long> listUserAlertCatNums = _listUserAlertTypesOld.Select(x => x.AlertCategoryNum).ToList();

            foreach (AlertCategory cat in _listAlertCategories)
            {
                int index = listAlertSubMulti.Items.Add(Lan.g(this, cat.Description));
                listAlertSubMulti.SetSelected(index, listUserAlertCatNums.Contains(cat.AlertCategoryNum));
            }
            if (!PrefC.HasClinicsEnabled)
            {
                tabClinics.Enabled = false;              //Disables all controls in the clinics tab.  Tab is still selectable.
                listAlertSubsClinicsMulti.Visible = false;
                labelAlertClinic.Visible          = false;
            }
            else
            {
                listClinic.Items.Clear();
                listClinic.Items.Add(Lan.g(this, "All"));
                listAlertSubsClinicsMulti.Items.Add(Lan.g(this, "All"));
                listAlertSubsClinicsMulti.Items.Add(Lan.g(this, "Headquarters"));
                if (UserCur.ClinicNum == 0)               //Unrestricted
                {
                    listClinic.SetSelected(0, true);
                    checkClinicIsRestricted.Enabled = false; //We don't really need this checkbox any more but it's probably better for users to keep it....
                }
                if (isAllClinicsSubscribed)                  //They are subscribed to all clinics
                {
                    listAlertSubsClinicsMulti.SetSelected(0, true);
                }
                else if (listSubscribedClinics.Contains(0))                 //They are subscribed to Headquarters
                {
                    listAlertSubsClinicsMulti.SetSelected(1, true);
                }
                List <UserClinic> listUserClinics = UserClinics.GetForUser(UserCur.UserNum);
                for (int i = 0; i < _listClinics.Count; i++)
                {
                    listClinic.Items.Add(_listClinics[i].Abbr);
                    listClinicMulti.Items.Add(_listClinics[i].Abbr);
                    listAlertSubsClinicsMulti.Items.Add(_listClinics[i].Abbr);
                    if (UserCur.ClinicNum == _listClinics[i].ClinicNum)
                    {
                        listClinic.SetSelected(i + 1, true);
                    }
                    if (UserCur.ClinicNum != 0 && listUserClinics.Exists(x => x.ClinicNum == _listClinics[i].ClinicNum))
                    {
                        listClinicMulti.SetSelected(i, true);                       //No "All" option, don't select i+1
                    }
                    if (!isAllClinicsSubscribed && _listUserAlertTypesOld.Exists(x => x.ClinicNum == _listClinics[i].ClinicNum))
                    {
                        listAlertSubsClinicsMulti.SetSelected(i + 2, true);                     //All+HQ
                    }
                }
                checkClinicIsRestricted.Checked = UserCur.ClinicIsRestricted;
            }
            if (string.IsNullOrEmpty(UserCur.PasswordHash))
            {
                butPassword.Text = Lan.g(this, "Create Password");
            }
            if (!PrefC.IsODHQ)
            {
                butJobRoles.Visible = false;
            }
            if (IsNew)
            {
                butUnlock.Visible = false;
            }
            _listDoseSpotUserPrefOld = UserOdPrefs.GetByUserAndFkeyAndFkeyType(UserCur.UserNum,
                                                                               Programs.GetCur(ProgramName.eRx).ProgramNum, UserOdFkeyType.Program,
                                                                               Clinics.GetForUserod(Security.CurUser, true).Select(x => x.ClinicNum)
                                                                               .Union(new List <long>()
            {
                0
            })                                                //Always include 0 clinic, this is the default, NOT a headquarters only value.
                                                                               .Distinct()
                                                                               .ToList());
            _listDoseSpotUserPrefNew = _listDoseSpotUserPrefOld.Select(x => x.Clone()).ToList();
            _doseSpotUserPrefDefault = _listDoseSpotUserPrefNew.Find(x => x.ClinicNum == 0);
            if (_doseSpotUserPrefDefault == null)
            {
                _doseSpotUserPrefDefault = DoseSpot.GetDoseSpotUserIdFromPref(UserCur.UserNum, 0);
                _listDoseSpotUserPrefNew.Add(_doseSpotUserPrefDefault);
            }
            textDoseSpotUserID.Text = _doseSpotUserPrefDefault.ValueString;
            if (_isFromAddUser && !Security.IsAuthorized(Permissions.SecurityAdmin, true))
            {
                butPassword.Visible       = false;
                checkRequireReset.Checked = true;
                checkRequireReset.Enabled = false;
                butUnlock.Visible         = false;
                butJobRoles.Visible       = false;
            }
            if (!PrefC.HasClinicsEnabled)
            {
                butDoseSpotAdditional.Visible = false;
            }
        }
Ejemplo n.º 8
0
        private void FillUsers()
        {
            UserGroups.RefreshCache();
            Cache.Refresh(InvalidType.Security);
            SelectedGroupNum = 0;
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableSecurity", "Username"), 90);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Group"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Employee"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Provider"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Clinic"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "ClinicRestricted"), 100, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableSecurity", "Strong"), 80, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;
            string    usertype = "all";

            if (comboUsers.SelectedIndex == 1)
            {
                usertype = "prov";
            }
            if (comboUsers.SelectedIndex == 2)
            {
                usertype = "emp";
            }
            if (comboUsers.SelectedIndex == 3)
            {
                usertype = "other";
            }
            long classNum = 0;

            if (comboSchoolClass.Visible && comboSchoolClass.SelectedIndex > 0)
            {
                classNum = SchoolClasses.List[comboSchoolClass.SelectedIndex - 1].SchoolClassNum;
            }
            ListUser = Userods.RefreshSecurity(usertype, classNum);
            string userdesc;

            for (int i = 0; i < ListUser.Count; i++)
            {
                row      = new ODGridRow();
                userdesc = ListUser[i].UserName;
                if (ListUser[i].IsHidden)
                {
                    userdesc += Lan.g(this, "(hidden)");
                }
                row.Cells.Add(userdesc);
                row.Cells.Add(UserGroups.GetGroup(ListUser[i].UserGroupNum).Description);
                row.Cells.Add(Employees.GetNameFL(ListUser[i].EmployeeNum));
                row.Cells.Add(Providers.GetLongDesc(ListUser[i].ProvNum));
                row.Cells.Add(Clinics.GetDesc(ListUser[i].ClinicNum));
                row.Cells.Add(ListUser[i].ClinicIsRestricted?"X":"");
                row.Cells.Add(ListUser[i].PasswordIsStrong?"X":"");
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Ejemplo n.º 9
0
        private void FormSiteLinkEdit_Load(object sender, EventArgs e)
        {
            Site site = Sites.GetFirstOrDefault(x => x.SiteNum == _siteLink.SiteNum);

            if (_siteLink.SiteNum < 1 || site == null)
            {
                MsgBox.Show(this, "Invalid SiteNum set for the passed in siteLink.");
                DialogResult = DialogResult.Abort;
                Close();
                return;
            }
            textSite.Text = site.Description;
            //Octets
            if (!string.IsNullOrEmpty(_siteLink.OctetStart))
            {
                string[] arrayOctets = _siteLink.OctetStart.Split('.');
                if (arrayOctets.Length > 0)
                {
                    textOctet1.Text = arrayOctets[0];
                }
                if (arrayOctets.Length > 1)
                {
                    textOctet2.Text = arrayOctets[1];
                }
                if (arrayOctets.Length > 2)
                {
                    textOctet3.Text = arrayOctets[2];
                }
            }
            //Triage
            comboTriageCoordinator.Items.Clear();
            foreach (Employee employee in Employees.GetDeepCopy(true))
            {
                int index = comboTriageCoordinator.Items.Add(new ODBoxItem <Employee>(Employees.GetNameFL(employee), employee));
                if (_siteLink.EmployeeNum == employee.EmployeeNum)
                {
                    comboTriageCoordinator.SelectedIndex = index;
                }
            }
            //Colors
            panelSiteColor.BackColor  = _siteLink.SiteColor;
            panelForeColor.BackColor  = _siteLink.ForeColor;
            panelInnerColor.BackColor = _siteLink.InnerColor;
            panelOuterColor.BackColor = _siteLink.OuterColor;
            labelOpsCountPreview.SetColors(panelForeColor.BackColor, panelOuterColor.BackColor, panelInnerColor.BackColor);
            FillGridConnections();
        }
Ejemplo n.º 10
0
 ///<summary>Refresh the phone panel every X seconds after it has already been setup.  Make sure to call FillMapAreaPanel before calling this the first time.</summary>
 public void SetPhoneList(List <PhoneEmpDefault> peds, List <Phone> phones)
 {
     try {
         string title = "Call Center Status Map - Triage Coordinator - ";
         try {                 //get the triage coord label but don't fail just because we can't find it
             title += Employees.GetNameFL(PrefC.GetLong(PrefName.HQTriageCoordinator));
         }
         catch {
             title += "Not Set";
         }
         labelTriageCoordinator.Text = title;
         labelCurrentTime.Text       = DateTime.Now.ToShortTimeString();
         int triageStaffCount = 0;
         for (int i = 0; i < this.mapAreaPanelHQ.Controls.Count; i++)            //loop through all of our cubicles and labels and find the matches
         {
             if (!(this.mapAreaPanelHQ.Controls[i] is MapAreaRoomControl))
             {
                 continue;
             }
             MapAreaRoomControl room = (MapAreaRoomControl)this.mapAreaPanelHQ.Controls[i];
             if (room.MapAreaItem.Extension == 0)                    //This cubicle has not been given an extension yet.
             {
                 room.Empty = true;
                 continue;
             }
             Phone phone = Phones.GetPhoneForExtension(phones, room.MapAreaItem.Extension);
             if (phone == null)                   //We have a cubicle with no corresponding phone entry.
             {
                 room.Empty = true;
                 continue;
             }
             PhoneEmpDefault phoneEmpDefault = PhoneEmpDefaults.GetEmpDefaultFromList(phone.EmployeeNum, peds);
             if (phoneEmpDefault == null)                   //We have a cubicle with no corresponding phone emp default entry.
             {
                 room.Empty = true;
                 continue;
             }
             //we got this far so we found a corresponding cubicle for this phone entry
             room.EmployeeNum  = phone.EmployeeNum;
             room.EmployeeName = phone.EmployeeName;
             if (phone.DateTimeStart.Date == DateTime.Today)
             {
                 TimeSpan span      = DateTime.Now - phone.DateTimeStart + _timeDelta;
                 DateTime timeOfDay = DateTime.Today + span;
                 room.Elapsed = timeOfDay.ToString("H:mm:ss");
             }
             else
             {
                 room.Elapsed = "";
             }
             string status = phone.ClockStatus.ToString();
             //Check if the user is logged in.
             if (phone.ClockStatus == ClockStatusEnum.None ||
                 phone.ClockStatus == ClockStatusEnum.Home)
             {
                 status = "Home";
             }
             room.Status = status;
             if (phone.Description == "")
             {
                 room.PhoneImage = null;
             }
             else
             {
                 room.PhoneImage = Properties.Resources.phoneInUse;
             }
             Color outerColor;
             Color innerColor;
             Color fontColor;
             bool  isTriageOperatorOnTheClock = false;
             //get the cubicle color and triage status
             Phones.GetPhoneColor(phone, phoneEmpDefault, true, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
             if (!room.IsFlashing)                      //if the control is already flashing then don't overwrite the colors. this would cause a "spastic" flash effect.
             {
                 room.OuterColor = outerColor;
                 room.InnerColor = innerColor;
             }
             room.ForeColor = fontColor;
             if (isTriageOperatorOnTheClock)
             {
                 triageStaffCount++;
             }
             if (phone.ClockStatus == ClockStatusEnum.NeedsHelp)                    //turn on flashing
             {
                 room.StartFlashing();
             }
             else                       //turn off flashing
             {
                 room.StopFlashing();
             }
             room.Invalidate(true);
         }
         this.labelTriageOpsStaff.Text = triageStaffCount.ToString();
     }
     catch {
         //something failed unexpectedly
     }
 }