///<summary>Sets the current phone's employee and extension as "available" and then sets the phone status to the clock status passed in.
        ///Returns false if the user currently clocked in does not have permission or the credentials to do the desired action.
        ///Also, calls FillEmps() if action was successfully taken.</summary>
        private bool SetPhoneAvailable(ClockStatusEnum clockStatus)
        {
            if (!ClockIn())
            {
                return(false);
            }
            int  extension   = PhoneList[rowI].Extension;
            long employeeNum = PhoneList[rowI].EmployeeNum;

            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            Phones.SetPhoneStatus(clockStatus, extension);
            FillEmps();
            return(true);
        }
Esempio n. 2
0
        ///<summary></summary>
        public static Color GetColorBar(ClockStatusEnum clockStatus, long empNum, bool isInUse, bool isDefaultNoColor)
        {
            //No need to check RemotingRole; no call to db.
            Color colorBar = Color.White;

            if (empNum == 0)
            {
                //no colors
            }
            else if (isDefaultNoColor)
            {
                //no colors
            }
            else if (isInUse)
            {
                colorBar = ColorRed;
            }
            //the rest are for idle:
            else if (clockStatus == ClockStatusEnum.Available)
            {
                colorBar = ColorGreen;
            }
            else if (clockStatus == ClockStatusEnum.Unavailable)
            {
                //no color
            }
            else if (clockStatus == ClockStatusEnum.Off)
            {
                //colorText=Color.Gray;
                //no colorBar
            }
            else if (clockStatus == ClockStatusEnum.Break)
            {
                //no color
            }
            else if (clockStatus == ClockStatusEnum.Training ||
                     clockStatus == ClockStatusEnum.TeamAssist ||
                     clockStatus == ClockStatusEnum.WrapUp ||
                     clockStatus == ClockStatusEnum.OfflineAssist)
            {
                colorBar = ColorYellow;
            }
            else if (clockStatus == ClockStatusEnum.Backup)
            {
                colorBar = ColorPaleGreen;
            }
            return(colorBar);
        }
Esempio n. 3
0
        public static string ConvertClockStatusToString(ClockStatusEnum status)
        {
            switch (status)
            {
            case ClockStatusEnum.Lunch:
                return("Lunch");

            case ClockStatusEnum.Break:
                return("Break");

            case ClockStatusEnum.Available:
                return("Avail");

            case ClockStatusEnum.WrapUp:
                return("WrapU");

            case ClockStatusEnum.Training:
                return("Train");

            case ClockStatusEnum.TeamAssist:
                return("TmAst");

            case ClockStatusEnum.OfflineAssist:
                return("OffAst");

            case ClockStatusEnum.Backup:
                return("BackU");

            case ClockStatusEnum.Unavailable:
                return("UnAv");

            case ClockStatusEnum.NeedsHelp:
                return("Help");

            case ClockStatusEnum.HelpOnTheWay:
                return("OnWay");

            case ClockStatusEnum.TCResponder:
                return("Resp");

            case ClockStatusEnum.Off:
            case ClockStatusEnum.None:
            case ClockStatusEnum.Home:
            default:
                return(status.ToString());
            }
        }
