コード例 #1
0
        public IList <EmployeeCategoryDTO> GetEmployeeCategoryDTO()
        {
            //DataTable dt = ADODatabase.GetDataTable("Get_All_Categorys", (int)ADODatabase.SqlType.StoredProcedure);
            DataTable dt = ADODatabase.GetDataTable("SELECT * FROM ListEmployeeCategory");

            return(MakeEmployeeCategoryDTO(dt));
        }
コード例 #2
0
        public EmployeeCategoryDTO GetEmployeeCategoryDTO(int employeeCategoryID)
        {
            SqlParameter[] sqlParameter = { new SqlParameter("@CategoryId", SqlDbType.Int) };
            sqlParameter[0].Value = employeeCategoryID;

            //DataTable dataTable = ADODatabase.GetDataTable("SELECT * FROM ListEmployeeCategory WHERE EmployeeCategoryID = ?", sqlParameter);
            DataTable dataTable = ADODatabase.GetDataTable("SELECT * FROM ListEmployeeCategory WHERE EmployeeCategoryID = " + employeeCategoryID.ToString());

            return(MakeEmployeeCategoryDTO(dataTable.Rows[0]));
        }
コード例 #3
0
        public static DataTable GetDataTable(string commandText, CommandType commandType)
        {
            SqlCommand sqlCommand = new SqlCommand(commandText, ADODatabase.Connection());

            sqlCommand.CommandType = commandType;

            using (SqlDataAdapter adapter = new SqlDataAdapter(sqlCommand))
            {
                DataTable dataTable = new DataTable();
                adapter.Fill(dataTable);
                return(dataTable);
            }
        }
コード例 #4
0
        public static bool CreateFunction(string functionName, string sqlQuery)
        {
            DataTable dataTable = ADODatabase.GetDataTable("SELECT name FROM sysobjects WHERE name = '" + functionName + "' AND (type = 'FN' OR type = 'TF') ");

            if (dataTable.Rows.Count > 0)
            {
                ADODatabase.ExecuteNonQuery("DROP FUNCTION " + functionName);
            }

            ADODatabase.ExecuteNonQuery("CREATE FUNCTION " + functionName + char.ConvertFromUtf32(13) + sqlQuery);

            return(true);
        }
コード例 #5
0
 public static DataTable GetDataTable(string query)
 {
     return(ADODatabase.GetDataTable(query, CommandType.Text));
 }
コード例 #6
0
 public static int ExecuteTransaction(string commandText)
 {
     return(ADODatabase.ExecuteTransaction(commandText, CommandType.Text));
 }
コード例 #7
0
 public static int ExecuteNonQuery(string commandText, string connectionString)
 {
     return(ADODatabase.ExecuteNonQuery(commandText, CommandType.Text, connectionString));
 }
コード例 #8
0
 public static int ExecuteNonQuery(string commandText, CommandType commandType)
 {
     return(ADODatabase.ExecuteNonQuery(commandText, commandType, GlobalMsADO.ConnectionString()));
 }
コード例 #9
0
        //BELOW IS OK STATEMENT ----------------------------------------------

        public static int ExecuteNonQuery(string commandText)
        {
            return(ADODatabase.ExecuteNonQuery(commandText, CommandType.Text));
        }