Esempio n. 1
0
        public static int GetPhoneExtension(string ipAddress, string computerName)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetInt(MethodBase.GetCurrentMethod(), ipAddress, computerName));
            }
            string          command = "SELECT * FROM phoneempdefault WHERE ComputerName='" + POut.String(computerName) + "'";
            PhoneEmpDefault ped     = Crud.PhoneEmpDefaultCrud.SelectOne(command);

            if (ped != null)
            {
                return(ped.PhoneExt);
            }
            //there is no computername override entered by staff, so figure out what the extension should be
            int extension = 0;

            if (ipAddress.Contains("192.168.0.2"))
            {
                return(PIn.Int(ipAddress.ToString().Substring(10)) - 100);             //eg 205-100=105
            }
            else if (ipAddress.ToString().Contains("10.10.20.1"))
            {
                return(PIn.Int(ipAddress.ToString().Substring(9))); //eg 105
            }
            return(0);                                              //couldn't find good extension
        }
Esempio n. 2
0
 ///<summary></summary>
 public static long Insert(PhoneEmpDefault phoneEmpDefault)
 {
     if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
         phoneEmpDefault.EmployeeNum=Meth.GetLong(MethodBase.GetCurrentMethod(),phoneEmpDefault);
         return phoneEmpDefault.EmployeeNum;
     }
     return Crud.PhoneEmpDefaultCrud.Insert(phoneEmpDefault,true);//user specifies the PK
 }
Esempio n. 3
0
        ///<summary>Special logic needs to be run for the phone system when users clock out.</summary>
        private static void ClockOutForHQ(long employeeNum)
        {
            //The name showing for this extension might change to a different user.
            //It would only need to change if the employee clocking out is not assigned to the current extension. (assigned ext set in the employee table)
            //Get the information corresponding to the employee clocking out.
            PhoneEmpDefault pedClockingOut = PhoneEmpDefaults.GetOne(employeeNum);

            if (pedClockingOut == null)
            {
                return;                //This should never happen.
            }
            //Get the employee that is normally assigned to this extension (assigned ext set in the employee table).
            long permanentLinkageEmployeeNum = Employees.GetEmpNumAtExtension(pedClockingOut.PhoneExt);

            if (permanentLinkageEmployeeNum >= 1)               //Extension is nomrally assigned to an employee.
            {
                if (employeeNum != permanentLinkageEmployeeNum) //This is not the normally linked employee so let's revert back to the proper employee.
                {
                    PhoneEmpDefault pedRevertTo = PhoneEmpDefaults.GetOne(permanentLinkageEmployeeNum);
                    //Make sure the employee we are about to revert is not logged in at yet a different workstation. This would be rare but it's worth checking.
                    if (pedRevertTo != null && !ClockEvents.IsClockedIn(pedRevertTo.EmployeeNum))
                    {
                        //Revert to the permanent extension for this PhoneEmpDefault.
                        pedRevertTo.PhoneExt = pedClockingOut.PhoneExt;
                        PhoneEmpDefaults.Update(pedRevertTo);
                        //Update phone table to match this change.
                        Phones.SetPhoneStatus(ClockStatusEnum.Home, pedRevertTo.PhoneExt, pedRevertTo.EmployeeNum);
                    }
                }
            }
            //Now let's switch this employee back to his normal extension.
            Employee employeeClockingOut = Employees.GetEmp(employeeNum);

            if (employeeClockingOut == null)           //should not get here
            {
                return;
            }
            if (employeeClockingOut.PhoneExt != pedClockingOut.PhoneExt)           //Revert PhoneEmpDefault and Phone to the normally assigned extension for this employee.
            //Start by setting this employee back to their normally assigned extension.
            {
                pedClockingOut.PhoneExt = employeeClockingOut.PhoneExt;
                //Now check to see if we are about to steal yet a third employee's extension.
                Phone phoneCurrentlyOccupiedBy = Phones.GetPhoneForExtension(Phones.GetPhoneList(), employeeClockingOut.PhoneExt);
                if (phoneCurrentlyOccupiedBy != null &&           //There is yet a third employee who is currently occupying this extension.
                    ClockEvents.IsClockedIn(phoneCurrentlyOccupiedBy.EmployeeNum))
                {
                    //The third employee is clocked in so set our employee extension to 0.
                    //The currently clocked in employee will retain the extension for now.
                    //Our employee will retain the proper extension next time they clock in.
                    pedClockingOut.PhoneExt = 0;
                    //Update the phone table accordingly.
                    Phones.UpdatePhoneToEmpty(pedClockingOut.EmployeeNum, -1);
                }
                PhoneEmpDefaults.Update(pedClockingOut);
            }
            //Update phone table to match this change.
            Phones.SetPhoneStatus(ClockStatusEnum.Home, pedClockingOut.PhoneExt, employeeClockingOut.EmployeeNum);
        }
