コード例 #1
0
ファイル: OscarProvider.cs プロジェクト: zyj0021/SqlSugar
        public override DbCommand GetCommand(string sql, SugarParameter[] parameters)
        {
            OscarCommand sqlCommand = new OscarCommand(sql, (OscarConnection)this.Connection);

            sqlCommand.CommandType    = this.CommandType;
            sqlCommand.CommandTimeout = this.CommandTimeOut;
            if (this.Transaction != null)
            {
                sqlCommand.Transaction = (OscarTransaction)this.Transaction;
            }
            if (parameters.HasValue())
            {
                IDataParameter[] ipars = ToIDbDataParameter(parameters);
                sqlCommand.Parameters.AddRange((OscarParameter[])ipars);
            }
            CheckConnection();
            return(sqlCommand);
        }
コード例 #2
0
ファイル: Command.cs プロジェクト: Lucyjung/SocketClient
        public static void createBatchFileAndRun(OscarCommand cmd)
        {
            if (cmd.process != "")
            {
                string path = AppDomain.CurrentDomain.BaseDirectory + "\\BatchFiles";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                string batFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\BatchFiles\\" + DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds + "_" + cmd.process + ".bat";
                using (StreamWriter sw = new StreamWriter(batFilePath))
                {
                    sw.WriteLine(Config.targetCmdPath[0].ToString() + Config.targetCmdPath[1].ToString());
                    sw.WriteLine(@"cd " + Config.targetCmdPath);
                    if (cmd.command != null)
                    {
                        sw.Write("START " + Config.targetCmdExe + " " + cmd.command + " ");
                    }
                    else
                    {
                        sw.Write("START " + Config.targetCmdExe + " /run ");
                        sw.Write(cmd.process);
                        sw.Write(" ");

                        if (cmd.parameter != null)
                        {
                            sw.Write(" ");
                            sw.Write("/startp " + cmd.parameter);
                        }
                    }
                    if (cmd.userPass != null)
                    {
                        sw.Write("/user ");
                        sw.Write(cmd.userPass);
                    }
                }
                ExecuteCommand(batFilePath);
            }
        }
コード例 #3
0
 /// <summary>
 /// SqlDataAdapter
 /// </summary>
 /// <param name="command"></param>
 public OscarDataAdapter(OscarCommand command)
 {
     this.command = command;
 }