예제 #1
0
 ///<summary>Inserts one PhoneEmpDefault into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(PhoneEmpDefault phoneEmpDefault,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         phoneEmpDefault.EmployeeNum=ReplicationServers.GetKey("phoneempdefault","EmployeeNum");
     }
     string command="INSERT INTO phoneempdefault (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="EmployeeNum,";
     }
     command+="NoGraph,NoColor,RingGroups,EmpName,PhoneExt,StatusOverride,Notes,ComputerName,IsPrivateScreen) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(phoneEmpDefault.EmployeeNum)+",";
     }
     command+=
              POut.Bool  (phoneEmpDefault.NoGraph)+","
         +    POut.Bool  (phoneEmpDefault.NoColor)+","
         +    POut.Int   ((int)phoneEmpDefault.RingGroups)+","
         +"'"+POut.String(phoneEmpDefault.EmpName)+"',"
         +    POut.Int   (phoneEmpDefault.PhoneExt)+","
         +    POut.Int   ((int)phoneEmpDefault.StatusOverride)+","
         +"'"+POut.String(phoneEmpDefault.Notes)+"',"
         +"'"+POut.String(phoneEmpDefault.ComputerName)+"',"
         +    POut.Bool  (phoneEmpDefault.IsPrivateScreen)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         phoneEmpDefault.EmployeeNum=Db.NonQ(command,true);
     }
     return phoneEmpDefault.EmployeeNum;
 }
예제 #2
0
 ///<summary>Inserts one PhoneEmpDefault into the database.  Returns the new priKey.</summary>
 internal static long Insert(PhoneEmpDefault phoneEmpDefault)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         phoneEmpDefault.EmployeeNum = DbHelper.GetNextOracleKey("phoneempdefault", "EmployeeNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(phoneEmpDefault, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     phoneEmpDefault.EmployeeNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(phoneEmpDefault, false));
     }
 }
예제 #3
0
파일: PhoneUI.cs 프로젝트: nampn/ODental
        public static void Unavailable(PhoneTile tile)
        {
            if (!ClockIn(tile))
            {
                return;
            }
            int  extension   = tile.PhoneCur.Extension;
            long employeeNum = tile.PhoneCur.EmployeeNum;

            if (!CheckSelectedUserPassword(employeeNum))
            {
                return;
            }
            PhoneEmpDefault ped = PhoneEmpDefaults.GetByExtAndEmp(extension, employeeNum);

            if (ped == null)
            {
                MessageBox.Show("PhoneEmpDefault (employee setting row) not found for Extension " + extension.ToString() + " and EmployeeNum " + employeeNum.ToString());
                return;
            }
            FormPhoneEmpDefaultEdit formPED = new FormPhoneEmpDefaultEdit();

            formPED.PedCur = ped;
            formPED.ShowDialog();
            Phones.SetPhoneStatus(ClockStatusEnum.Unavailable, extension);
        }
예제 #4
0
        private void gridGraph_CellClick(object sender, ODGridClickEventArgs e)
        {
            //only allow clicking on the 'Desired Graph Status' column
            if (e.Col != 3 || gridGraph.Rows[e.Row].Tag == null || !(gridGraph.Rows[e.Row].Tag is PhoneEmpDefault))
            {
                return;
            }
            PhoneEmpDefault phoneEmpDefault = (PhoneEmpDefault)gridGraph.Rows[e.Row].Tag;
            bool            uiGraphStatus   = gridGraph.Rows[e.Row].Cells[e.Col].Text.ToLower() == "x";
            bool            dbGraphStatus   = PhoneEmpDefaults.GetGraphedStatusForEmployeeDate(phoneEmpDefault.EmployeeNum, DateEdit);

            if (uiGraphStatus != dbGraphStatus)
            {
                MessageBox.Show(Lan.g(this, "Graph status has changed unexpectedly for employee: ") + phoneEmpDefault.EmpName + Lan.g(this, ". Exit and reopen this form, and try again."));
                return;
            }
            //flip the bit in the db and reload the grid
            PhoneGraph pg = new PhoneGraph();

            pg.EmployeeNum = phoneEmpDefault.EmployeeNum;
            pg.DateEntry   = DateEdit;
            pg.IsGraphed   = !uiGraphStatus;         //flip the bit
            PhoneGraphs.InsertOrUpdate(pg);          //update the db
            FillGrid();
        }
예제 #5
0
        ///<summary>Returns true if the employee for the PhoneEmpDefault should be added to the selected escalation view.</summary>
        private bool DoAddToEscalationView(PhoneEmpDefault ped, List <Phone> phones)
        {
            if (ped.EscalationOrder <= 0)            //Filter out employees that do not have an escalation order set.
            {
                return(false);
            }
            Phone phone = Phones.GetPhoneForEmployeeNum(phones, ped.EmployeeNum);

            if (phone == null || phone.Description != "")          //Filter out invalid employees or employees that are already on the phone.
            {
                return(false);
            }
            if (_curSubGroupType == PhoneEmpSubGroupType.Avail)           //Special rules for the Avail escalation view
            {
                if (!phone.IsProxVisible)
                {
                    return(false);
                }
                if (!IsAtCurrentLocation(ped))
                {
                    return(false);
                }
                if (!phone.ClockStatus.In(ClockStatusEnum.Available, ClockStatusEnum.Training, ClockStatusEnum.Backup))
                {
                    return(false);
                }
                return(true);
            }
            //All other escalation views besides Avail
            if (!phone.ClockStatus.In(ClockStatusEnum.Available, ClockStatusEnum.OfflineAssist, ClockStatusEnum.Backup))
            {
                return(false);
            }
            return(true);
        }
예제 #6
0
        //Conference Room--------------------------------------------
        private void butGetConfRoom_Click(object sender, EventArgs e)
        {
            if (_listPhones == null || _listPhoneEmpDefaults == null)
            {
                FillTile();
            }
            PhoneEmpDefault ped = null;

            try {
                //phoneTile.PhoneCur could be null which the following line would fail so we will surround this with a try / catch.
                ped = _listPhoneEmpDefaults.FirstOrDefault(x => x.PhoneExt == phoneTile.PhoneCur.Extension);
                if (ped == null)
                {
                    throw new ApplicationException("Invalid PhoneEmpDefault");
                }
            }
            catch (Exception ex) {
                ex.DoNothing();
                MsgBox.Show(this, "This extension is not currently associated to a valid PhoneEmpDefault row.");
                return;
            }
            if (ped.SiteNum < 1)
            {
                MsgBox.Show(this, "This extension is not currently associated to a site.\r\n"
                            + "A site must first be set within the Edit Employee Setting window.");
                return;
            }
            timerConfRoom.Stop();
            labelConfRoom.Text    = "Reserving Conf Room...";
            labelConfRoom.Visible = true;
            _phoneConf            = PhoneConfs.GetAndReserveConfRoom(ped.SiteNum);
            _dateTimeConfRoom     = DateTime.Now;
            _dateTimeConfRoomEnd  = _dateTimeConfRoom.AddMinutes(5);
            timerConfRoom.Start();
        }
