Пример #1
0
 public int Insert(OkPneuTire tire)
 {
     SchoolDatabase db = new SchoolDatabase();
     db.Connect();
     SqlCommand command = db.CreateCommand(SQL_INSERT);
     PrepareCommand(command, tire);
     int ret = db.ExecuteNonQuery(command);
     db.Close();
     return ret;
 }
Пример #2
0
 public int Insert(StoredWheels st)
 {
     SchoolDatabase db = new SchoolDatabase();
     db.Connect();
     SqlCommand command = db.CreateCommand(SQL_INSERT);
     PrepareCommand(command, st);
     int ret = db.ExecuteNonQuery(command);
     db.Close();
     return ret;
 }
Пример #3
0
 //public int Delete(int id)
 //{
 //    Database db = new Database(connectionString);
 //    db.Connect();
 //    SqlCommand command = db.CreateCommand(SQL_DELETE);
 //    command.Parameters.Add(new SqlParameter("@p_id", SqlDbType.Int));
 //    command.Parameters["@p_id"].Value = id;
 //    int ret = db.ExecuteNonQuery(command);
 //    db.Close();
 //    return ret;
 //}
 public int Insert(Customer cust)
 {
     if (!FindCustomerByEmail(cust.email))
     {
         SchoolDatabase db = new SchoolDatabase();
         db.Connect();
         SqlCommand command = db.CreateCommand(SQL_INSERT);
         PrepareCommand(command, cust);
         int ret = db.ExecuteNonQuery(command);
         db.Close();
         return ret;
     }
     else return -2;
 }
Пример #4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (DoUpdate)
            {
                strBuilCommand.Append(" where @p_id = id");

                SchoolDatabase db = new SchoolDatabase();
                db.Connect();
                string tmp = strBuilCommand.ToString();
                SqlCommand command = db.CreateCommand(tmp);
                PrepareCommand(command, emp);
                int ret = db.ExecuteNonQuery(command);
                db.Close();
            }
            Response.Redirect("~/Employees/ListEmployee.aspx");
        }
Пример #5
0
        public int Exit(Contract con)
        {
            SchoolDatabase db = new SchoolDatabase();
            db.Connect();
            SqlCommand command = db.CreateCommand(SQL_EXIT);

            command.Parameters.Add(new SqlParameter("@p_GarageNumber", SqlDbType.SmallInt));
            command.Parameters["@p_GarageNumber"].Value = con.GarageNumber;
            command.Parameters.Add(new SqlParameter("@p_Payment", SqlDbType.SmallInt));
            command.Parameters["@p_Payment"].Value = con.Payment;
            command.Parameters.Add(new SqlParameter("@p_VAT", SqlDbType.Bit));
            command.Parameters["@p_VAT"].Value = con.VAT;

            int ret = db.ExecuteNonQuery(command);
            db.Close();
            return ret;
        }
Пример #6
0
        public int Arrival(Contract con)
        {
            SchoolDatabase db = new SchoolDatabase();
            db.Connect();

            SqlCommand command = db.CreateCommand(SQL_ARRIVAL);

            command.Parameters.Add(new SqlParameter("@p_CustomerID", SqlDbType.Int));
            command.Parameters["@p_CustomerID"].Value = con.CustomerId;
            command.Parameters.Add(new SqlParameter("@p_EmployeesID", SqlDbType.Int));
            command.Parameters["@p_EmployeesID"].Value = con.EmployeesId;
            command.Parameters.Add(new SqlParameter("@p_GarageNumber", SqlDbType.SmallInt));
            command.Parameters["@p_GarageNumber"].Value = con.GarageNumber;
            int ret = db.ExecuteNonQuery(command);
            db.Close();
            return ret;
        }
Пример #7
0
        public bool UnstoreTires(int id, int EmployeeID)
        {
            SchoolDatabase db = new SchoolDatabase();
            db.Connect();
            SqlCommand command = db.CreateCommand(SQL_UNSTORE);

            command.Parameters.Add(new SqlParameter("@p_id", SqlDbType.Int));
            command.Parameters["@p_id"].Value = id;

            command.Parameters.Add(new SqlParameter("@p_Unstore_id", SqlDbType.Int));
            command.Parameters["@p_Unstore_id"].Value = EmployeeID;

            int ret = db.ExecuteNonQuery(command);

            db.Close();
            if (ret == 1) return true;
            else return false;
        }
Пример #8
0
 public int Update(Customer cust)
 {
     SchoolDatabase db = new SchoolDatabase();
     db.Connect();
     SqlCommand command = db.CreateCommand(SQL_UPDATE);
     PrepareCommand(command, cust);
     int ret = db.ExecuteNonQuery(command);
     db.Close();
     return ret;
 }