public static FunctionResult UpdateSettings(VideoPlayerSettings settings, UserInfo userInfo, string database, string table, string connectionString) { #region Preparation SystemConfiguration systemConfiguration = HelperClass.SystemConfigurationLoader(); FunctionResult result = new FunctionResult(); #endregion Preparation #region SQL statement string SQLCommand = string.Empty; SQLCommand = "USE " + database + ";"; SQLCommand += "UPDATE " + table + " SET "; SQLCommand += "VideoHeight=" + (int)settings.resolution + ", "; SQLCommand += "FrameRate=" + (int)settings.frameRate + ", "; SQLCommand += "BufferMode=" + (int)settings.bufferMode + ", "; SQLCommand += "PreloadFrames=" + (int)settings.preloadFrames + " WHERE "; SQLCommand += "UserID=" + userInfo.UserID + ";"; #endregion SQL statement if (!Peralatan.UbahDataDatabase(SQLCommand, systemConfiguration.DatabaseProcessingConfiguration.DatabaseConectionString)) { result.functionResult = Result.Fail; result.functionErrroInformation.errorMessage = Peralatan.PesanKesalahan; } else { result.functionResult = Result.Success; } return(result); }
/// <summary> /// Update specific column of a table /// </summary> /// <param name="database">Database of the item</param> /// <param name="table">Table of the item</param> /// <param name="target">Column (Key) and value (value) of target</param> /// <param name="reference">(Column (Key) and value (value) used as reference</param> /// <param name="connectionString">Connection string to connect to database</param> /// <returns>Bool</returns> public static bool UpdateSettings(string database, string table, string targetColumn, string targetValue, string referenceColumn, string referenceValue, string connectionString) { string SQLCommand = string.Empty; SQLCommand = "USE " + database + ";"; SQLCommand += "UPDATE " + table + " SET " + targetColumn + "=" + targetValue + " WHERE " + referenceColumn + "=" + referenceValue + ";"; return(Peralatan.UbahDataDatabase(SQLCommand, connectionString)); }
public static Result WriteVideoActualEndFrame(UserInformation userInfo, ProcessedVideoInformation processedVideoInfo, string processID) { #region Preparation Result result = new Result(); string sourceFileName = Path.GetFileNameWithoutExtension(processedVideoInfo.source.Replace("\"", string.Empty)); string targetFolderName = processedVideoInfo.target.Replace("\"", string.Empty); #endregion Preapration #region Path recreation //if (processedVideoInfo.target.EndsWith("\\")) //{ // targetFolderName += processedVideoInfo.target.Replace("\"", string.Empty) + sourceFileName; //} //else //{ // targetFolderName += processedVideoInfo.target.Replace("\"", string.Empty) + "\\" + sourceFileName; //} #endregion Path recreation int totalFile = Directory.GetFiles(targetFolderName, "*.jpg").Length; #region Updater string SQLCommand = "USE MediaPlayerDatabase;"; SQLCommand += "UPDATE ProcessedVideoInfo SET VideoActualEndFrame=" + totalFile.ToString() + " WHERE ProcessID=" + processID + ";"; if (Peralatan.UbahDataDatabase(SQLCommand, ConfigurationManager.AppSettings["DatabaseConnectionString"])) { result.result = FunctionStatus.Success; } else { result.result = FunctionStatus.Fail; result.HasError = true; result.ErrorMessage = Peralatan.PesanKesalahan; } #endregion Updater return(result); }
public static Result VideoStatusUpdater(UserInformation userInfo, ProcessedVideoInformation videoInfo, string processID, VideoProcessStatus status) { Result result = new Result(); string connectionString = ConfigurationManager.AppSettings["DatabaseConnectionString"]; byte[] videoSourceInBytes = Encoding.UTF8.GetBytes(videoInfo.source); string SQLCommand = "USE MediaPlayerDatabase;"; SQLCommand += "UPDATE ProcessedVideoInfo SET VideoStatus=" + ((int)status).ToString(); SQLCommand += " WHERE UserID=" + userInfo.UserID + " AND ProcessID= " + processID + ";"; if (Peralatan.UbahDataDatabase(SQLCommand, connectionString)) { result.result = FunctionStatus.Success; } else { result.result = FunctionStatus.Fail; result.ErrorMessage = Peralatan.PesanKesalahan; } return(result); }