Esempio n. 4
0
 ///<summary></summary>
 public static void Update(PhoneEmpDefault phoneEmpDefault)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), phoneEmpDefault);
         return;
     }
     Crud.PhoneEmpDefaultCrud.Update(phoneEmpDefault);
 }
Esempio n. 5
0
 ///<summary></summary>
 public static long Insert(PhoneEmpDefault phoneEmpDefault)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         phoneEmpDefault.EmployeeNum = Meth.GetLong(MethodBase.GetCurrentMethod(), phoneEmpDefault);
         return(phoneEmpDefault.EmployeeNum);
     }
     return(Crud.PhoneEmpDefaultCrud.Insert(phoneEmpDefault, true));          //user specifies the PK
 }
Esempio n. 6
0
        ///<summary>Each date should have one (and only 1) PhoneGraph entry per employee. Some may already be entered as exceptions to the default. We will fill in the gaps here. This will only be done for today's date (once Today has passed the opportunity to fill the gaps has passed). We don't want to presume that if it was missing on a past date then we should add it. This assumption would fill in gaps on past dates for employees that may not even have worked here on that date.</summary>
        public static void AddMissingEntriesForToday(List <PhoneEmpDefault> peds)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), peds);
                return;
            }
            //get all overrides created for this date
            List <PhoneGraph> listPhoneGraphs = GetAllForDate(DateTime.Today);
            List <Schedule>   listSchedules   = Schedules.GetDayList(DateTime.Today);

            //loop through all defaults and check if there are overrides added
            for (int iPed = 0; iPed < peds.Count; iPed++)
            {
                PhoneEmpDefault ped = peds[iPed];
                bool            hasPhoneGraphEntry = false;
                //we have a default, now loop through all known overrides and find a match
                for (int iPG = 0; iPG < listPhoneGraphs.Count; iPG++)
                {
                    PhoneGraph pg = listPhoneGraphs[iPG];
                    if (ped.EmployeeNum == listPhoneGraphs[iPG].EmployeeNum)                   //found a match so no op necessary for this employee
                    {
                        hasPhoneGraphEntry = true;
                        break;
                    }
                }
                if (hasPhoneGraphEntry)                 //no entry needed, it's already there
                {
                    continue;
                }
                //does employee have a schedule table entry for this date
                bool hasScheduleEntry = false;
                for (int iSch = 0; iSch < listSchedules.Count; iSch++)
                {
                    Schedule schedule = listSchedules[iSch];
                    if (ped.EmployeeNum == listSchedules[iSch].EmployeeNum)                   //found a match so no op necessary for this employee
                    {
                        hasScheduleEntry = true;
                        break;
                    }
                }
                if (!hasScheduleEntry)                  //no entry needed if not on the schedule
                {
                    continue;
                }
                //employee is on the schedule but does not have a phonegraph entry, so create one
                PhoneGraph pgNew = new PhoneGraph();
                pgNew.EmployeeNum = ped.EmployeeNum;
                pgNew.DateEntry   = DateTime.Today;
                pgNew.IsGraphed   = ped.IsGraphed;
                Insert(pgNew);
            }
        }
Esempio n. 7
0
        ///<summary>Sets the phone to the default queue for the employee passed in in regards to the phoneempdefault table.
        ///Will correctly put the phone into the Triage ring group if the PhoneEmpDefault has been flagged as IsTriageOperator
        ///This method does nothing if there is no corresponding phoneempdefault row for the employee passed in.</summary>
        public static void SetToDefaultQueue(PhoneEmpDefault phoneEmpDefault)
        {
            //No need to check RemotingRole; no call to db.
            if (phoneEmpDefault == null)
            {
                return;
            }
            //If the employee was set to triage, do not set them to their default queue, instead set them to the triage queue.
            AsteriskQueues defaultQueue = (phoneEmpDefault.IsTriageOperator ? AsteriskQueues.Triage : phoneEmpDefault.RingGroups);

            PhoneAsterisks.SetQueueForExtension(phoneEmpDefault.PhoneExt, defaultQueue);
        }