Esempio n. 4
0
        ///<summary>this code is similar to code in the phone tracking server.  But here, we frequently only change clockStatus and ColorBar by setting employeeNum=-1.  If employeeNum is not -1, then EmployeeName also gets set.  If employeeNum==0, then clears employee from that row.</summary>
        public static void SetPhoneStatus(ClockStatusEnum clockStatus, int extens, long employeeNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), clockStatus, extens, employeeNum);
                return;
            }
            string command = @"SELECT phoneempdefault.EmployeeNum,Description,phoneempdefault.EmpName, "
                             + "NoColor "
                             + "FROM phone "
                             + "LEFT JOIN phoneempdefault ON phone.Extension=phoneempdefault.PhoneExt "
                             + "WHERE phone.Extension=" + POut.Long(extens);
            DataTable tablePhone = Db.GetTable(command);

            if (tablePhone.Rows.Count == 0)
            {
                return;
            }
            long   empNum  = PIn.Long(tablePhone.Rows[0]["EmployeeNum"].ToString());
            string empName = PIn.String(tablePhone.Rows[0]["EmpName"].ToString());
            //if these values are null because of missing phoneempdefault row, they will default to false
            //PhoneEmpStatusOverride statusOverride=(PhoneEmpStatusOverride)PIn.Int(tablePhone.Rows[0]["StatusOverride"].ToString());
            bool isDefaultNoColor = PIn.Bool(tablePhone.Rows[0]["NoColor"].ToString());
            bool isInUse          = false;

            if (tablePhone.Rows[0]["Description"].ToString() == "In use")
            {
                isInUse = true;
            }
            Color  colorBar       = GetColorBar(clockStatus, empNum, isInUse, isDefaultNoColor);
            string clockStatusStr = clockStatus.ToString();

            if (clockStatus == ClockStatusEnum.None)
            {
                clockStatusStr = "";
            }
            command = "UPDATE phone SET ClockStatus='" + POut.String(clockStatusStr) + "', "
                      + "ColorBar=" + colorBar.ToArgb().ToString() + ", "
                      + "EmployeeNum=" + POut.Long(empNum) + ", "
                      + "EmployeeName='" + POut.String(empName) + "' "
                      + "WHERE Extension=" + extens;
            Db.NonQ(command);
        }
Esempio n. 5
0
 ///<summary>Verify...
 ///1) Security.CurUser is clocked in.
 ///2) Target status change employee is clocked in.
 ///3) Secruity.CurUser has TimecardsEditAll permission.</summary>
 private static bool ChangeTileStatus(Phone phoneCur, ClockStatusEnum newClockStatus)
 {
     if (!ClockEvents.IsClockedIn(Security.CurUser.EmployeeNum))              //Employee performing the action must be clocked in.
     {
         MsgBox.Show(langThis, "You must clock in before completing this action.");
         return(false);
     }
     if (!ClockEvents.IsClockedIn(phoneCur.EmployeeNum))              //Employee having action performed must be clocked in.
     {
         MessageBox.Show(Lan.g(langThis, "Target employee must be clocked in before setting this status:") + " " + phoneCur.EmployeeName);
         return(false);
     }
     if (!CheckUserCanChangeStatus(phoneCur))
     {
         return(false);
     }
     PhoneEmpDefaults.SetAvailable(phoneCur.Extension, phoneCur.EmployeeNum);
     Phones.SetPhoneStatus(newClockStatus, phoneCur.Extension);
     return(true);
 }
Esempio n. 6
0
 ///<summary></summary>
 public static Color GetColorBar(ClockStatusEnum clockStatus,long empNum,bool isInUse,bool isDefaultNoColor)
 {
     //No need to check RemotingRole; no call to db.
     Color colorBar=Color.White;
     if(empNum==0) {
         //no colors
     }
     else if(isDefaultNoColor) {
         //no colors
     }
     else if(isInUse) {
         colorBar=ColorRed;
     }
     //the rest are for idle:
     else if(clockStatus==ClockStatusEnum.Available) {
         colorBar=ColorGreen;
     }
     else if(clockStatus==ClockStatusEnum.Unavailable) {
         //no color
     }
     else if(clockStatus==ClockStatusEnum.Off) {
         //colorText=Color.Gray;
         //no colorBar
     }
     else if(clockStatus==ClockStatusEnum.Break) {
         //no color
     }
     else if(clockStatus==ClockStatusEnum.Training
         || clockStatus==ClockStatusEnum.TeamAssist
         || clockStatus==ClockStatusEnum.WrapUp
         || clockStatus==ClockStatusEnum.OfflineAssist) {
         colorBar=ColorYellow;
     }
     else if(clockStatus==ClockStatusEnum.Backup) {
         colorBar=ColorPaleGreen;
     }
     return colorBar;
 }
