/// <summary>
        /// It updates install shields for particular affiliate.
        /// </summary>
        public bool CreateSkin(int nScID, int nAffID)
        {
            bool bRes = false;

            try
            {
                //Create Directory
                string           directoryPath = WSCommon.GetAffiliatePath(nScID, false);
                ProcessStartInfo startInfo     = new ProcessStartInfo();
                startInfo.CreateNoWindow   = true;
                startInfo.UseShellExecute  = false;
                startInfo.WorkingDirectory = directoryPath;
                string sDir = WSCommon.GetAffiliatePath(nScID, true);
                startInfo.FileName  = sDir + "\\" + CConfig.stGetConfigValue("FileSkinsBat", false);
                startInfo.Arguments = string.Format("{0} {1}", sDir, nAffID);                  //string.Format("{0} {1} {2}",  sDir, sDir, nAffID);

                //Create InstallShield
                bRes = WSCommon.RunCommand(ref startInfo, m_waitMillisec, this);
            }
            catch (Exception oEx)
            {
                CLog.stLogException(new Exception("CreateSkin:", oEx));
                bRes = false;
            }
            return(bRes);
        }
Exemplo n.º 2
0
        public bool ExecCommand(int execType, int affiliateID, int waitMillisec)
        {
            bool bRes = true;

            try
            {
                if (execType < 0 || execType > 1)
                {
                    CLog.stWriteLog(CLog.LogSeverityLevels.lslError, this, string.Format("Bad execute type: {0}.", execType));
                    return(false);
                }
                if (execType == 0 && affiliateID <= 0)
                {
                    CLog.stWriteLog(CLog.LogSeverityLevels.lslError, this, string.Format("Error Skin's ID: {0}.", affiliateID));
                    return(false);
                }

                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.CreateNoWindow  = true;
                startInfo.UseShellExecute = false;

                if (!SetStartupInfo(execType, affiliateID, ref startInfo) && execType != 1)
                {
                    CLog.stWriteLog(CLog.LogSeverityLevels.lslError, this, string.Format("Error create startup parameters. Execute type: {0}.", execType));
                    return(false);
                }
                switch (execType)
                {
                case 0:
                    bRes = WSCommon.RunCommand(ref startInfo, waitMillisec, this);
                    break;

                case 1:
                    Affiliate aff = new Affiliate(waitMillisec, affiliateID);
                    bRes = aff.UpdateSkin();
                    aff.Dispose();
                    break;

                default:
                    bRes = false;
                    break;
                }
            }
            catch (Exception ex)
            {
                CLog.stLogException(new Exception("ExecCommand:", ex));
                bRes = false;
            }
            return(bRes);
        }
Exemplo n.º 3
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);
                }
            }
        }