예제 #7
0
 ///<summary>Inserts one PhoneEmpDefault into the database.  Returns the new priKey.</summary>
 internal static long Insert(PhoneEmpDefault phoneEmpDefault)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         phoneEmpDefault.EmployeeNum=DbHelper.GetNextOracleKey("phoneempdefault","EmployeeNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(phoneEmpDefault,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     phoneEmpDefault.EmployeeNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(phoneEmpDefault,false);
     }
 }
예제 #8
0
        ///<summary> Resets timers for WebChat based upon ClockStatus and if the employee is a Tech or not. However
        ///It will only alter the timer if a WebChat is ending AND the Phonetile is not bigphones.</summary>
        private void ResetTimer(bool isWebChatEnding)
        {
            if (!CanWebChatResetTimer || !isWebChatEnding)             //J.M. Currently CanWebChatResetTimer is never false, leaving for now.
            {
                return;
            }
            //reset the phone timer if the user just left a chat and they aren't on a phone.
            Phone           phoneOld = _phoneCur.Copy();
            PhoneEmpDefault phoneEmp = PhoneEmpDefaults.Listt.FirstOrDefault(x => x.PhoneExt == _phoneCur.Extension);

            //if the user shouldn't be graphed (not a Tech or on break/home) - Techs with Available status should have a ticking timer, other staff doesn't.
            //phoneEmp.HasColor delimits between Tech and other staff (Tech=HasColor, others!=HasColor)
            if ((phoneEmp != null && !phoneEmp.HasColor) || _phoneCur.ClockStatus == ClockStatusEnum.Home)
            {
                //set their time to minVal. (which means no running timer displayed, see SetPhone() ~line 89)
                //Effectively, the only status that should not have a timer running when a tech ends a webchat is Home.
                _phoneCur.DateTimeStart = DateTime.MinValue;              //set their time to minVal.
                labelTime.Text          = "";
            }
            else if (_phoneCur.ClockStatus.In(ClockStatusEnum.Break, ClockStatusEnum.Lunch))
            {
                //If they are on Lunch or Break, do not restart the timer, set it based on _phoneCur.DateTimeStart.
                labelTime.Text = (DateTime.Now - _phoneCur.DateTimeStart + TimeDelta).ToStringHmmss();
            }
            else
            {
                //If they should be graphed (is a Tech that's not home), then set their time to Now (which means display and restart ticking timer)
                _phoneCur.DateTimeStart = DateTime.Now;              //track how long they've been off the phone.
            }
            Phones.Update(_phoneCur, phoneOld);
        }
예제 #9
0
 private void SetEscalationList(List <PhoneEmpDefault> peds, List <Phone> phones)
 {
     try {
         escalationView.BeginUpdate();
         escalationView.Items.Clear();
         escalationView.DictProximity.Clear();
         escalationView.DictShowExtension.Clear();
         escalationView.DictExtensions.Clear();
         escalationView.DictWebChat.Clear();
         escalationView.DictGTAChat.Clear();
         if (escalationView.Tag == null || (((int)escalationView.Tag) != tabMain.SelectedIndex))
         {
             escalationView.IsNewItems = true;
             escalationView.Tag        = tabMain.SelectedIndex;
         }
         List <PhoneEmpDefault> listFiltered = peds.FindAll(x => DoAddToEscalationView(x, phones));
         List <PhoneEmpDefault> listSorted   = SortForEscalationView(listFiltered, phones);
         if (_listChatUsers == null)
         {
             _listChatUsers = ChatUsers.GetAll();
         }
         if (_listWebChatSessions == null)
         {
             _listWebChatSessions = WebChatSessions.GetActiveSessions();
         }
         for (int i = 0; i < listSorted.Count; i++)
         {
             PhoneEmpDefault ped   = listSorted[i];
             Phone           phone = ODMethodsT.Coalesce(Phones.GetPhoneForEmployeeNum(phones, ped.EmployeeNum));
             escalationView.Items.Add(ped.EmpName);
             //Only show the proximity icon if the phone.IsProxVisible AND the employee is at the same site as our currently selected room.
             escalationView.DictProximity.Add(ped.EmpName, (_mapCur.SiteNum == ped.SiteNum && phone.IsProxVisible));
             WebChatSession webChatSession = _listWebChatSessions.FirstOrDefault(x => x.TechName == phone.EmployeeName);
             if (webChatSession != null)
             {
                 escalationView.DictWebChat.Add(ped.EmpName, true);
                 escalationView.DictGTAChat.Add(ped.EmpName, false);
             }
             else
             {
                 escalationView.DictWebChat.Add(ped.EmpName, false);
                 escalationView.DictGTAChat.Add(ped.EmpName, _listChatUsers.FindAll(x => x.Extension == ped.PhoneExt && x.CurrentSessions > 0).Count > 0);
             }
             //Extensions will always show for both locations unless the employee is not proximal.
             escalationView.DictShowExtension.Add(ped.EmpName, phone.IsProxVisible);
             escalationView.DictExtensions.Add(ped.EmpName, ped.PhoneExt);
         }
     }
     catch {
     }
     finally {
         escalationView.EndUpdate();
     }
 }
예제 #10
0
        public static void EmployeeSettings(Phone phone)
        {
            if (phone == null || phone.EmployeeNum < 1)
            {
                return;
            }
            PhoneEmpDefault         ped  = PhoneEmpDefaults.GetByExtAndEmp(phone.Extension, phone.EmployeeNum);
            FormPhoneEmpDefaultEdit form = new FormPhoneEmpDefaultEdit();

            form.PedCur = ped;
            form.ShowDialog();
        }
예제 #11
0
        private void butUp_Click(object sender, EventArgs e)
        {
            if (gridEscalation.SelectedIndices.Length != 1)
            {
                MsgBox.Show(this, "Select 1 item from escalation list");
                return;
            }
            if (gridEscalation.SelectedIndices[0] == 0)
            {
                return;
            }
            //Retain current selection.
            int curSelectedIndex                 = Math.Max(gridEscalation.SelectedIndices[0] - 1, 0);
            PhoneEmpSubGroupType typeCur         = (PhoneEmpSubGroupType)tabMain.TabPages[tabMain.SelectedIndex].Tag;
            List <int>           selectedIndices = new List <int>(gridEscalation.SelectedIndices);

            for (int i = 0; i < gridEscalation.Rows.Count; i++)
            {
                if (gridEscalation.Rows[i].Tag is PhoneEmpDefault)
                {
                    PhoneEmpDefault ped = (PhoneEmpDefault)gridEscalation.Rows[i].Tag;
                    if (selectedIndices[0] == i + 1)
                    {
                        //First should be safe to use here because it must exist in gridescalation to get here.
                        _dictSubGroupsNew[typeCur].First(x => x.EmployeeNum == ped.EmployeeNum).EscalationOrder++;
                    }
                    else if (selectedIndices[0] == i)
                    {
                        _dictSubGroupsNew[typeCur].First(x => x.EmployeeNum == ped.EmployeeNum).EscalationOrder--;
                    }
                }
                else                  //Tag is an index (int)
                {
                    int index = (int)gridEscalation.Rows[i].Tag;
                    if (selectedIndices[0] == i + 1)
                    {
                        //First should be safe to use here because it must exist in gridescalation to get here.
                        _dictSubGroupsNew[typeCur][index].EscalationOrder++;
                    }
                    else if (selectedIndices[0] == i)
                    {
                        _dictSubGroupsNew[typeCur][index].EscalationOrder--;
                    }
                }
            }
            FillGrids();
            //Reset selection so moving up the list rapidly is easier.
            gridEscalation.SetSelected(curSelectedIndex, true);
        }