Esempio n. 7
0
 ///<summary>this code is similar to code in the phone tracking server.  But here, we frequently only change clockStatus and ColorBar by setting employeeNum=-1.  If employeeNum is not -1, then EmployeeName also gets set.  If employeeNum==0, then clears employee from that row.</summary>
 public static void SetPhoneStatus(ClockStatusEnum clockStatus,int extens,long employeeNum)
 {
     if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
         Meth.GetVoid(MethodBase.GetCurrentMethod(),clockStatus,extens,employeeNum);
         return;
     }
     string command=@"SELECT phoneempdefault.EmployeeNum,Description,phoneempdefault.EmpName, "
         +"NoColor "
         +"FROM phone "
         +"LEFT JOIN phoneempdefault ON phone.Extension=phoneempdefault.PhoneExt "
         +"WHERE phone.Extension="+POut.Long(extens);
     DataTable tablePhone=Db.GetTable(command);
     if(tablePhone.Rows.Count==0) {
         return;
     }
     long empNum=PIn.Long(tablePhone.Rows[0]["EmployeeNum"].ToString());
     string empName=PIn.String(tablePhone.Rows[0]["EmpName"].ToString());
     //if these values are null because of missing phoneempdefault row, they will default to false
     //PhoneEmpStatusOverride statusOverride=(PhoneEmpStatusOverride)PIn.Int(tablePhone.Rows[0]["StatusOverride"].ToString());
     bool isDefaultNoColor=PIn.Bool(tablePhone.Rows[0]["NoColor"].ToString());
     bool isInUse=false;
     if(tablePhone.Rows[0]["Description"].ToString()=="In use") {
         isInUse=true;
     }
     Color colorBar=GetColorBar(clockStatus,empNum,isInUse,isDefaultNoColor);
     string clockStatusStr=clockStatus.ToString();
     if(clockStatus==ClockStatusEnum.None) {
         clockStatusStr="";
     }
     command="UPDATE phone SET ClockStatus='"+POut.String(clockStatusStr)+"', "
         +"ColorBar="+colorBar.ToArgb().ToString()+", "
         +"EmployeeNum="+POut.Long(empNum)+", "
         +"EmployeeName='"+POut.String(empName)+"' "
         +"WHERE Extension="+extens;
     Db.NonQ(command);
 }
Esempio n. 8
0
 ///<summary>this code is similar to code in the phone tracking server.  But here, we frequently only change clockStatus and ColorBar by setting employeeNum=-1.  If employeeNum is not -1, then EmployeeName also gets set.</summary>
 public static void SetPhoneStatus(ClockStatusEnum clockStatus,int extens)
 {
     //No need to check RemotingRole; no call to db.
     SetPhoneStatus(clockStatus,extens,-1);
 }
Esempio n. 9
0
 ///<summary>this code is similar to code in the phone tracking server.  But here, we frequently only change clockStatus and ColorBar by setting employeeNum=-1.  If employeeNum is not -1, then EmployeeName also gets set.</summary>
 public static void SetPhoneStatus(ClockStatusEnum clockStatus, int extens)
 {
     //No need to check RemotingRole; no call to db.
     SetPhoneStatus(clockStatus, extens, -1);
 }
Esempio n. 10
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. 11
0
		private static string ConvertClockStatusToString(ClockStatusEnum status) {
			switch(status) {
				case ClockStatusEnum.Lunch:
					return "Lunch";
				case ClockStatusEnum.Break:
					return "Break";
				case ClockStatusEnum.Available:
					return "Avail";
				case ClockStatusEnum.WrapUp:
					return "WrapU";
				case ClockStatusEnum.Training:
					return "Train";
				case ClockStatusEnum.TeamAssist:
					return "TmAst";
				case ClockStatusEnum.OfflineAssist:
					return "OffAst";
				case ClockStatusEnum.Backup:
					return "BackU";
				case ClockStatusEnum.Unavailable:
					return "UnAv";
				case ClockStatusEnum.NeedsHelp:
					return "Help";
				case ClockStatusEnum.Off:
				case ClockStatusEnum.None:
				case ClockStatusEnum.Home:
				default:
					return status.ToString();
			}
		}
