// Updating a event
        protected void gvwDash_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string eventId        = ((Label)gvwCourseEvents.Rows[e.RowIndex].FindControl("txtEventId")).Text;
            string eventSchedule  = ((TextBox)gvwCourseEvents.Rows[e.RowIndex].FindControl("txtSchedule")).Text;
            string eventLocation  = ((TextBox)gvwCourseEvents.Rows[e.RowIndex].FindControl("txtLocation")).Text;
            string eventPrice     = ((TextBox)gvwCourseEvents.Rows[e.RowIndex].FindControl("txtPrice")).Text;
            string eventStartDttm = ((TextBox)gvwCourseEvents.Rows[e.RowIndex].FindControl("txtStartDttm")).Text;
            string eventEndDttm   = ((TextBox)gvwCourseEvents.Rows[e.RowIndex].FindControl("txtEndDttm")).Text;

            // update event start
            BIZCourseDataSet eventDS = _bc.getEventDataSetById(eventId);

            BIZCourseDataSet.T_BIZ002_COURSE_EVENTRow eventRow = (BIZCourseDataSet.T_BIZ002_COURSE_EVENTRow)eventDS.T_BIZ002_COURSE_EVENT.Rows[0];
            eventRow.SCHEDULE   = eventSchedule;
            eventRow.LOCATION   = eventLocation;
            eventRow.PRICE      = eventPrice;
            eventRow.START_DTTM = DateTimeUtil.parseToDateTime(eventStartDttm);
            eventRow.END_DTTM   = DateTimeUtil.parseToDateTime(eventEndDttm);

            _bc.UpdateTable(eventDS.T_BIZ002_COURSE_EVENT);
            // end of add new event

            gvwCourseEvents.EditIndex = -1;
            // Rebind Grid view
            this.EventDataBind();
        }
        protected void btnUpdateCourse_Click(object sender, EventArgs e)
        {
            string courseId = ViewState["CourseId"].ToString();

            if (!string.IsNullOrEmpty(courseId))
            {
                BIZCourseDataSet courseDS = (BIZCourseDataSet)_bc.getCourseDataSetById(courseId);
                BIZCourseDataSet.T_BIZ001_COURSERow courseRow = (BIZCourseDataSet.T_BIZ001_COURSERow)courseDS.T_BIZ001_COURSE.Rows[0];
                if (fileUpload.HasFile)
                {
                    string fileName = fileUpload.FileName;
                    string filePath = SaveFileToDisk(fileUpload.FileBytes, fileName, courseRow.USERID);

                    courseRow.COURSE_FILENAME  = fileName;
                    courseRow.COURSE_IMAGEPATH = filePath;
                }
                courseRow.COURSE_DETAIL  = this.description.Text;
                courseRow.COURSE_NAME    = this.courseName.Text;
                courseRow.COURSE_TAG     = this.courseTag.Text;
                courseRow.COURSE_REG_URL = this.regURL.Text;

                _bc.UpdateTable(courseDS.T_BIZ001_COURSE);

                ShowMessage("Update Successfully!", MessageSeverity.Information);

                Response.Redirect("~/Secure/Course/Courses.aspx");
            }
        }
        // Adding new Event
        protected void AddNewEvent(object sender, EventArgs e)
        {
            string eventSchedule  = ((TextBox)gvwCourseEvents.FooterRow.FindControl("txtNewSchedule")).Text;
            string eventLocation  = ((TextBox)gvwCourseEvents.FooterRow.FindControl("txtNewLocation")).Text;
            string eventPrice     = ((TextBox)gvwCourseEvents.FooterRow.FindControl("txtNewPrice")).Text;
            string eventStartDttm = ((TextBox)gvwCourseEvents.FooterRow.FindControl("txtNewStartDttm")).Text;
            string eventEndDttm   = ((TextBox)gvwCourseEvents.FooterRow.FindControl("txtNewEndDttm")).Text;

            // below to add new event
            string           courseId = ViewState["CourseId"].ToString();
            BIZCourseDataSet courseDS = new BIZCourseDataSet();

            BIZCourseDataSet.T_BIZ002_COURSE_EVENTRow courseRow = courseDS.T_BIZ002_COURSE_EVENT.NewT_BIZ002_COURSE_EVENTRow();
            courseRow.COURSEEVENTID = Utility.NewDataKey();
            courseRow.COURSEID      = courseId;
            courseRow.SCHEDULE      = eventSchedule;
            courseRow.LOCATION      = eventLocation;
            courseRow.PRICE         = eventPrice;
            courseRow.START_DTTM    = DateTimeUtil.parseToDateTime(eventStartDttm);
            courseRow.END_DTTM      = DateTimeUtil.parseToDateTime(eventEndDttm);

            Utility.UpdateCommonFields(courseRow);
            courseDS.T_BIZ002_COURSE_EVENT.AddT_BIZ002_COURSE_EVENTRow(courseRow);

            _bc.UpdateTable(courseDS.T_BIZ002_COURSE_EVENT);
            // end of add new event

            // Rebind Grid view
            this.EventDataBind();
        }
        protected void btnAddCourse_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(HttpContext.Current.User.Identity.Name))
            {
                ShowMessage("Please login to proceed this function!", MessageSeverity.Error);
            }
            else
            {
                BIZCourseDataSet courseDS = new BIZCourseDataSet();
                BIZCourseDataSet.T_BIZ001_COURSERow courseRow = courseDS.T_BIZ001_COURSE.NewT_BIZ001_COURSERow();
                courseRow.COURSEID       = Utility.NewDataKey();
                courseRow.USERID         = HttpContext.Current.User.Identity.Name;
                courseRow.COURSE_NAME    = this.courseName.Text;
                courseRow.COURSE_DETAIL  = this.description.Text;
                courseRow.COURSE_TAG     = this.courseTag.Text;
                courseRow.STATUS         = Constants.CourseStatus.PENDING;
                courseRow.COURSE_REG_URL = this.regURL.Text;

                if (fileUpload.HasFile)
                {
                    string fileName = fileUpload.FileName;
                    string filePath = SaveFileToDisk(fileUpload.FileBytes, fileName, courseRow.USERID);

                    courseRow.COURSE_FILENAME  = fileName;
                    courseRow.COURSE_IMAGEPATH = filePath;
                }

                Utility.UpdateCommonFields(courseRow);
                courseDS.T_BIZ001_COURSE.AddT_BIZ001_COURSERow(courseRow);

                _bc.UpdateTable(courseDS.T_BIZ001_COURSE);

                RedirectToCourseList();
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Expires     = -1;
            IList <CalendarDTO> tasksList = new List <CalendarDTO>();
            CourseBCService     _bc       = new CourseBCService();
            BIZCourseDataSet    eventDS   = (BIZCourseDataSet)_bc.getAllCourseEvents();

            foreach (BIZCourseDataSet.T_BIZ002_COURSE_EVENTRow eventRow in eventDS.T_BIZ002_COURSE_EVENT.Rows)
            {
                tasksList.Add(new CalendarDTO
                {
                    id    = 1,
                    title = eventRow.SCHEDULE,
                    start = ConvertToDateString(eventRow.START_DTTM),
                    end   = ConvertToDateString(eventRow.END_DTTM),
                    url   = ""
                });
            }


            System.Web.Script.Serialization.JavaScriptSerializer oSerializer =
                new System.Web.Script.Serialization.JavaScriptSerializer();
            string sJSON = oSerializer.Serialize(tasksList);

            context.Response.Write(sJSON);
        }
