///<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 || status == ClockStatusEnum.NeedsHelp) { 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("10.10.1.2")) { extension = PIn.Int(ipAddress.ToString().Substring(8)) - 100; //eg 205-100=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 || status2 == ClockStatusEnum.NeedsHelp) { return(extension); } } catch { return(0); } return(0); //on break or clocked out }