private void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
         }
         if (oDB != null)
         {
             oDB.CloseConnection(true);
             oDB = null;
         }
     }
     disposed = true;
 }
Esempio n. 2
0
        public int UpdateAvatarData(int UserID, string file, string size)
        {
            CSQL oDB = null;

            try
            {
                string cnString = CConfig.stGetConfigValue("DatabaseConnectionString", false);
                oDB = new CSQL(cnString);
                DataRow dt = oDB.GetFirstRow("admGetUserLoginName", CommandType.StoredProcedure,
                                             CSQL.GetArrayListParameters(new object [] { "@id", UserID }));
                if (dt == null)
                {
                    return(-1);
                }
                string lName = dt[0].ToString();
                string mPath = CConfig.stGetConfigValue("AvatarUploadURL", false);
                if (mPath == String.Empty)
                {
                    return(-2);
                }
                mPath += lName;               //+"/"+file;
                int ret = oDB.ExecuteNonQueryWithReturnID("admSaveAvatar", CommandType.StoredProcedure,
                                                          CSQL.GetArrayListParameters(new object [] { "@UserID", UserID, "@Path", mPath, "@File", file, "@Size", size }));
                mPath  = GetDestinationPath("");
                mPath += "\\Avatars";
                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.CreateNoWindow   = true;
                startInfo.UseShellExecute  = false;
                startInfo.WorkingDirectory = mPath;
                startInfo.FileName         = mPath + "\\" + CConfig.stGetConfigValue("FileSecurityBat", false);
                startInfo.Arguments        = string.Format("{0} {1}", mPath, mPath + "\\" + lName);
                bool bRes = WSCommon.RunCommand(ref startInfo, 60000, this);
                return(bRes?ret:-100);
            }
            catch (Exception ex)
            {
                CLog.stLogException(ex);
                return(-100);
            }
            finally
            {
                if (oDB != null)
                {
                    oDB.CloseConnection(true);
                }
            }
        }