예제 #12
0
        private void butRight_Click(object sender, EventArgs e)
        {
            if (gridEmployees.SelectedIndices.Length <= 0)
            {
                return;
            }
            PhoneEmpSubGroupType typeCur = (PhoneEmpSubGroupType)tabMain.TabPages[tabMain.SelectedIndex].Tag;

            foreach (int i in gridEmployees.SelectedIndices)
            {
                PhoneEmpDefault pedKeep = (PhoneEmpDefault)gridEmployees.Rows[i].Tag;
                _dictSubGroupsNew[typeCur].Add(new PhoneEmpSubGroup(pedKeep.EmployeeNum, typeCur, 0));
            }
            FillGrids();
        }
예제 #13
0
 ///<summary>Inserts one PhoneEmpDefault into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(PhoneEmpDefault phoneEmpDefault)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(phoneEmpDefault, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             phoneEmpDefault.EmployeeNum = DbHelper.GetNextOracleKey("phoneempdefault", "EmployeeNum");                  //Cacheless method
         }
         return(InsertNoCache(phoneEmpDefault, true));
     }
 }
예제 #14
0
 ///<summary>Returns true if Update(PhoneEmpDefault,PhoneEmpDefault) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(PhoneEmpDefault phoneEmpDefault, PhoneEmpDefault oldPhoneEmpDefault)
 {
     if (phoneEmpDefault.IsGraphed != oldPhoneEmpDefault.IsGraphed)
     {
         return(true);
     }
     if (phoneEmpDefault.HasColor != oldPhoneEmpDefault.HasColor)
     {
         return(true);
     }
     if (phoneEmpDefault.RingGroups != oldPhoneEmpDefault.RingGroups)
     {
         return(true);
     }
     if (phoneEmpDefault.EmpName != oldPhoneEmpDefault.EmpName)
     {
         return(true);
     }
     if (phoneEmpDefault.PhoneExt != oldPhoneEmpDefault.PhoneExt)
     {
         return(true);
     }
     if (phoneEmpDefault.StatusOverride != oldPhoneEmpDefault.StatusOverride)
     {
         return(true);
     }
     if (phoneEmpDefault.Notes != oldPhoneEmpDefault.Notes)
     {
         return(true);
     }
     if (phoneEmpDefault.IsPrivateScreen != oldPhoneEmpDefault.IsPrivateScreen)
     {
         return(true);
     }
     if (phoneEmpDefault.IsTriageOperator != oldPhoneEmpDefault.IsTriageOperator)
     {
         return(true);
     }
     if (phoneEmpDefault.EscalationOrder != oldPhoneEmpDefault.EscalationOrder)
     {
         return(true);
     }
     if (phoneEmpDefault.SiteNum != oldPhoneEmpDefault.SiteNum)
     {
         return(true);
     }
     return(false);
 }
예제 #15
0
        ///<summary>Updates one PhoneEmpDefault in the database.</summary>
        internal static void Update(PhoneEmpDefault phoneEmpDefault)
        {
            string command = "UPDATE phoneempdefault SET "
                             + "NoGraph        =  " + POut.Bool(phoneEmpDefault.NoGraph) + ", "
                             + "NoColor        =  " + POut.Bool(phoneEmpDefault.NoColor) + ", "
                             + "RingGroups     =  " + POut.Int((int)phoneEmpDefault.RingGroups) + ", "
                             + "EmpName        = '" + POut.String(phoneEmpDefault.EmpName) + "', "
                             + "PhoneExt       =  " + POut.Int(phoneEmpDefault.PhoneExt) + ", "
                             + "StatusOverride =  " + POut.Int((int)phoneEmpDefault.StatusOverride) + ", "
                             + "Notes          = '" + POut.String(phoneEmpDefault.Notes) + "', "
                             + "ComputerName   = '" + POut.String(phoneEmpDefault.ComputerName) + "', "
                             + "IsPrivateScreen=  " + POut.Bool(phoneEmpDefault.IsPrivateScreen) + " "
                             + "WHERE EmployeeNum = " + POut.Long(phoneEmpDefault.EmployeeNum);

            Db.NonQ(command);
        }
예제 #16
0
        ///<summary>Updates one PhoneEmpDefault in the database.</summary>
        public static void Update(PhoneEmpDefault phoneEmpDefault)
        {
            string command = "UPDATE phoneempdefault SET "
                             + "IsGraphed       =  " + POut.Bool(phoneEmpDefault.IsGraphed) + ", "
                             + "HasColor        =  " + POut.Bool(phoneEmpDefault.HasColor) + ", "
                             + "RingGroups      =  " + POut.Int((int)phoneEmpDefault.RingGroups) + ", "
                             + "EmpName         = '" + POut.String(phoneEmpDefault.EmpName) + "', "
                             + "PhoneExt        =  " + POut.Int(phoneEmpDefault.PhoneExt) + ", "
                             + "StatusOverride  =  " + POut.Int((int)phoneEmpDefault.StatusOverride) + ", "
                             + "Notes           = '" + POut.String(phoneEmpDefault.Notes) + "', "
                             + "IsPrivateScreen =  " + POut.Bool(phoneEmpDefault.IsPrivateScreen) + ", "
                             + "IsTriageOperator=  " + POut.Bool(phoneEmpDefault.IsTriageOperator) + ", "
                             + "EscalationOrder =  " + POut.Int(phoneEmpDefault.EscalationOrder) + ", "
                             + "SiteNum         =  " + POut.Long(phoneEmpDefault.SiteNum) + " "
                             + "WHERE EmployeeNum = " + POut.Long(phoneEmpDefault.EmployeeNum);

            Db.NonQ(command);
        }
예제 #17
0
        private void labelExtensionName_DoubleClicked(Phone phoneCur)
        {
            if (phoneCur == null || phoneCur.EmployeeNum < 1)
            {
                return;
            }
            PhoneEmpDefault phoneEmpDefault = PhoneEmpDefaults.GetOne(phoneCur.EmployeeNum);

            if (phoneEmpDefault == null)
            {
                MessageBox.Show("No 'phoneempdefault' row found for EmployeeNum " + phoneCur.EmployeeNum
                                + ".\r\nGo to Phone Settings window and add a row for this employee.");
                return;
            }
            FormPhoneEmpDefaultEdit FormPEDE = new FormPhoneEmpDefaultEdit();

            FormPEDE.PedCur = phoneEmpDefault;
            FormPEDE.ShowDialog();
        }