Пример #6
0
        internal DataTable getCoursesByCriteriaAdmin(String searchKey, String startDttm, String endDttm)
        {
            BIZCourseDataSet ds  = new BIZCourseDataSet();
            DbCommand        cmd = this.Helper.BuildDbCommand(SPNameConstants.P_QUERY_COURSE_BY_ADMIN);

            this.Helper.AssignParameterValues(cmd, searchKey, startDttm, endDttm);
            this.Helper.Fill(ds.T_BIZ001_COURSE, cmd);
            return(ds.T_BIZ001_COURSE);
        }
Пример #7
0
        internal DataTable getCoursesByParameter(String category, String location, String orderby)
        {
            BIZCourseDataSet ds  = new BIZCourseDataSet();
            DbCommand        cmd = this.Helper.BuildDbCommand(SPNameConstants.P_QUERY_COURSE_BY_PARAMETER);

            this.Helper.AssignParameterValues(cmd, category, location, orderby);
            this.Helper.Fill(ds.T_BIZ001_COURSE, cmd);
            return(ds.T_BIZ001_COURSE);
        }
Пример #8
0
        public BIZCourseDataSet getCourseDSEventByCourseId(string courseId)
        {
            BIZCourseDataSet ds  = new BIZCourseDataSet();
            DbCommand        cmd = this.Helper.BuildDbCommand(SPNameConstants.P_QUERY_COURSE_EVENTS_BY_ID_FOR_VIEW);

            this.Helper.AssignParameterValues(cmd, courseId);
            this.Helper.Fill(ds.T_BIZ002_COURSE_EVENT, cmd);
            return(ds);
        }
