예제 #1
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());
            }
        }
예제 #2
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);
        }
예제 #3
0
파일: Phones.cs 프로젝트: nampn/ODental
 ///<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);
 }
예제 #4
0
파일: FormMapHQ.cs 프로젝트: mnisl/OD
		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();
			}
		}
예제 #5
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);
        }
예제 #6
0
 private ClockStatus(ClockStatusEnum @enum)
 {
     Id   = (int)@enum;
     Name = @enum.ToString();
 }