예제 #18
0
        public static void EmployeeSettings(Phone phone)
        {
            if (phone == null || phone.EmployeeNum < 1)
            {
                return;
            }
            PhoneEmpDefault ped = PhoneEmpDefaults.GetByExtAndEmp(phone.Extension, phone.EmployeeNum);

            if (ped == null)
            {
                MsgBox.Show(Lan.g("PhoneUI", "Could not find the selected EmployeeNum/Extension pair in database. " +
                                  "Please verify that the correct extension is listed for this user in map setup."));
                return;
            }
            FormPhoneEmpDefaultEdit form = new FormPhoneEmpDefaultEdit();

            form.PedCur = ped;
            form.ShowDialog();
        }
예제 #19
0
        private void FillTile()
        {
            //Get the new phone list from the database and redraw control.
            SetPhoneList(PhoneEmpDefaults.Refresh(), Phones.GetPhoneList());
            //Set the currently selected phone accordingly.
            if (phoneList == null)           //No phone list. Shouldn't get here.
            {
                phoneTile.SetPhone(null, null, false);
                return;
            }
            Phone           phone           = Phones.GetPhoneForExtension(phoneList, Extension);
            PhoneEmpDefault phoneEmpDefault = null;

            if (phone != null)
            {
                phoneEmpDefault = PhoneEmpDefaults.GetEmpDefaultFromList(phone.EmployeeNum, phoneEmpDefaultList);
            }
            phoneTile.SetPhone(phone, phoneEmpDefault, PhoneEmpDefaults.IsTriageOperatorForExtension(Extension, phoneEmpDefaultList));
        }
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<PhoneEmpDefault> TableToList(DataTable table){
			List<PhoneEmpDefault> retVal=new List<PhoneEmpDefault>();
			PhoneEmpDefault phoneEmpDefault;
			for(int i=0;i<table.Rows.Count;i++) {
				phoneEmpDefault=new PhoneEmpDefault();
				phoneEmpDefault.EmployeeNum     = PIn.Long  (table.Rows[i]["EmployeeNum"].ToString());
				phoneEmpDefault.IsGraphed       = PIn.Bool  (table.Rows[i]["IsGraphed"].ToString());
				phoneEmpDefault.HasColor        = PIn.Bool  (table.Rows[i]["HasColor"].ToString());
				phoneEmpDefault.RingGroups      = (AsteriskRingGroups)PIn.Int(table.Rows[i]["RingGroups"].ToString());
				phoneEmpDefault.EmpName         = PIn.String(table.Rows[i]["EmpName"].ToString());
				phoneEmpDefault.PhoneExt        = PIn.Int   (table.Rows[i]["PhoneExt"].ToString());
				phoneEmpDefault.StatusOverride  = (PhoneEmpStatusOverride)PIn.Int(table.Rows[i]["StatusOverride"].ToString());
				phoneEmpDefault.Notes           = PIn.String(table.Rows[i]["Notes"].ToString());
				phoneEmpDefault.ComputerName    = PIn.String(table.Rows[i]["ComputerName"].ToString());
				phoneEmpDefault.IsPrivateScreen = PIn.Bool  (table.Rows[i]["IsPrivateScreen"].ToString());
				phoneEmpDefault.IsTriageOperator= PIn.Bool  (table.Rows[i]["IsTriageOperator"].ToString());
				retVal.Add(phoneEmpDefault);
			}
			return retVal;
		}
예제 #21
0
        ///<summary>Inserts one PhoneEmpDefault into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(PhoneEmpDefault phoneEmpDefault, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO phoneempdefault (";

            if (!useExistingPK && isRandomKeys)
            {
                phoneEmpDefault.EmployeeNum = ReplicationServers.GetKeyNoCache("phoneempdefault", "EmployeeNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "EmployeeNum,";
            }
            command += "IsGraphed,HasColor,RingGroups,EmpName,PhoneExt,StatusOverride,Notes,IsPrivateScreen,IsTriageOperator,EscalationOrder,SiteNum) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(phoneEmpDefault.EmployeeNum) + ",";
            }
            command +=
                POut.Bool(phoneEmpDefault.IsGraphed) + ","
                + POut.Bool(phoneEmpDefault.HasColor) + ","
                + POut.Int((int)phoneEmpDefault.RingGroups) + ","
                + "'" + POut.String(phoneEmpDefault.EmpName) + "',"
                + POut.Int(phoneEmpDefault.PhoneExt) + ","
                + POut.Int((int)phoneEmpDefault.StatusOverride) + ","
                + "'" + POut.String(phoneEmpDefault.Notes) + "',"
                + POut.Bool(phoneEmpDefault.IsPrivateScreen) + ","
                + POut.Bool(phoneEmpDefault.IsTriageOperator) + ","
                + POut.Int(phoneEmpDefault.EscalationOrder) + ","
                + POut.Long(phoneEmpDefault.SiteNum) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                phoneEmpDefault.EmployeeNum = Db.NonQ(command, true, "EmployeeNum", "phoneEmpDefault");
            }
            return(phoneEmpDefault.EmployeeNum);
        }
예제 #22
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        internal static List <PhoneEmpDefault> TableToList(DataTable table)
        {
            List <PhoneEmpDefault> retVal = new List <PhoneEmpDefault>();
            PhoneEmpDefault        phoneEmpDefault;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                phoneEmpDefault                 = new PhoneEmpDefault();
                phoneEmpDefault.EmployeeNum     = PIn.Long(table.Rows[i]["EmployeeNum"].ToString());
                phoneEmpDefault.NoGraph         = PIn.Bool(table.Rows[i]["NoGraph"].ToString());
                phoneEmpDefault.NoColor         = PIn.Bool(table.Rows[i]["NoColor"].ToString());
                phoneEmpDefault.RingGroups      = (AsteriskRingGroups)PIn.Int(table.Rows[i]["RingGroups"].ToString());
                phoneEmpDefault.EmpName         = PIn.String(table.Rows[i]["EmpName"].ToString());
                phoneEmpDefault.PhoneExt        = PIn.Int(table.Rows[i]["PhoneExt"].ToString());
                phoneEmpDefault.StatusOverride  = (PhoneEmpStatusOverride)PIn.Int(table.Rows[i]["StatusOverride"].ToString());
                phoneEmpDefault.Notes           = PIn.String(table.Rows[i]["Notes"].ToString());
                phoneEmpDefault.ComputerName    = PIn.String(table.Rows[i]["ComputerName"].ToString());
                phoneEmpDefault.IsPrivateScreen = PIn.Bool(table.Rows[i]["IsPrivateScreen"].ToString());
                retVal.Add(phoneEmpDefault);
            }
            return(retVal);
        }