Esempio n. 12
0
        ///<summary>this code is similar to code in the phone tracking server.  But here, we frequently only change clockStatus and ColorBar by setting employeeNum=-1.  If employeeNum is not -1, then EmployeeName also gets set.  If employeeNum==0, then clears employee from that row.</summary>
        public static void SetPhoneStatus(ClockStatusEnum clockStatus, int extens, long employeeNum = -1)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), clockStatus, extens, employeeNum);
                return;
            }
            string command = @"SELECT phoneempdefault.EmployeeNum,phoneempdefault.IsTriageOperator,Description,phoneempdefault.EmpName,HasColor,phone.ClockStatus "
                             + "FROM phone "
                             + "LEFT JOIN phoneempdefault ON phone.Extension=phoneempdefault.PhoneExt "
                             + "WHERE phone.Extension=" + POut.Long(extens);
            DataTable tablePhone = Db.GetTable(command);

            if (tablePhone.Rows.Count == 0)
            {
                //It would be nice if we could create a phone row for this extension.
                return;
            }
            long     empNum           = PIn.Long(tablePhone.Rows[0]["EmployeeNum"].ToString());
            bool     isTriageOperator = PIn.Bool(tablePhone.Rows[0]["IsTriageOperator"].ToString());
            string   empName          = PIn.String(tablePhone.Rows[0]["EmpName"].ToString());
            string   clockStatusDb    = PIn.String(tablePhone.Rows[0]["ClockStatus"].ToString());
            Employee emp = Employees.GetEmp(employeeNum);

            if (emp != null)           //A new employee is going to take over this extension.
            {
                empName = emp.FName;
                empNum  = emp.EmployeeNum;
            }
            else if (employeeNum == 0)           //Clear the employee from that row.
            {
                empName = "";
                empNum  = 0;
            }
            //if these values are null because of missing phoneempdefault row, they will default to false
            //PhoneEmpStatusOverride statusOverride=(PhoneEmpStatusOverride)PIn.Int(tablePhone.Rows[0]["StatusOverride"].ToString());
            bool hasColor = PIn.Bool(tablePhone.Rows[0]["HasColor"].ToString());

            #region DateTimeStart
            //When a user shows up as a color on the phone panel, we want a timer to be constantly going to show how long they've been off the phone.
            string dateTimeStart = "";
            //It's possible that a new user has never clocked in before, therefore their clockStatus will be empty.  Simply set it to the status that they are trying to go to.
            if (clockStatusDb == "")
            {
                clockStatusDb = clockStatus.ToString();
            }
            if (clockStatus == ClockStatusEnum.Break ||
                clockStatus == ClockStatusEnum.Lunch)
            {
                //The user is going on Lunch or Break.  Start the DateTimeStart counter so we know how long they have been gone.
                dateTimeStart = "DateTimeStart=NOW(), ";
            }
            else if (clockStatus == ClockStatusEnum.Home)
            {
                //User is going Home.  Always clear the DateTimeStart column no matter what.
                dateTimeStart = "DateTimeStart='0001-01-01', ";
            }
            else              //User shows as a color on big phones and is not going to a status of Home, Lunch, or Break.  Example: Available, Training etc.
                              //Get the current clock status from the database.
            {
                ClockStatusEnum clockStatusCur = (ClockStatusEnum)Enum.Parse(typeof(ClockStatusEnum), clockStatusDb);
                //Start the clock if the user is going from a break status to any other non-break status.
                if (clockStatusCur == ClockStatusEnum.Home ||
                    clockStatusCur == ClockStatusEnum.Lunch ||
                    clockStatusCur == ClockStatusEnum.Break)
                {
                    //The user is clocking in from home, lunch, or break.  Start the timer up.
                    if (hasColor)                     //Only start up the timer when someone with color clocks in.
                    {
                        dateTimeStart = "DateTimeStart=NOW(), ";
                    }
                    else                       //Someone with no color then reset the timer. They are back from break, that's all we need to know.
                    {
                        dateTimeStart = "DateTimeStart='0001-01-01', ";
                    }
                }
            }
            string dateTimeNeedsHelpStart;
            if (clockStatus == ClockStatusEnum.NeedsHelp)
            {
                dateTimeNeedsHelpStart = "DateTimeNeedsHelpStart=NOW(), ";
            }
            else
            {
                dateTimeNeedsHelpStart = "DateTimeNeedsHelpStart=" + POut.DateT(DateTime.MinValue) + ", ";
            }
            #endregion
            //Update the phone row to reflect the new clock status of the user.
            string clockStatusNew = clockStatus.ToString();
            if (clockStatus == ClockStatusEnum.None)
            {
                clockStatusNew = "";
            }
            if (clockStatus == ClockStatusEnum.HelpOnTheWay && clockStatusDb == ClockStatusEnum.HelpOnTheWay.ToString())           //If HelpOnTheWay already
            {
                clockStatusNew = ClockStatusEnum.Available.ToString();
            }
            command = "UPDATE phone SET ClockStatus='" + POut.String(clockStatusNew) + "', "
                      + dateTimeStart
                      + dateTimeNeedsHelpStart
                      //+"ColorBar=-1, " //ColorBar is now determined at runtime by OD using Phones.GetPhoneColor.
                      + "EmployeeNum=" + POut.Long(empNum) + ", "
                      + "EmployeeName='" + POut.String(empName) + "' "
                      + "WHERE Extension=" + extens;
            Db.NonQ(command);
            //Zero out any duplicate phone table rows for this employee.
            //This is possible if a user logged off and another employee logs into their computer. This would cause duplicate entries in the big phones window.
            UpdatePhoneToEmpty(employeeNum, extens);
        }