Esempio n. 8
0
        ///<summary>Bitmap can be null.  Computername will override ipAddress.</summary>
        public static void SetWebCamImage(string ipAddress, Bitmap bitmap, string computerName)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), ipAddress, bitmap, computerName);
                return;
            }
            //if(ipAddress=="") {
            //	return;
            //}
            string          command = "SELECT * FROM phoneempdefault WHERE ComputerName='" + POut.String(computerName) + "'";
            PhoneEmpDefault ped     = Crud.PhoneEmpDefaultCrud.SelectOne(command);

            if (ped != null)           //we found that computername entered as an override
            {
                command = "UPDATE phone SET "
                          + "WebCamImage   = '" + POut.Bitmap(bitmap, ImageFormat.Png) + "' "        //handles null
                          + "WHERE Extension = " + POut.Long(ped.PhoneExt);
                Db.NonQ(command);
                return;
            }
            //there is no computername override entered by staff, so figure out what the extension should be
            int extension = 0;

            if (ipAddress.Contains("192.168.0.2"))
            {
                extension = PIn.Int(ipAddress.ToString().Substring(10)) - 100;            //eg 205-100=105
            }
            else if (ipAddress.ToString().Contains("10.10.20.1"))
            {
                extension = PIn.Int(ipAddress.ToString().Substring(9));              //eg 105
            }
            if (extension == 0)
            {
                //we don't have a good extension
                return;
            }
            command = "UPDATE phone SET "
                      + "WebCamImage   = '" + POut.Bitmap(bitmap, ImageFormat.Png) + "' " //handles null
                      + "WHERE Extension = " + POut.Long(extension) + " "
                                                                                          //Example: this is computer .204, and ext 104 has a computername override. Don't update ext 104.
                      + "AND NOT EXISTS(SELECT * FROM phoneempdefault WHERE PhoneExt= " + POut.Long(extension) + " "
                      + "AND ComputerName!='')";                                          //there exists a computername override for the extension
            Db.NonQ(command);
        }
Esempio n. 9
0
        ///<summary>Updates the queue for the phone emp default passed in based on the ClockStatus of the current phone entry.</summary>
        public static void SetQueueForClockStatus(PhoneEmpDefault phoneEmpDefault)
        {
            //No need to check RemotingRole; no call to db.
            if (phoneEmpDefault == null)
            {
                return;
            }
            //Start with the default queue for this phone emp default because that was old behavior.
            AsteriskQueues queue;
            //Query the database to get the current ClockStatus for this phone.
            Phone phone = Phones.GetPhoneForExtensionDB(phoneEmpDefault.PhoneExt);

            switch (phone.ClockStatus)
            {
            case ClockStatusEnum.Backup:
                queue = AsteriskQueues.Backup;
                break;

            case ClockStatusEnum.Break:
            case ClockStatusEnum.Home:
            case ClockStatusEnum.Lunch:
            case ClockStatusEnum.OfflineAssist:
            case ClockStatusEnum.TeamAssist:
            case ClockStatusEnum.Training:
            case ClockStatusEnum.Unavailable:
            case ClockStatusEnum.WrapUp:
            case ClockStatusEnum.TCResponder:
                queue = AsteriskQueues.None;
                break;

            case ClockStatusEnum.NeedsHelp:
            case ClockStatusEnum.HelpOnTheWay:
                //Do nothing and leave the queue system completely alone by returning.
                return;

            case ClockStatusEnum.Available:
            default:
                //Use the default queue.
                queue = (phoneEmpDefault.IsTriageOperator ? AsteriskQueues.Triage : phoneEmpDefault.RingGroups);
                break;
            }
            SetQueueForExtension(phoneEmpDefault.PhoneExt, queue);
        }
