protected void Button1_Click(object sender, EventArgs e) { string classondays = ""; for (int i = 0; i < chkDays.Items.Count; i++) { if (chkDays.Items[i].Selected) classondays += chkDays.Items[i].Value.ToString() + " "; } classondays.TrimEnd(); Course course = new Course(txtCourseName.Text, calStartDate.SelectedDate, calEndDate.SelectedDate, classondays, new TimeSpan(Convert.ToInt32(txtStartHH.Text), Convert.ToInt32(txtStartMM.Text), 0), new TimeSpan(Convert.ToInt32(txtEndHH.Text), Convert.ToInt32(txtEndMM.Text), 0)); course.addCourse(); course.courseId = Course.fetchUploadedCourse(txtCourseName.Text); AWSClass.PutBucketToS3("course-" + course.courseId.ToString()); string topicarn = AWSClass.createSNSTopic(txtCourseName.Text.Replace(" ", "_")); course.addTopicARN(topicarn); }
public static Course fetchCoursebyId(int _courseid) { dbManager db = new dbManager(); Course cs = null; string sqlCommand; MySqlParameter[] param = new MySqlParameter[1]; param[0] = new MySqlParameter("@courseid", _courseid); sqlCommand = "select * from Course where courseid=@courseid"; DataTable ds = db.fetchRows(sqlCommand, param); int i = 0; foreach (DataRow dr in ds.Rows) { cs = new Course(Convert.ToInt32(dr["courseid"].ToString()), dr["coursename"].ToString(), (DateTime)dr["startdate"], (DateTime)dr["enddate"], dr["classondays"].ToString(), (TimeSpan)dr["classstarttime"], (TimeSpan)dr["classendtime"]); i++; } return cs; }