예제 #23
0
        private void FillTile()
        {
            //UpdateComboRooms();//We can't do this in the constructor and all the other methods fire too often.  FillTile is a good place for this.
            //Get the new phone list from the database and redraw control.
            SetPhoneList(PhoneEmpDefaults.Refresh(), Phones.GetPhoneList());
            //Set the currently selected phone accordingly.
            if (_listPhones == null)           //No phone list. Shouldn't get here.
            {
                phoneTile.SetPhone(null, null, null, false);
                return;
            }
            Phone           phone           = Phones.GetPhoneForExtension(_listPhones, Extension);
            PhoneEmpDefault phoneEmpDefault = null;
            ChatUser        chatUser        = null;

            if (phone != null)
            {
                phoneEmpDefault = PhoneEmpDefaults.GetEmpDefaultFromList(phone.EmployeeNum, _listPhoneEmpDefaults);
                chatUser        = ChatUsers.GetFromExt(phone.Extension);
            }
            phoneTile.SetPhone(phone, phoneEmpDefault, chatUser, PhoneEmpDefaults.IsTriageOperatorForExtension(Extension, _listPhoneEmpDefaults));
        }
예제 #24
0
        ///<summary>Inserts one PhoneEmpDefault into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(PhoneEmpDefault phoneEmpDefault, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                phoneEmpDefault.EmployeeNum = ReplicationServers.GetKey("phoneempdefault", "EmployeeNum");
            }
            string command = "INSERT INTO phoneempdefault (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "EmployeeNum,";
            }
            command += "IsGraphed,HasColor,RingGroups,EmpName,PhoneExt,StatusOverride,Notes,ComputerName,IsPrivateScreen,IsTriageOperator) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(phoneEmpDefault.EmployeeNum) + ",";
            }
            command +=
                POut.Bool(phoneEmpDefault.IsGraphed) + ","
                + POut.Bool(phoneEmpDefault.HasColor) + ","
                + POut.Int((int)phoneEmpDefault.RingGroups) + ","
                + "'" + POut.String(phoneEmpDefault.EmpName) + "',"
                + POut.Int(phoneEmpDefault.PhoneExt) + ","
                + POut.Int((int)phoneEmpDefault.StatusOverride) + ","
                + "'" + POut.String(phoneEmpDefault.Notes) + "',"
                + "'" + POut.String(phoneEmpDefault.ComputerName) + "',"
                + POut.Bool(phoneEmpDefault.IsPrivateScreen) + ","
                + POut.Bool(phoneEmpDefault.IsTriageOperator) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                phoneEmpDefault.EmployeeNum = Db.NonQ(command, true);
            }
            return(phoneEmpDefault.EmployeeNum);
        }
예제 #25
0
 private void SetEscalationList(List <PhoneEmpDefault> peds, List <Phone> phones)
 {
     try {
         escalationView.BeginUpdate();
         escalationView.Items.Clear();
         escalationView.DictProximity.Clear();
         escalationView.DictShowExtension.Clear();
         escalationView.DictExtensions.Clear();
         escalationView.DictColors.Clear();
         if (escalationView.Tag == null || (((int)escalationView.Tag) != tabMain.SelectedIndex))
         {
             escalationView.IsNewItems = true;
             escalationView.Tag        = tabMain.SelectedIndex;
         }
         List <PhoneEmpDefault> listFiltered = peds.FindAll(x => DoAddToEscalationView(x, phones));
         List <PhoneEmpDefault> listSorted   = SortForEscalationView(listFiltered, phones);
         for (int i = 0; i < listSorted.Count; i++)
         {
             PhoneEmpDefault ped   = listSorted[i];
             Phone           phone = ODMethodsT.Coalesce(Phones.GetPhoneForEmployeeNum(phones, ped.EmployeeNum));
             escalationView.Items.Add(ped.EmpName);
             //Only show the proximity icon if the phone.IsProxVisible AND the employee is at the same site as our currently selected room.
             escalationView.DictProximity.Add(ped.EmpName, (_mapCur.SiteNum == ped.SiteNum && phone.IsProxVisible));
             //Extensions will always show for both locations unless the employee is not proximal.
             escalationView.DictShowExtension.Add(ped.EmpName, phone.IsProxVisible);
             escalationView.DictExtensions.Add(ped.EmpName, ped.PhoneExt);
             if (_mapCur.SiteNum != ped.SiteNum)
             {
                 escalationView.DictColors.Add(ped.EmpName, SiteLinks.GetSiteColorBySiteNum(ped.SiteNum, escalationView.BackColor));
             }
         }
     }
     catch {
     }
     finally {
         escalationView.EndUpdate();
     }
 }
예제 #26
0
        public static void Unavailable(Phone phone)
        {
            if (!ClockEvents.IsClockedIn(Security.CurUser.EmployeeNum))              //Employee performing the action must be clocked in.
            {
                MsgBox.Show("PhoneUI", "You must clock in before completing this action.");
                return;
            }
            if (!ClockEvents.IsClockedIn(phone.EmployeeNum))              //Employee having action performed must be clocked in.
            {
                MessageBox.Show(Lan.g("PhoneUI", "Target employee must be clocked in before setting this status:") + " " + phone.EmployeeName);
                return;
            }
            if (!CheckUserCanChangeStatus(phone))
            {
                return;
            }
            int             extension   = phone.Extension;
            long            employeeNum = phone.EmployeeNum;
            PhoneEmpDefault ped         = PhoneEmpDefaults.GetByExtAndEmp(extension, employeeNum);

            if (ped == null)
            {
                MessageBox.Show("PhoneEmpDefault (employee setting row) not found for Extension " + extension.ToString() + " and EmployeeNum " + employeeNum.ToString());
                return;
            }
            FormPhoneEmpDefaultEdit formPED = new FormPhoneEmpDefaultEdit();

            formPED.PedCur = ped;
            formPED.PedCur.StatusOverride = PhoneEmpStatusOverride.Unavailable;
            if (formPED.ShowDialog() == DialogResult.OK && formPED.PedCur.StatusOverride == PhoneEmpStatusOverride.Unavailable)
            {
                //This phone status update can get skipped from within the editor if the employee is not clocked in.
                //This would be the case when you are setting an employee other than yourself to Unavailable.
                //So we will set it here. This keeps the phone table and phone panel in sync.
                Phones.SetPhoneStatus(ClockStatusEnum.Unavailable, formPED.PedCur.PhoneExt, formPED.PedCur.EmployeeNum);
                PhoneAsterisks.SetQueueForExtension(phone.Extension, AsteriskQueues.None);
            }
        }
