public void Update(string Address, int Port,int RoomID, bool IsOnSerialPort) { Functions F = new Functions(); Address = F.CheckSqlSafeString(Address); // SqlConnection MC = new SqlConnection(); // F.ShareOpenConnection(ref MC); string sSQL = "UPDATE tblCardReader SET Address = '" + Address.ToUpper() + "'" + ", RoomID = " + RoomID + ", IsOnSerialPort = " + Convert.ToInt32(IsOnSerialPort) + ", Port = " + Port + " WHERE ID = " + mvarID; // SqlCommand cm = new SqlCommand(sSQL,MC); try { int results = F.ExecuteNonQuery(sSQL); } catch(Exception Err) { string peekerror = Err.Message; } }
public void Update(string Description, string DisplayName, int VideoStorageServerID, int StreamingEncoderID,bool IsReady) { Functions F = new Functions(); Description = F.CheckSqlSafeString(Description); DisplayName = F.CheckSqlSafeString(DisplayName); string sSQL = "UPDATE tblRecording SET Name = '" + Description + "'" + ", DisplayName = '" + DisplayName + "'" + ", VideoStorageServerID = " + VideoStorageServerID + ", StreamingEncoderID = " + StreamingEncoderID + ", IsReady = " + Convert.ToInt32(IsReady) + " WHERE ID = " + mvarID; F.ExecuteNonQuery(sSQL); }
public void Update(string Description, int VideoStorageServerID) { Functions F = new Functions(); Description = F.CheckSqlSafeString(Description); string sSQL = "UPDATE tblRoom SET Name = '" + Description + "'" + ", VideoStorageServerID = " + VideoStorageServerID + " WHERE ID = " + mvarID; int results = F.ExecuteNonQuery(sSQL); }
public void Update(string Address, int VideoStorageServerID, int Port) { Functions F = new Functions(); Address = F.CheckSqlSafeString(Address); string sSQL = "UPDATE tblForwardingServer SET Address = '" + Address.ToUpper() + "'" + ", VideoStorageServerID = " + VideoStorageServerID + ", Port = " + Port + " WHERE ID = " + mvarID; int results = F.ExecuteNonQuery(sSQL); }
public void Update(string Address, int ForwardingServerID, string StorageDirectory, int Port) { Functions F = new Functions(); Address = F.CheckSqlSafeString(Address); StorageDirectory = F.CheckSqlSafeString(StorageDirectory); string sSQL = "UPDATE tblMediaBufferServer SET Address = '" + Address.ToUpper() + "'" + ", ForwardingServerID = " + ForwardingServerID + ", StorageDirectory = '" + StorageDirectory + "'" + ", Port = " + Port + " WHERE ID = " + mvarID; int results = F.ExecuteNonQuery(sSQL); }
// public void ReleaseCameras() // { // // if(NeedToRelinqueshControl == true) // { // try // { // NeedToRelinqueshControl = false; // UserTimer.Enabled = false; // //Functions F = new Functions(); // Functions F = new Functions(); // F.ForceEncoderFree(CurrentControlledEncoder); //// if(SC.State == ConnectionState.Closed) //// { //// //// //SC.Open(); //// //// // F.ShareOpenConnection(ref SC); //// //// } // // // // string sSQL = "DELETE FROM tblUserStreamingEncoderRel WHERE StreamingEncoderId = " + CurrentControlledEncoder; // //SqlCommand cm = new SqlCommand(sSQL,SC); // // int numrecs = cm.ExecuteNonQuery(); // // // //SC.Close(); // } // catch(Exception Err) // { // string peekerrror = Err.Message; // } // } // } // public void UserTimer_Tick(object sender, ElapsedEventArgs e) // { // if(ControllingCamera == true) // { // if(SC == null) // { // Functions F = new Functions(); // // F.ShareOpenConnection(ref SC); // // } // string sSQL = "UPDATE tblUserStreamingEncoderRel SET LastUpdatedTime = '" + System.DateTime.Now + // "' WHERE StreamingEncoderId = " + CurrentControlledEncoder + // " AND UserId = " + mvarID; // SqlCommand CM = new SqlCommand(sSQL,SC); // try // { // int numRecs = CM.ExecuteNonQuery(); // if(numRecs == 0) // throw new ApplicationException("ERROR: Failed to update system with new camera control time for SE.ID:" + CurrentControlledEncoder); // } // catch(Exception Err) // { // string peekerror = Err.Message; // throw new ApplicationException("ERROR: Failed to update system with new camera control time for SE.ID:" + CurrentControlledEncoder + " ERROR MESSAGE: " + Err.Message); // } // NeedToRelinqueshControl = true; // } // // } // public bool AquireCameraControl(int StreamingEncoderId) // { // Functions F = new Functions(); // // NeedToRelinqueshControl = false; // StreamingEncoder S = F.GetStreamingEncoder(StreamingEncoderId); // if(S == null) // return false; // if(S.HasControlableCamera == false) // return false; // // F.ShareOpenConnection(ref SC); // // // string sSQL = "SELECT * FROM tblUserStreamingEncoderRel WHERE StreamingEncoderId = " + StreamingEncoderId; // SqlDataAdapter da = new SqlDataAdapter(sSQL,SC); // DataTable dt = new DataTable(); // da.Fill(dt); // try // { // if(dt.Rows.Count > 0) //Then another User has control of it already // { // return false; // } // } // catch(Exception Err) // { // string peekerror = Err.Message; // } // // // //Enforce that this user will only control 1 camera at a time // sSQL = "DELETE FROM tblUserStreamingEncoderRel WHERE UserId = " + mvarID; // SqlCommand CM = new SqlCommand(sSQL,SC); // CM.ExecuteNonQuery(); // // sSQL = "Insert INTO tblUserStreamingEncoderRel(StreamingEncoderId, UserId, LastUpdatedTime) Values(" + // StreamingEncoderId + "," + mvarID + ",'" + System.DateTime.Now + "')"; // CM = new SqlCommand(sSQL,SC); // int numRecs = CM.ExecuteNonQuery(); // if(numRecs == 0) // { // CurrentControlledEncoder = 0; // ControllingCamera = false; // UserTimer.Enabled = false; // return false; // } // else // { // CurrentControlledEncoder = StreamingEncoderId; // UserTimer.Enabled = true; // ControllingCamera = true; // NeedToRelinqueshControl = true; // return true; // // } // } public bool Update(string FirstName, string MiddleName, string LastName, string LoginName, string Password, bool CanRecord, string CardNumber) { Functions F = new Functions(); FirstName = F.CheckSqlSafeString(FirstName); MiddleName = F.CheckSqlSafeString(MiddleName); LastName = F.CheckSqlSafeString(LastName); LoginName = F.CheckSqlSafeString(LoginName); Password = F.CheckSqlSafeString(Password); CardNumber = F.CheckSqlSafeString(CardNumber); string Description = LastName + ", " + FirstName + " " + MiddleName; int SysAdminID = ((Section)F.GetSystemSection()).OwnerID; if(mvarID == SysAdminID) Description = mvarDescription; // string sSQL = "SELECT * FROM tblUser WHERE ID = " + mvarID; // SqlDataAdapter DA = new SqlDataAdapter(sSQL,MC); string sCommand = "UPDATE tblUSER SET Name = '" + Description + "' , FirstName = '" + FirstName + "' , MiddleName = '" + MiddleName + "' , LastName = '" + LastName + "' , LoginName = '" + LoginName + "' , Password = '******' , CanRecord = " + Convert.ToInt32(CanRecord) + " , CardNumber = '" + CardNumber + "' WHERE ID = " + mvarID; int orow = F.ExecuteNonQuery(sCommand); F.Dispose(); if(orow == 0) return false; else return true; }
public void Update(string Description,string ControlAddress, int ControlPort, string StreamingAddress, int StreamPort, bool IsMulticast, bool HasControlableCamera, int MediaBufferServerID, int RoomID, string StreamingHeader) { Functions F = new Functions(); Description = F.CheckSqlSafeString(Description); ControlAddress = F.CheckSqlSafeString(ControlAddress); StreamingAddress = F.CheckSqlSafeString(StreamingAddress); StreamingHeader = F.CheckSqlSafeString(StreamingHeader); string sSQL = "UPDATE tblStreamingEncoder SET Description = '" + Description + "'" + ",ControlAddress = '" + ControlAddress.ToUpper() + "'" + ", ControlPort = " + ControlPort + ", StreamAddress = '" + StreamingAddress.ToUpper() + "'" + ", StreamPort = " + StreamPort + ", IsMulticast = " + Convert.ToInt32(IsMulticast) + ", HasControlableCamera = " + Convert.ToInt32(HasControlableCamera) + ", MediaBufferServerID = " + MediaBufferServerID + ", RoomID = " + RoomID + ", StreamingHeader = '" + StreamingHeader + "'" + " WHERE ID = " + mvarID; int results = F.ExecuteNonQuery(sSQL); }
public void Update(string ControlAddress, int ControlPort, string UploadAddress, bool IsUploadFTP, string StorageDirectory,int VideoStorageServerTypeId) { Functions F = new Functions(); ControlAddress = F.CheckSqlSafeString(ControlAddress); UploadAddress = F.CheckSqlSafeString(UploadAddress); StorageDirectory = F.CheckSqlSafeString(StorageDirectory); string sSQL = "UPDATE tblVideoStorageServer SET ControlAddress = '" + ControlAddress.ToUpper() + "'" + ", ControlPort = " + ControlPort + ", UploadAddress = '" + UploadAddress.ToUpper() + "'" + ", IsUploadFTP = " + Convert.ToInt32(IsUploadFTP) + ", StorageDirectory = '" + StorageDirectory + "'" + ", TypeId = " + VideoStorageServerTypeId + " WHERE ID = " + mvarID; int results = F.ExecuteNonQuery(sSQL); }
public void Update(string SyncTime, string Description) { Functions F = new Functions(); SyncTime = F.CheckSqlSafeString(SyncTime); Description = F.CheckSqlSafeString(Description); F.EditNote(mvarID,SyncTime,Description); F.Dispose(); }