Esempio n. 10
0
        /// <summary>use sparingly as this makes a db call every time. only used for validating user is not modifying "dirty" data</summary>
        public static bool GetGraphedStatusForEmployeeDate(long employeeNum, DateTime dateEntry)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetBool(MethodBase.GetCurrentMethod(), employeeNum, dateEntry));
            }
            PhoneEmpDefault phoneEmpDefault = Crud.PhoneEmpDefaultCrud.SelectOne(employeeNum);

            if (phoneEmpDefault == null)
            {
                return(false);
            }
            bool       isGraphed  = phoneEmpDefault.IsGraphed;                                    //get employee default
            PhoneGraph phoneGraph = PhoneGraphs.GetForEmployeeNumAndDate(employeeNum, dateEntry); //check for exception

            if (phoneGraph != null)                                                               //exception found so use that
            {
                isGraphed = phoneGraph.IsGraphed;
            }
            return(isGraphed);
        }
		private void butOK_Click(object sender, System.EventArgs e) {
			//Using a switch statement in case we want special functionality for the other statuses later on.
			switch((PhoneEmpStatusOverride)listStatusOverride.SelectedIndex) {
				case PhoneEmpStatusOverride.None:
					if(StatusOld==PhoneEmpStatusOverride.Unavailable) {
						MsgBox.Show(this,"Change your status from unavailable by using the small phone panel.");
						return;
					}
					break;
				case PhoneEmpStatusOverride.OfflineAssist:
					if(StatusOld==PhoneEmpStatusOverride.Unavailable) {
						MsgBox.Show(this,"Change your status from unavailable by using the small phone panel.");
						return;
					}
					break;
			}
			if(IsNew) {
				if(textEmployeeNum.Text=="") {
					MsgBox.Show(this,"Unique EmployeeNum is required.");
					return;
				}
				if(textEmpName.Text=="") {
					MsgBox.Show(this,"Employee name is required.");
					return;
				}
				PedCur.EmployeeNum=PIn.Long(textEmployeeNum.Text);
			}
			//Get the current database state of the phone emp default (before we change it)
			PhoneEmpDefault pedFromDatabase=PhoneEmpDefaults.GetOne(PedCur.EmployeeNum);
			if(pedFromDatabase==null) {
				pedFromDatabase=new PhoneEmpDefault();
			}
			int newExtension=PIn.Int(textPhoneExt.Text);
			bool extensionChange=pedFromDatabase.PhoneExt!=newExtension;
			if(extensionChange) { //Only check when extension has changed and clocked in.
				//We need to prevent changes to phoneempdefault table which involve employees who are currently logged in.
				//Failing to do so would cause subtle race conditions between the phone table and phoneempdefault.
				//Net result would be the phone panel looking wrong.			
				if(ClockEvents.IsClockedIn(PedCur.EmployeeNum)) {//Prevent any change if employee being edited is currently clocked in.
					MsgBox.Show(this,"You must first clock out before making changes");
					return;
				}
				//Find out if the target extension is already being occuppied by a different employee.
				Phone phoneOccuppied=Phones.GetPhoneForExtension(Phones.GetPhoneList(),PIn.Int(textPhoneExt.Text));
				if(phoneOccuppied!=null) {
					if(ClockEvents.IsClockedIn(phoneOccuppied.EmployeeNum)) { //Prevent change if employee's new extension is occupied by a different employee who is currently clocked in.
						MessageBox.Show(Lan.g(this,"This extension cannot be inherited because it is currently occuppied by an employee who is currently logged in.\r\n\r\nExisting employee: ")+phoneOccuppied.EmployeeName);
						return;
					}
					if(phoneOccuppied.EmployeeNum!=PedCur.EmployeeNum) {
						//We are setting to a new employee so let's clean up the old employee.
						//This will prevent duplicates in the phone table and subsequently prevent duplicates in the phone panel.
						Phones.UpdatePhoneToEmpty(phoneOccuppied.EmployeeNum,-1);
						PhoneEmpDefault pedOccuppied=PhoneEmpDefaults.GetOne(phoneOccuppied.EmployeeNum);
						if(pedOccuppied!=null) {//prevent duplicate in phoneempdefault
							pedOccuppied.PhoneExt=0;
							PhoneEmpDefaults.Update(pedOccuppied);
						}
					}
				}
				//Get the employee that is normally assigned to this extension (assigned ext set in the employee table).
				long permanentLinkageEmployeeNum=Employees.GetEmpNumAtExtension(pedFromDatabase.PhoneExt);
				if(permanentLinkageEmployeeNum>=1) { //Extension is nomrally assigned to an employee.
					if(PedCur.EmployeeNum!=permanentLinkageEmployeeNum) {//This is not the normally linked employee so let's revert back to the proper employee.
						PhoneEmpDefault pedRevertTo=PhoneEmpDefaults.GetOne(permanentLinkageEmployeeNum);
						//Make sure the employee we are about to revert is not logged in at yet a different workstation. This would be rare but it's worth checking.
						if(pedRevertTo!=null && !ClockEvents.IsClockedIn(pedRevertTo.EmployeeNum)) {
							//Revert to the permanent extension for this PhoneEmpDefault.
							pedRevertTo.PhoneExt=pedFromDatabase.PhoneExt;
							PhoneEmpDefaults.Update(pedRevertTo);
							//Update phone table to match this change.
							Phones.SetPhoneStatus(ClockStatusEnum.Home,pedRevertTo.PhoneExt,pedRevertTo.EmployeeNum);
						}
					}
				}
			}
			//Ordering of these updates is IMPORTANT!!!
			//Phone Emp Default must be updated first
			PedCur.EmpName=textEmpName.Text;
			PedCur.IsGraphed=checkIsGraphed.Checked;
			PedCur.HasColor=checkHasColor.Checked;
			PedCur.RingGroups=(AsteriskRingGroups)listRingGroup.SelectedIndex;
			PedCur.PhoneExt=PIn.Int(textPhoneExt.Text);
			PedCur.StatusOverride=(PhoneEmpStatusOverride)listStatusOverride.SelectedIndex;
			PedCur.Notes=textNotes.Text;
			PedCur.ComputerName=textComputerName.Text;
			PedCur.IsPrivateScreen=checkIsPrivateScreen.Checked;
			PedCur.IsTriageOperator=checkIsTriageOperator.Checked;
			if(IsNew){
				PhoneEmpDefaults.Insert(PedCur);
				//insert the new Phone record to keep the 2 tables in sync
				Phone phoneNew=new Phone();
				phoneNew.EmployeeName=PedCur.EmpName;
				phoneNew.EmployeeNum=PedCur.EmployeeNum;
				phoneNew.Extension=PedCur.PhoneExt;
				phoneNew.ClockStatus=ClockStatusEnum.Home;
				Phones.Insert(phoneNew);
			}
			else{
				PhoneEmpDefaults.Update(PedCur);
			}
			//It is now safe to update Phone table as it will draw from the newly updated Phone Emp Default row
			if((PhoneEmpStatusOverride)listStatusOverride.SelectedIndex==PhoneEmpStatusOverride.Unavailable &&
				ClockEvents.IsClockedIn(PedCur.EmployeeNum)) {
				//We set ourselves unavailable from this window because we require an explanation.
				//This is the only status that will synch with the phone table, all others should be handled by the small phone panel.
				Phones.SetPhoneStatus(ClockStatusEnum.Unavailable,PedCur.PhoneExt,PedCur.EmployeeNum);
			}
			if(extensionChange) {
				//Phone extension has changed so update the phone table as well. 
				//We have already guaranteed that this employee is Clocked Out (above) so set to home and update phone table.
				Phones.SetPhoneStatus(ClockStatusEnum.Home,PedCur.PhoneExt,PedCur.EmployeeNum);			
			}
			DialogResult=DialogResult.OK;
		}
