示例#1
0
        public static void SetScreenshot(int extension, string path, Bitmap bitmap)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), extension);
                return;
            }
            string command = "UPDATE phone SET "
                             + "ScreenshotPath = '" + POut.String(path) + "', "
                             + "ScreenshotImage   = '" + POut.Bitmap(bitmap, ImageFormat.Png) + "' "//handles null
                             + "WHERE Extension = " + POut.Long(extension);

            Db.NonQ(command);
        }
示例#2
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);
        }