Пример #9
0
        public Onecalendar.BusinessEntity.BIZCourseDataSet getEventDataSetById(string eventId)
        {
            BIZCourseDataSet ds  = new BIZCourseDataSet();
            DbCommand        cmd = this.Helper.BuildDbCommand(SPNameConstants.P_QUERY_EVENT_BY_EVENT_ID);

            this.Helper.AssignParameterValues(cmd, eventId);
            this.Helper.Fill(ds.T_BIZ002_COURSE_EVENT, cmd);
            return(ds);
        }
Пример #10
0
        internal DataTable getCoursesByFreetext(string searchKey)
        {
            BIZCourseDataSet ds  = new BIZCourseDataSet();
            DbCommand        cmd = this.Helper.BuildDbCommand(SPNameConstants.P_QUERY_COURSE_BY_FREE_TEXT);

            this.Helper.AssignParameterValues(cmd, searchKey);
            this.Helper.Fill(ds.T_BIZ001_COURSE, cmd);
            return(ds.T_BIZ001_COURSE);
        }
Пример #11
0
        public DataSet QueryEventDataSetWithParameters(string SPName)
        {
            BIZCourseDataSet ds  = new BIZCourseDataSet();
            DbCommand        cmd = this.Helper.BuildDbCommand(SPName);

            this.Helper.AssignParameterValues(cmd);
            this.Helper.Fill(ds.T_BIZ002_COURSE_EVENT, cmd);
            return(ds);
        }
Пример #12
0
        // below is the general query method with dynamic parameters passed in up to 3
        public DataSet QueryDataSetWithParameters(string SPName, params string[] paramsArray)
        {
            BIZCourseDataSet ds  = new BIZCourseDataSet();
            DbCommand        cmd = this.Helper.BuildDbCommand(SPName);

            this.Helper.AssignParameterValues(cmd, paramsArray);
            this.Helper.Fill(ds.T_BIZ001_COURSE, cmd);
            return(ds);
        }
        private void UpdateCourse(CommandEventArgs e, String action)
        {
            String courseId = e.CommandArgument.ToString();

            if (!String.IsNullOrEmpty(courseId))
            {
                BIZCourseDataSet courseDS = (BIZCourseDataSet)_bc.getCourseDataSetById(courseId);
                if (courseDS.T_BIZ001_COURSE.Rows.Count > 0)
                {
                    BIZCourseDataSet.T_BIZ001_COURSERow courseRow = (BIZCourseDataSet.T_BIZ001_COURSERow)courseDS.T_BIZ001_COURSE.Rows[0];
                    courseRow.STATUS = action;

                    _bc.UpdateTable(courseDS.T_BIZ001_COURSE);

                    ShowMessage("Record Updated!", MessageSeverity.Information);
                }
            }
            CourseDataBind();
        }
        public void CastDataTable2TaskList(DataTable courseDT, IList <CourseDTO> tasksList, CourseBCService _bc)
        {
            foreach (DataRow item in courseDT.Rows)
            {
                if (item["COURSEID"] == null || String.IsNullOrEmpty(item["COURSEID"].ToString()))
                {
                    continue;
                }
                CourseDTO course = new CourseDTO
                {
                    CourseID     = item["COURSEID"].ToString(),
                    CourseName   = item["COURSE_NAME"].ToString(),
                    CourseDetail = item["COURSE_DETAIL"].ToString(),
                    CourseRegURL = item["COURSE_REG_URL"].ToString()
                };

                BIZCourseDataSet eventDS = (BIZCourseDataSet)_bc.getCourseDSEventByCourseId(item["COURSEID"].ToString());

                List <EventDTO> eventList = new List <EventDTO>();
                foreach (BIZCourseDataSet.T_BIZ002_COURSE_EVENTRow eventRow in eventDS.T_BIZ002_COURSE_EVENT.Rows)
                {
                    if (!String.IsNullOrEmpty(eventRow.COURSEEVENTID))
                    {
                        EventDTO eventTO = new EventDTO
                        {
                            Id        = eventRow.COURSEEVENTID,
                            Schedule  = eventRow.SCHEDULE,
                            Location  = eventRow.LOCATION,
                            Startdttm = ConvertToDateString(eventRow.START_DTTM),
                            Enddttm   = ConvertToDateString(eventRow.END_DTTM),
                        };
                        eventList.Add(eventTO);
                    }
                }
                course.EventList = eventList;
                tasksList.Add(course);
            }
        }