Esempio n. 13
0
		///<summary>Verify... 1) Security.CurUser is clocked in. 2) Target status change employee is clocked in. 3) Secruity.CurUser has TimecardsEditAll permission.</summary>
		private static bool ChangeTileStatus(PhoneTile tile,ClockStatusEnum newClockStatus) {
			if(!ClockEvents.IsClockedIn(Security.CurUser.EmployeeNum)) { //Employee performing the action must be clocked in.
				MsgBox.Show(langThis,"You must clock in before completing this action.");
				return false;
			}
			if(!ClockEvents.IsClockedIn(tile.PhoneCur.EmployeeNum)) { //Employee having action performed must be clocked in.
				MessageBox.Show(Lan.g(langThis,"Target employee must be clocked in before setting this status: ")+tile.PhoneCur.EmployeeName);
				return false;
			}
			if(!CheckUserCanChangeStatus(tile)) {
				return false;
			}
			PhoneEmpDefaults.SetAvailable(tile.PhoneCur.Extension,tile.PhoneCur.EmployeeNum);
			PhoneAsterisks.SetToDefaultRingGroups(tile.PhoneCur.Extension,tile.PhoneCur.EmployeeNum);
			Phones.SetPhoneStatus(newClockStatus,tile.PhoneCur.Extension);
			return true;
		}
Esempio n. 14
0
 private ClockStatus(ClockStatusEnum @enum)
 {
     Id   = (int)@enum;
     Name = @enum.ToString();
 }
Esempio n. 15
0
File: PhoneUI.cs Progetto: mnisl/OD
		///<summary>Verify... 1) Security.CurUser is clocked in. 2) Target status change employee is clocked in. 3) Secruity.CurUser has TimecardsEditAll permission.</summary>
		private static bool ChangeTileStatus(PhoneTile tile,ClockStatusEnum newClockStatus) {
			if(!ClockEvents.IsClockedIn(Security.CurUser.EmployeeNum)) { //Employee performing the action must be clocked in.
				MsgBox.Show(langThis,"You must clock in before completing this action.");
				return false;
			}
			if(!ClockEvents.IsClockedIn(tile.PhoneCur.EmployeeNum)) { //Employee having action performed must be clocked in.
				MessageBox.Show(Lan.g(langThis,"Target employee must be clocked in before setting this status: ")+tile.PhoneCur.EmployeeName);
				return false;
			}
			if(!CheckUserCanChangeStatus(tile)) {
				return false;
			}
			PhoneEmpDefaults.SetAvailable(tile.PhoneCur.Extension,tile.PhoneCur.EmployeeNum);
			PhoneEmpDefault pedCur=PhoneEmpDefaults.GetOne(tile.PhoneCur.EmployeeNum);
			//If the employee was set to triage, do not set them to default ring group, set them to triage (backup) ringroup.
			if(pedCur!=null && pedCur.IsTriageOperator) {
				PhoneAsterisks.SetRingGroups(pedCur.PhoneExt,AsteriskRingGroups.Backup);
			}
			else {
				PhoneAsterisks.SetToDefaultRingGroups(tile.PhoneCur.Extension,tile.PhoneCur.EmployeeNum);
			}
			Phones.SetPhoneStatus(newClockStatus,tile.PhoneCur.Extension);
			return true;
		}