public static string UpLoadActivity(byte[] data, string ATEKIND, string MATERIALHANDLE, string PROCESS, string sLogonUserId, string FileName = "") { try { FileName = (FileName == "") ? (ATEKIND + ".xml") : FileName; string str = CommSecurity.GetMD5HashFromByte(data); SqlConnection connection = new SqlConnection(CommSecurity.GetConnectionString()); connection.Open(); SqlCommand cmd = new SqlCommand("UPLOADATESTATUS", connection); cmd.CommandType = CommandType.StoredProcedure; CommSecurity.SetCommandParam(ref cmd, SqlDbType.VarChar, "ATEKIND", ATEKIND); CommSecurity.SetCommandParam(ref cmd, SqlDbType.VarChar, "MATERIALHANDLE", MATERIALHANDLE); CommSecurity.SetCommandParam(ref cmd, SqlDbType.VarChar, "PROCESS", PROCESS); CommSecurity.SetCommandParam(ref cmd, SqlDbType.VarChar, "FILENAME", FileName); CommSecurity.SetCommandParam(ref cmd, SqlDbType.VarChar, "FileTimeTag", str); CommSecurity.SetCommandParam(ref cmd, SqlDbType.Image, "FILES", data); CommSecurity.SetCommandParam(ref cmd, SqlDbType.VarChar, "UpdateUser", sLogonUserId); //新加的 cmd.Parameters.Add("@TRES", SqlDbType.VarChar, 100); cmd.Parameters["@TRES"].Direction = ParameterDirection.Output; //要设置长度 cmd.ExecuteNonQuery(); connection.Close(); string result = Convert.ToString(cmd.Parameters["@TRES"].Value); return(result); } catch (Exception exception) { throw exception; } }
/// <summary> /// Save the State File /// </summary> /// <param name="ManualConnectionList"></param> /// <returns></returns> public static string SaveStateModel(byte[] bytes, string id) { string result = ""; //byte[] data = Encoding.Unicode.GetBytes(JasonStr); string strMD5 = CommSecurity.GetMD5HashFromByte(bytes); result = DB.ExecProc("UPDATE_SYS_TEST_PLAN", new DBParameters(System.Data.SqlDbType.NChar, "@Action", "UPDATE"), new DBParameters(System.Data.SqlDbType.NVarChar, "@FileID", id), new DBParameters(System.Data.SqlDbType.NVarChar, "@SYS_USER_ID", DataUtils.StaticInfo.LoginUser), new DBParameters(System.Data.SqlDbType.NVarChar, "@FileDisp", strMD5), new DBParameters(System.Data.SqlDbType.Image, "@StateData", bytes) ); return(result); }
public static string UpdateFileDB(byte[] data, string FileID) { string FileDisp = CommSecurity.GetMD5HashFromByte(data); SqlParameter[] par = { new SqlParameter("@TestFile", data) }; string JarContent = Convert.ToBase64String(data); string sql = @"update ATE_Test_FILE set SYS_USER_ID='{0}', FileDisp='{1}', StateData= @TestFile, UpdateTime='{2}' where FileID='{3}'"; string sqlStr = string.Format(sql, DataUtils.StaticInfo.LoginUser, FileDisp, DateTime.Now, FileID); return(ConnectDB(sqlStr, par)); }