예제 #27
0
        private void butLeft_Click(object sender, EventArgs e)
        {
            if (gridEscalation.SelectedIndices.Length <= 0)
            {
                return;
            }
            PhoneEmpSubGroupType typeCur = (PhoneEmpSubGroupType)tabMain.TabPages[tabMain.SelectedIndex].Tag;

            foreach (int i in gridEscalation.SelectedIndices)
            {
                if (gridEscalation.Rows[i].Tag is PhoneEmpDefault)
                {
                    PhoneEmpDefault pedCur = (PhoneEmpDefault)gridEscalation.Rows[i].Tag;
                    _dictSubGroupsNew[typeCur].RemoveAll(x => x.EmployeeNum == pedCur.EmployeeNum);
                }
                else                  //Tag is an index (int)
                {
                    int index = (int)gridEscalation.Rows[i].Tag;
                    _dictSubGroupsNew[typeCur].RemoveAt(index);
                }
            }
            FillGrids();
        }
예제 #28
0
        private void FormPhoneEmpDefaultEdit_Load(object sender, System.EventArgs e)
        {
            _pedOld = PedCur.Clone();
            if (!IsNew)
            {
                textEmployeeNum.ReadOnly = true;
            }
            textEmployeeNum.Text   = PedCur.EmployeeNum.ToString();
            textEmpName.Text       = PedCur.EmpName;
            checkIsGraphed.Checked = PedCur.IsGraphed;
            checkHasColor.Checked  = PedCur.HasColor;
            for (int i = 0; i < Enum.GetNames(typeof(AsteriskQueues)).Length; i++)
            {
                listRingGroup.Items.Add(Enum.GetNames(typeof(AsteriskQueues))[i]);
            }
            listRingGroup.SelectedIndex = (int)PedCur.RingGroups;
            textPhoneExt.Text           = PedCur.PhoneExt.ToString();
            for (int i = 0; i < Enum.GetNames(typeof(PhoneEmpStatusOverride)).Length; i++)
            {
                listStatusOverride.Items.Add(Enum.GetNames(typeof(PhoneEmpStatusOverride))[i]);
            }
            listStatusOverride.SelectedIndex = (int)PedCur.StatusOverride;
            textNotes.Text = PedCur.Notes;
            List <Site> _listSites = Sites.GetDeepCopy();

            for (int i = 0; i < _listSites.Count; i++)
            {
                comboSite.Items.Add(new ODBoxItem <Site>(_listSites[i].Description, _listSites[i]));
                if (_listSites[i].SiteNum == _pedOld.SiteNum)
                {
                    comboSite.SelectedIndex = i;
                }
            }
            checkIsPrivateScreen.Checked  = true;         //we no longer capture screen shots.
            checkIsTriageOperator.Checked = PedCur.IsTriageOperator;
            FillGrid();
        }
예제 #29
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <PhoneEmpDefault> TableToList(DataTable table)
        {
            List <PhoneEmpDefault> retVal = new List <PhoneEmpDefault>();
            PhoneEmpDefault        phoneEmpDefault;

            foreach (DataRow row in table.Rows)
            {
                phoneEmpDefault                  = new PhoneEmpDefault();
                phoneEmpDefault.EmployeeNum      = PIn.Long(row["EmployeeNum"].ToString());
                phoneEmpDefault.IsGraphed        = PIn.Bool(row["IsGraphed"].ToString());
                phoneEmpDefault.HasColor         = PIn.Bool(row["HasColor"].ToString());
                phoneEmpDefault.RingGroups       = (OpenDentBusiness.AsteriskQueues)PIn.Int(row["RingGroups"].ToString());
                phoneEmpDefault.EmpName          = PIn.String(row["EmpName"].ToString());
                phoneEmpDefault.PhoneExt         = PIn.Int(row["PhoneExt"].ToString());
                phoneEmpDefault.StatusOverride   = (OpenDentBusiness.PhoneEmpStatusOverride)PIn.Int(row["StatusOverride"].ToString());
                phoneEmpDefault.Notes            = PIn.String(row["Notes"].ToString());
                phoneEmpDefault.IsPrivateScreen  = PIn.Bool(row["IsPrivateScreen"].ToString());
                phoneEmpDefault.IsTriageOperator = PIn.Bool(row["IsTriageOperator"].ToString());
                phoneEmpDefault.EscalationOrder  = PIn.Int(row["EscalationOrder"].ToString());
                phoneEmpDefault.SiteNum          = PIn.Long(row["SiteNum"].ToString());
                retVal.Add(phoneEmpDefault);
            }
            return(retVal);
        }
예제 #30
0
		///<summary>Updates one PhoneEmpDefault in the database.</summary>
		public static void Update(PhoneEmpDefault phoneEmpDefault){
			string command="UPDATE phoneempdefault SET "
				+"IsGraphed       =  "+POut.Bool  (phoneEmpDefault.IsGraphed)+", "
				+"HasColor        =  "+POut.Bool  (phoneEmpDefault.HasColor)+", "
				+"RingGroups      =  "+POut.Int   ((int)phoneEmpDefault.RingGroups)+", "
				+"EmpName         = '"+POut.String(phoneEmpDefault.EmpName)+"', "
				+"PhoneExt        =  "+POut.Int   (phoneEmpDefault.PhoneExt)+", "
				+"StatusOverride  =  "+POut.Int   ((int)phoneEmpDefault.StatusOverride)+", "
				+"Notes           = '"+POut.String(phoneEmpDefault.Notes)+"', "
				+"ComputerName    = '"+POut.String(phoneEmpDefault.ComputerName)+"', "
				+"IsPrivateScreen =  "+POut.Bool  (phoneEmpDefault.IsPrivateScreen)+", "
				+"IsTriageOperator=  "+POut.Bool  (phoneEmpDefault.IsTriageOperator)+", "
				+"EscalationOrder =  "+POut.Int   (phoneEmpDefault.EscalationOrder)+" "
				+"WHERE EmployeeNum = "+POut.Long(phoneEmpDefault.EmployeeNum);
			Db.NonQ(command);
		}