Esempio n. 12
0
		///<summary>Set phone and triage flag to display. Get/Set accessor won't work here because we require 2 seperate fields in order to update the control properly.</summary>
		public void SetPhone(Phone phone,PhoneEmpDefault phoneEmpDefault,bool isTriageOperator) {
			phoneCur=phone;
			if(phoneCur==null) { //empty out everything and return
				this.Visible=false;
				pictureWebCam.Image=null;//or just make it not visible?
				pictureInUse.Visible=false;
				labelExtensionName.Text="";
				labelStatusAndNote.Text="";
				labelTime.Text="";
				labelTime.BackColor=this.BackColor;
				labelCustomer.Text="";
				return;
			}
			this.Visible=true;
			if(ShowImageForced) {
				pictureWebCam.Image=PIn.Bitmap(phoneCur.WebCamImage);
				pictureWebCam.Visible=true;
			}
			else if(phoneCur.ClockStatus==ClockStatusEnum.Home
				|| phoneCur.ClockStatus==ClockStatusEnum.None
				|| phoneCur.ClockStatus==ClockStatusEnum.Off) 
			{
				pictureWebCam.Image=null;
				pictureWebCam.Visible=false;
			}
			else if(phoneCur.ClockStatus==ClockStatusEnum.Break
						|| phoneCur.ClockStatus==ClockStatusEnum.Lunch) {
				pictureWebCam.Visible=true;
				Bitmap bmp=new Bitmap(pictureWebCam.Width,pictureWebCam.Height);
				Graphics g=Graphics.FromImage(bmp);
				try {
					g.FillRectangle(SystemBrushes.Control,0,0,bmp.Width,bmp.Height);
					string strStat=phoneCur.ClockStatus.ToString();
					SizeF sizef=g.MeasureString(strStat,labelStatusAndNote.Font);
					g.DrawString(strStat,labelStatusAndNote.Font,SystemBrushes.GrayText,(bmp.Width-sizef.Width)/2,(bmp.Height-sizef.Height)/2);
					pictureWebCam.Image=(Image)bmp.Clone();
				}
				finally {
					g.Dispose();
					g=null;
					bmp.Dispose();
					bmp=null;
				}
			}
			else {
				pictureWebCam.Visible=true;
				pictureWebCam.Image=PIn.Bitmap(phoneCur.WebCamImage);
			}
			if(phoneCur.Description=="") {
				pictureInUse.Visible=false;
			}
			else {
				pictureInUse.Visible=true;
			}
			labelExtensionName.Text="";
			string str=phoneCur.ClockStatus.ToString();
			//Check if the user is logged in.
			if(phoneCur.ClockStatus==ClockStatusEnum.None
				|| phoneCur.ClockStatus==ClockStatusEnum.Home) 
			{
				str="Clock In";
			}
			//Always show ext and name, no matter if user is clocked in or not. This keeps phone tiles from appearing blank with no extension and name.
			string nameStr="Vacant";
			if(phoneCur.EmployeeName!="") {
				nameStr=phoneCur.EmployeeName;
			}
			labelExtensionName.Text=phoneCur.Extension.ToString()+" - "+nameStr;
			labelStatusAndNote.Text=str;
			DateTime dateTimeStart=phoneCur.DateTimeStart;
			if(dateTimeStart.Date==DateTime.Today) {
				TimeSpan span=DateTime.Now-dateTimeStart+TimeDelta;
				DateTime timeOfDay=DateTime.Today+span;
				labelTime.Text=timeOfDay.ToString("H:mm:ss");
			}
			else {
				labelTime.Text="";
			}						
			if(phoneCur.ClockStatus==ClockStatusEnum.Home
				|| phoneCur.ClockStatus==ClockStatusEnum.None
				|| phoneCur.ClockStatus==ClockStatusEnum.Break) {
				labelTime.BackColor=this.BackColor;//No color if employee is not currently working.
			}
			else {
				Color outerColor;
				Color innerColor;
				Color fontColor;
				bool isTriageOperatorOnTheClock=false;
				//get the cubicle color and triage status
				Phones.GetPhoneColor(phone,phoneEmpDefault,false,out outerColor,out innerColor,out fontColor,out isTriageOperatorOnTheClock);
				if(!timerFlash.Enabled) { //if the control is already flashing then don't overwrite the colors. this would cause a "spastic" flash effect.
					labelTime.BackColor=outerColor;
				}				
				if(phoneCur.ClockStatus==ClockStatusEnum.NeedsHelp) {
					if(!timerFlash.Enabled) { //Only start the flash timer and color the control once. This prevents over-flashing effect.
						labelTime.Tag=new object[2] { false,labelTime.BackColor };
						timerFlash.Start();
					}
				}
			}
			if(phoneCur.ClockStatus==ClockStatusEnum.Home
				|| phoneCur.ClockStatus==ClockStatusEnum.None) 
			{
				labelTime.BorderStyle=System.Windows.Forms.BorderStyle.None;//Remove color box if employee is not currently working.
			}
			else {
				labelTime.BorderStyle=System.Windows.Forms.BorderStyle.FixedSingle;
			}
			if(phoneCur.ClockStatus!=ClockStatusEnum.NeedsHelp) { //Always assume the flash timer was previously turned on and turn it off here. No harm if it' already off.
				timerFlash.Stop();
			}
			labelCustomer.Text=phoneCur.CustomerNumber;
		}
