public void Delete(int Id, out string Message, out System.Drawing.Color Color) { Object.TimeTable timeTable = new Object.TimeTable(); timeTable.Id = Id; int ResultNumber = crud.Delete(timeTable); message.Delete(ResultNumber, out Message, out Color); }
public void Create(int LessonHour, DateTime LessonTime, int ShiftType, out string Message, out System.Drawing.Color Color) { Object.TimeTable timeTable = new Object.TimeTable(); timeTable.LessonHour = LessonHour; timeTable.LessonTime = LessonTime; timeTable.ShiftType = ShiftType; int ResultNumber = crud.Create(timeTable); message.Create(ResultNumber, out Message, out Color); }
public int Delete(Object.TimeTable timeTable) { using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString())) { SqlCommand cmd = new SqlCommand("Delete From tblTimeTable Where Id = @Id", con); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@Id", timeTable.Id); con.Open(); return((int)cmd.ExecuteNonQuery()); } }
public int Create(Object.TimeTable timeTable) { using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString())) { SqlCommand cmd = new SqlCommand("spAddTimeTable_tblTimeTable", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@LessonHour", timeTable.LessonHour); cmd.Parameters.AddWithValue("@LessonTime", timeTable.LessonTime); cmd.Parameters.AddWithValue("@ShiftType", timeTable.ShiftType); SqlParameter Result = new SqlParameter("@ResultNumber", DbType.Int32); Result.Direction = ParameterDirection.Output; cmd.Parameters.Add(Result); con.Open(); cmd.ExecuteNonQuery(); con.Close(); return((int)Result.Value); } }