예제 #31
0
        ///<summary>Updates one PhoneEmpDefault in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(PhoneEmpDefault phoneEmpDefault, PhoneEmpDefault oldPhoneEmpDefault)
        {
            string command = "";

            if (phoneEmpDefault.IsGraphed != oldPhoneEmpDefault.IsGraphed)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsGraphed = " + POut.Bool(phoneEmpDefault.IsGraphed) + "";
            }
            if (phoneEmpDefault.HasColor != oldPhoneEmpDefault.HasColor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "HasColor = " + POut.Bool(phoneEmpDefault.HasColor) + "";
            }
            if (phoneEmpDefault.RingGroups != oldPhoneEmpDefault.RingGroups)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RingGroups = " + POut.Int((int)phoneEmpDefault.RingGroups) + "";
            }
            if (phoneEmpDefault.EmpName != oldPhoneEmpDefault.EmpName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmpName = '" + POut.String(phoneEmpDefault.EmpName) + "'";
            }
            if (phoneEmpDefault.PhoneExt != oldPhoneEmpDefault.PhoneExt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PhoneExt = " + POut.Int(phoneEmpDefault.PhoneExt) + "";
            }
            if (phoneEmpDefault.StatusOverride != oldPhoneEmpDefault.StatusOverride)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StatusOverride = " + POut.Int((int)phoneEmpDefault.StatusOverride) + "";
            }
            if (phoneEmpDefault.Notes != oldPhoneEmpDefault.Notes)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Notes = '" + POut.String(phoneEmpDefault.Notes) + "'";
            }
            if (phoneEmpDefault.IsPrivateScreen != oldPhoneEmpDefault.IsPrivateScreen)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsPrivateScreen = " + POut.Bool(phoneEmpDefault.IsPrivateScreen) + "";
            }
            if (phoneEmpDefault.IsTriageOperator != oldPhoneEmpDefault.IsTriageOperator)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsTriageOperator = " + POut.Bool(phoneEmpDefault.IsTriageOperator) + "";
            }
            if (phoneEmpDefault.EscalationOrder != oldPhoneEmpDefault.EscalationOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EscalationOrder = " + POut.Int(phoneEmpDefault.EscalationOrder) + "";
            }
            if (phoneEmpDefault.SiteNum != oldPhoneEmpDefault.SiteNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SiteNum = " + POut.Long(phoneEmpDefault.SiteNum) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE phoneempdefault SET " + command
                      + " WHERE EmployeeNum = " + POut.Long(phoneEmpDefault.EmployeeNum);
            Db.NonQ(command);
            return(true);
        }
예제 #32
0
 ///<summary>Updates one PhoneEmpDefault in the database.</summary>
 internal static void Update(PhoneEmpDefault phoneEmpDefault)
 {
     string command="UPDATE phoneempdefault SET "
         +"NoGraph        =  "+POut.Bool  (phoneEmpDefault.NoGraph)+", "
         +"NoColor        =  "+POut.Bool  (phoneEmpDefault.NoColor)+", "
         +"RingGroups     =  "+POut.Int   ((int)phoneEmpDefault.RingGroups)+", "
         +"EmpName        = '"+POut.String(phoneEmpDefault.EmpName)+"', "
         +"PhoneExt       =  "+POut.Int   (phoneEmpDefault.PhoneExt)+", "
         +"StatusOverride =  "+POut.Int   ((int)phoneEmpDefault.StatusOverride)+", "
         +"Notes          = '"+POut.String(phoneEmpDefault.Notes)+"', "
         +"ComputerName   = '"+POut.String(phoneEmpDefault.ComputerName)+"', "
         +"IsPrivateScreen=  "+POut.Bool  (phoneEmpDefault.IsPrivateScreen)+" "
         +"WHERE EmployeeNum = "+POut.Long(phoneEmpDefault.EmployeeNum);
     Db.NonQ(command);
 }
예제 #33
0
 ///<summary>Updates one PhoneEmpDefault in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
 internal static void Update(PhoneEmpDefault phoneEmpDefault,PhoneEmpDefault oldPhoneEmpDefault)
 {
     string command="";
     if(phoneEmpDefault.NoGraph != oldPhoneEmpDefault.NoGraph) {
         if(command!=""){ command+=",";}
         command+="NoGraph = "+POut.Bool(phoneEmpDefault.NoGraph)+"";
     }
     if(phoneEmpDefault.NoColor != oldPhoneEmpDefault.NoColor) {
         if(command!=""){ command+=",";}
         command+="NoColor = "+POut.Bool(phoneEmpDefault.NoColor)+"";
     }
     if(phoneEmpDefault.RingGroups != oldPhoneEmpDefault.RingGroups) {
         if(command!=""){ command+=",";}
         command+="RingGroups = "+POut.Int   ((int)phoneEmpDefault.RingGroups)+"";
     }
     if(phoneEmpDefault.EmpName != oldPhoneEmpDefault.EmpName) {
         if(command!=""){ command+=",";}
         command+="EmpName = '"+POut.String(phoneEmpDefault.EmpName)+"'";
     }
     if(phoneEmpDefault.PhoneExt != oldPhoneEmpDefault.PhoneExt) {
         if(command!=""){ command+=",";}
         command+="PhoneExt = "+POut.Int(phoneEmpDefault.PhoneExt)+"";
     }
     if(phoneEmpDefault.StatusOverride != oldPhoneEmpDefault.StatusOverride) {
         if(command!=""){ command+=",";}
         command+="StatusOverride = "+POut.Int   ((int)phoneEmpDefault.StatusOverride)+"";
     }
     if(phoneEmpDefault.Notes != oldPhoneEmpDefault.Notes) {
         if(command!=""){ command+=",";}
         command+="Notes = '"+POut.String(phoneEmpDefault.Notes)+"'";
     }
     if(phoneEmpDefault.ComputerName != oldPhoneEmpDefault.ComputerName) {
         if(command!=""){ command+=",";}
         command+="ComputerName = '"+POut.String(phoneEmpDefault.ComputerName)+"'";
     }
     if(phoneEmpDefault.IsPrivateScreen != oldPhoneEmpDefault.IsPrivateScreen) {
         if(command!=""){ command+=",";}
         command+="IsPrivateScreen = "+POut.Bool(phoneEmpDefault.IsPrivateScreen)+"";
     }
     if(command==""){
         return;
     }
     command="UPDATE phoneempdefault SET "+command
         +" WHERE EmployeeNum = "+POut.Long(phoneEmpDefault.EmployeeNum);
     Db.NonQ(command);
 }
예제 #34
0
		///<summary>Updates one PhoneEmpDefault in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
		public static bool Update(PhoneEmpDefault phoneEmpDefault,PhoneEmpDefault oldPhoneEmpDefault){
			string command="";
			if(phoneEmpDefault.IsGraphed != oldPhoneEmpDefault.IsGraphed) {
				if(command!=""){ command+=",";}
				command+="IsGraphed = "+POut.Bool(phoneEmpDefault.IsGraphed)+"";
			}
			if(phoneEmpDefault.HasColor != oldPhoneEmpDefault.HasColor) {
				if(command!=""){ command+=",";}
				command+="HasColor = "+POut.Bool(phoneEmpDefault.HasColor)+"";
			}
			if(phoneEmpDefault.RingGroups != oldPhoneEmpDefault.RingGroups) {
				if(command!=""){ command+=",";}
				command+="RingGroups = "+POut.Int   ((int)phoneEmpDefault.RingGroups)+"";
			}
			if(phoneEmpDefault.EmpName != oldPhoneEmpDefault.EmpName) {
				if(command!=""){ command+=",";}
				command+="EmpName = '"+POut.String(phoneEmpDefault.EmpName)+"'";
			}
			if(phoneEmpDefault.PhoneExt != oldPhoneEmpDefault.PhoneExt) {
				if(command!=""){ command+=",";}
				command+="PhoneExt = "+POut.Int(phoneEmpDefault.PhoneExt)+"";
			}
			if(phoneEmpDefault.StatusOverride != oldPhoneEmpDefault.StatusOverride) {
				if(command!=""){ command+=",";}
				command+="StatusOverride = "+POut.Int   ((int)phoneEmpDefault.StatusOverride)+"";
			}
			if(phoneEmpDefault.Notes != oldPhoneEmpDefault.Notes) {
				if(command!=""){ command+=",";}
				command+="Notes = '"+POut.String(phoneEmpDefault.Notes)+"'";
			}
			if(phoneEmpDefault.ComputerName != oldPhoneEmpDefault.ComputerName) {
				if(command!=""){ command+=",";}
				command+="ComputerName = '"+POut.String(phoneEmpDefault.ComputerName)+"'";
			}
			if(phoneEmpDefault.IsPrivateScreen != oldPhoneEmpDefault.IsPrivateScreen) {
				if(command!=""){ command+=",";}
				command+="IsPrivateScreen = "+POut.Bool(phoneEmpDefault.IsPrivateScreen)+"";
			}
			if(phoneEmpDefault.IsTriageOperator != oldPhoneEmpDefault.IsTriageOperator) {
				if(command!=""){ command+=",";}
				command+="IsTriageOperator = "+POut.Bool(phoneEmpDefault.IsTriageOperator)+"";
			}
			if(phoneEmpDefault.EscalationOrder != oldPhoneEmpDefault.EscalationOrder) {
				if(command!=""){ command+=",";}
				command+="EscalationOrder = "+POut.Int(phoneEmpDefault.EscalationOrder)+"";
			}
			if(command==""){
				return false;
			}
			command="UPDATE phoneempdefault SET "+command
				+" WHERE EmployeeNum = "+POut.Long(phoneEmpDefault.EmployeeNum);
			Db.NonQ(command);
			return true;
		}