Esempio n. 13
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(AsteriskRingGroups)).Length;i++){
				listRingGroup.Items.Add(Enum.GetNames(typeof(AsteriskRingGroups))[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;
			textComputerName.Text=PedCur.ComputerName;
			checkIsPrivateScreen.Checked=true;//we no longer capture screen shots.
			checkIsTriageOperator.Checked=PedCur.IsTriageOperator;
			FillGrid();
		}
Esempio n. 14
0
 ///<summary></summary>
 public static void Update(PhoneEmpDefault phoneEmpDefault)
 {
     if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
         Meth.GetVoid(MethodBase.GetCurrentMethod(),phoneEmpDefault);
         return;
     }
     Crud.PhoneEmpDefaultCrud.Update(phoneEmpDefault);
 }
		///<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,bool isTriageOperator) {
			phoneTile.SetPhone(phone,phoneEmpDefault,isTriageOperator);
		}
Esempio n. 16
0
        ///<summary>Checks the phone.ClockStatus to determine if screenshot should be saved.  Returns extension if true and zero if false.</summary>
        public static int IsOnClock(string ipAddress, string computerName)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetInt(MethodBase.GetCurrentMethod(), ipAddress, computerName));
            }
            string          command = "SELECT * FROM phoneempdefault WHERE ComputerName='" + POut.String(computerName) + "'";
            PhoneEmpDefault ped     = Crud.PhoneEmpDefaultCrud.SelectOne(command);

            if (ped != null)           //we found that computername entered as an override
            {
                if (ped.IsPrivateScreen)
                {
                    Phones.SetScreenshot(ped.PhoneExt, "", null);
                    return(0);
                }
                command = "SELECT ClockStatus FROM phone "
                          + "WHERE Extension = " + POut.Long(ped.PhoneExt);
                try {
                    ClockStatusEnum status = (ClockStatusEnum)Enum.Parse(typeof(ClockStatusEnum), PIn.String(Db.GetScalar(command)));
                    if (status == ClockStatusEnum.Available ||
                        status == ClockStatusEnum.Backup ||
                        status == ClockStatusEnum.OfflineAssist ||
                        status == ClockStatusEnum.TeamAssist ||
                        status == ClockStatusEnum.Training ||
                        status == ClockStatusEnum.WrapUp)
                    {
                        return(ped.PhoneExt);
                    }
                }
                catch {
                    return(0);
                }
                return(0);               //on break or clocked out
            }
            //there is no computername override entered by staff, so figure out what the extension should be
            int extension = 0;

            if (ipAddress.Contains("192.168.0.2"))
            {
                extension = PIn.Int(ipAddress.ToString().Substring(10)) - 100;            //eg 205-100=105
            }
            else if (ipAddress.ToString().Contains("10.10.20.1"))
            {
                extension = PIn.Int(ipAddress.ToString().Substring(9));              //eg 105
            }
            if (extension == 0)
            {
                //we don't have a good extension
                return(0);
            }
            //make sure the extension isn't overridden with a computername
            //Example: this is computer .204, and ext 104 has a computername override. This computer should not save screenshot on behalf of 104.
            //command="SELECT COUNT(*) FROM phoneempdefault WHERE PhoneExt= "+POut.Long(extension)+" "
            //  +"AND ComputerName!=''";//there exists a computername override for the extension
            //if(Db.GetScalar(command)!="0") {
            //  return 0;
            //}
            command = "SELECT * FROM phoneempdefault WHERE PhoneExt= " + POut.Long(extension);
            ped     = Crud.PhoneEmpDefaultCrud.SelectOne(command);
            if (ped != null && ped.IsPrivateScreen)
            {
                Phones.SetScreenshot(ped.PhoneExt, "", null);
                return(0);
            }
            command = "SELECT ClockStatus FROM phone "
                      + "WHERE Extension = " + POut.Long(extension);
            try {
                ClockStatusEnum status2 = (ClockStatusEnum)Enum.Parse(typeof(ClockStatusEnum), PIn.String(Db.GetScalar(command)));
                if (status2 == ClockStatusEnum.Available ||
                    status2 == ClockStatusEnum.Backup ||
                    status2 == ClockStatusEnum.OfflineAssist ||
                    status2 == ClockStatusEnum.TeamAssist ||
                    status2 == ClockStatusEnum.Training ||
                    status2 == ClockStatusEnum.WrapUp)
                {
                    return(extension);
                }
            }
            catch {
                return(0);
            }
            return(0);           //on break or clocked out
        }