예제 #35
0
 ///<summary>Inserts one PhoneEmpDefault into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(PhoneEmpDefault phoneEmpDefault)
 {
     return(InsertNoCache(phoneEmpDefault, false));
 }
예제 #36
0
        private void FillGrid()
        {
            //get PhoneGraph entries for this date
            ListPhoneGraphsForDate = PhoneGraphs.GetAllForDate(DateEdit);
            //get current employee defaults
            ListPhoneEmpDefaults = PhoneEmpDefaults.Refresh();
            ListPhoneEmpDefaults.Sort(new PhoneEmpDefaults.PhoneEmpDefaultComparer(PhoneEmpDefaults.PhoneEmpDefaultComparer.SortBy.name));
            //get schedules
            ListSchedulesForDate = Schedules.GetDayList(DateEdit);
            long selectedEmployeeNum = -1;

            if (gridGraph.Rows.Count >= 1 &&
                gridGraph.GetSelectedIndex() >= 0 &&
                gridGraph.Rows[gridGraph.GetSelectedIndex()].Tag != null &&
                gridGraph.Rows[gridGraph.GetSelectedIndex()].Tag is PhoneEmpDefault)
            {
                selectedEmployeeNum = ((PhoneEmpDefault)gridGraph.Rows[gridGraph.GetSelectedIndex()].Tag).EmployeeNum;
            }
            gridGraph.BeginUpdate();
            gridGraph.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TablePhoneGraphDate", "Employee"), 80);

            gridGraph.Columns.Add(col);             //column 0 (name - not clickable)
            col           = new ODGridColumn(Lan.g("TablePhoneGraphDate", "Schedule"), 130);
            col.TextAlign = HorizontalAlignment.Center;
            gridGraph.Columns.Add(col);             //column 1 (schedule - clickable)
            col           = new ODGridColumn(Lan.g("TablePhoneGraphDate", "Graph Default"), 90);
            col.TextAlign = HorizontalAlignment.Center;
            gridGraph.Columns.Add(col);             //column 2 (default - not clickable)
            col           = new ODGridColumn(Lan.g("TablePhoneGraphDate", "Set Graph Status"), 110);
            col.TextAlign = HorizontalAlignment.Center;
            gridGraph.Columns.Add(col);             //column 3 (set graph status - clickable)
            col           = new ODGridColumn(Lan.g("TablePhoneGraphDate", "Is Overridden?"), 80);
            col.TextAlign = HorizontalAlignment.Center;
            gridGraph.Columns.Add(col);             //column 4 (is value an overridde of default? - not clickable)
            gridGraph.Rows.Clear();
            int selectedRow = -1;

            //loop through all employee defaults and create 1 row per employee
            for (int iPED = 0; iPED < ListPhoneEmpDefaults.Count; iPED++)
            {
                PhoneEmpDefault phoneEmpDefault = ListPhoneEmpDefaults[iPED];
                Employee        employee        = Employees.GetEmp(phoneEmpDefault.EmployeeNum);
                if (employee == null || employee.IsHidden)               //only deal with current employees
                {
                    continue;
                }
                List <Schedule> scheduleForEmployee = Schedules.GetForEmployee(ListSchedulesForDate, phoneEmpDefault.EmployeeNum);
                bool            isGraphed           = phoneEmpDefault.IsGraphed; //set default
                bool            hasOverride         = false;
                for (int iPG = 0; iPG < ListPhoneGraphsForDate.Count; iPG++)     //we have a default, now loop through all known exceptions and find a match
                {
                    PhoneGraph phoneGraph = ListPhoneGraphsForDate[iPG];
                    if (phoneEmpDefault.EmployeeNum == ListPhoneGraphsForDate[iPG].EmployeeNum)                   //found a match so no op necessary for this employee
                    {
                        isGraphed   = phoneGraph.IsGraphed;
                        hasOverride = true;
                        break;
                    }
                }
                ODGridRow row;
                row = new ODGridRow();
                row.Cells.Add(phoneEmpDefault.EmpName);                                                           //column 0 (name - not clickable)
                row.Cells.Add(Schedules.GetCommaDelimStringForScheds(scheduleForEmployee).Replace(", ", "\r\n")); //column 1 (shift times - not clickable)
                row.Cells.Add(phoneEmpDefault.IsGraphed?"X":"");                                                  //column 2 (default - not clickable)
                row.Cells.Add(isGraphed?"X":"");                                                                  //column 3 (set graph status - clickable)
                row.Cells.Add(hasOverride && isGraphed != phoneEmpDefault.IsGraphed?"X":"");                      //column 4 (is overridden to IsGraphed? - not clickable)
                row.Tag = phoneEmpDefault;                                                                        //store the employee for click events
                int rowIndex = gridGraph.Rows.Add(row);
                if (selectedEmployeeNum == phoneEmpDefault.EmployeeNum)
                {
                    selectedRow = rowIndex;
                }
            }
            gridGraph.EndUpdate();
            if (selectedRow >= 0)
            {
                gridGraph.SetSelected(selectedRow, true);
            }
        }
예제 #37
0
 ///<summary>Set the phone which is linked to the extension at this desk. If phone==null then no phone info shown.</summary>
 public void SetPhone(Phone phone, PhoneEmpDefault phoneEmpDefault, ChatUser chat, bool isTriageOperator)
 {
     phoneTile.SetPhone(phone, phoneEmpDefault, chat, isTriageOperator);
 }