Esempio n. 17
0
        ///<summary>Consider all scenarios for a employee/phone/cubicle and return color and triage information</summary>
        public static void GetPhoneColor(Phone phone, PhoneEmpDefault phoneEmpDefault, bool forDualColorScheme, out Color outerColor, out Color innerColor, out Color fontColor, out bool isTriageOperatorOnTheClock)
        {
            PhoneColorScheme colorScheme = new PhoneColorScheme(forDualColorScheme);

            isTriageOperatorOnTheClock = false;
            //first set the font color
            if (phone == null ||
                phoneEmpDefault == null ||
                phone.ClockStatus == ClockStatusEnum.Home ||
                phone.ClockStatus == ClockStatusEnum.None ||
                phone.ClockStatus == ClockStatusEnum.Off)
            {
                fontColor = colorScheme.ColorFontAway;
            }
            else
            {
                fontColor = colorScheme.ColorFontHere;
            }
            if (phoneEmpDefault == null || (!forDualColorScheme && !phoneEmpDefault.HasColor))           //smaller color boxes need special colors
            {
                innerColor = Color.Black;
                outerColor = Color.White;
                return;
            }
            //now cover all scenarios and set the inner and out color
            if (phone.ClockStatus == ClockStatusEnum.Home ||
                phone.ClockStatus == ClockStatusEnum.None ||
                phone.ClockStatus == ClockStatusEnum.Off)
            {
                //No color if employee is not currently working. Trumps all.
                outerColor = colorScheme.ColorOuterHome;
                innerColor = colorScheme.ColorInnerHome;
                return;
            }
            if (phone.ClockStatus == ClockStatusEnum.NeedsHelp)            //get this person help now!
            {
                outerColor = colorScheme.ColorOuterNeedsHelp;
                innerColor = colorScheme.ColorInnerNeedsHelp;
                return;
            }
            if (phone.ClockStatus == ClockStatusEnum.HelpOnTheWay)            //getting this person help now!!!
            {
                outerColor = colorScheme.ColorOuterHelpOnTheWay;
                innerColor = colorScheme.ColorInnerHelpOnTheWay;
                return;
            }
            if (!phoneEmpDefault.HasColor)              //not colored (generally an engineer or admin)
            {
                outerColor = colorScheme.ColorOuterNoColor;
                innerColor = colorScheme.ColorInnerNoColor;
                return;
            }
            if (phone.ClockStatus == ClockStatusEnum.Unavailable)            //Unavailable is very rare and must be approved by management. Make them look like admin/engineer.
            {
                outerColor = colorScheme.ColorOuterUnavailable;
                innerColor = colorScheme.ColorInnerUnavailable;
                return;
            }
            //If we get this far then the person is a tech who is working today.
            if (phoneEmpDefault.IsTriageOperator)
            {
                outerColor = colorScheme.ColorOuterTriage;
                if (phone.ClockStatus == ClockStatusEnum.Break ||
                    phone.ClockStatus == ClockStatusEnum.Lunch)
                {
                    //triage op is working today but currently on break/lunch
                    innerColor = colorScheme.ColorInnerTriageAway;
                    if (!forDualColorScheme)                      //smaller color boxes need special colors
                    {
                        outerColor = colorScheme.ColorInnerTriageAway;
                    }
                }
                else
                {
                    //this is a triage operator who is currently here and on the clock
                    isTriageOperatorOnTheClock = true;
                    innerColor = colorScheme.ColorInnerTriageHere;
                }
                return;
            }
            if (phone.Description != "")            //Description field only has 'in use' when person is on the phone. That is the only time the field is not empty.
            {
                outerColor = colorScheme.ColorOuterOnPhone;
                innerColor = colorScheme.ColorInnerOnPhone;
                return;
            }
            //We get this far so we are dealing with a tech who is not on a phone call. Handle each state.
            switch (phone.ClockStatus)
            {
            case ClockStatusEnum.Lunch:
            case ClockStatusEnum.Break:
                outerColor = colorScheme.ColorOuterLunchBreak;
                innerColor = colorScheme.ColorInnerLunchBreak;
                return;

            case ClockStatusEnum.Available:
                outerColor = colorScheme.ColorOuterAvailable;
                innerColor = colorScheme.ColorInnerAvailable;
                return;

            case ClockStatusEnum.WrapUp:
            case ClockStatusEnum.Training:
                outerColor = colorScheme.ColorOuterTrainingWrap;
                innerColor = colorScheme.ColorInnerTrainingWrap;
                return;

            case ClockStatusEnum.TeamAssist:
            case ClockStatusEnum.OfflineAssist:
            case ClockStatusEnum.TCResponder:
                outerColor = colorScheme.ColorOuterAssist;
                innerColor = colorScheme.ColorInnerAssist;
                return;

            case ClockStatusEnum.Backup:
                outerColor = colorScheme.ColorOuterBackup;
                innerColor = colorScheme.ColorInnerBackup;
                return;

            default:
                break;
            }
            throw new Exception("FormMapHQ.GetPhoneColor has a state that is currently unsupported!");
        }