public void GetOrderDetail(string orderID)
        {
            OrderDAO    orderDao    = new OrderDAO();
            ScheduleDAO scheduleDAO = new ScheduleDAO();
            MovieDAO    movieDAO    = new MovieDAO();
            OrderDTO    order       = orderDao.CheckOrder(orderID);

            if (order != null)
            {
                ScheduleDTO schedule   = scheduleDAO.GetScheduleByID(order.ScheduleID);
                string      movieTitle = movieDAO.GetMovieTitle(schedule.MovieID);
                this.orderDetail.Visible = true;
                this.lblOrderID.Text     = order.OrderID;
                this.invalidCode.Visible = false;
                this.lbMovieName.Text    = movieTitle;
                this.lbDate.Text         = schedule.ScheduleDate.ToShortDateString();
                this.lbTime.Text         = schedule.ScheduleDate.ToShortTimeString();
                this.lbRoom.Text         = schedule.RoomID.ToString();
                this.lbPrice.Text        = (schedule.PriceOfTicket * (order.ListOfSeat).Count) + "";
                string seat = "";
                foreach (string s in order.ListOfSeat)
                {
                    seat += (s + "  ");
                }
                this.lbSeat.Text = seat;
            }
            else
            {
                this.invalidCode.CssClass = "error_message_show";
                this.orderDetail.Visible  = false;
            }
        }
Beispiel #2
0
        private void CreateDataAboutFilm(int id)
        {
            //Информация о выбранном дне сохраняется в HttpContext.Items["CurrentDay"]
            //По умолчанию равен дате сегодня
            var timeNow    = DateTime.Now;
            var currentDay = timeNow.Date; //new DateTime(timeNow.Year,timeNow.Month, timeNow.Day);

            if (Request.Query.ContainsKey("schedule_date"))
            {
                currentDay = DateTime.ParseExact(
                    Request.Query["schedule_date"],
                    "dd.MM.yyyy", CultureInfo.InvariantCulture);
            }
            HttpContext.Items["CurrentDay"] = currentDay;

            var film = FilmViewModelDAO.GetFilms($"WHERE id = {id}", false).FirstOrDefault();

            FilmViewModel = film;

            FilmViewModel.Actors    = FilmViewModelDAO.GetActorsByFilmId(FilmViewModel.Id);
            FilmViewModel.Producers = FilmViewModelDAO.GetProducersByFilmId(FilmViewModel.Id);
            FilmViewModel.Country   = FilmViewModelDAO.GetCounrtyById(FilmViewModel.CountryId);
            FilmViewModel.Reviews   = FilmViewModelDAO.GetReviewByFilmId(FilmViewModel.Id);
            FilmViewModel.Schedule  = ScheduleDAO.GetSchedule($"id_movie={id} AND date::DATE = '{currentDay:yyyy-MM-dd}'");
        }
Beispiel #3
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            string      movieID = txtMovieID.Text;
            ScheduleDAO scheDao = new ScheduleDAO();

            scheDao.AdminScheduleDelete(movieID);
            if (MovieDao.DeleteMovie(movieID))
            {
                List <MovieDTO> list = (List <MovieDTO>)Session["AdminMovieSearch"];
                foreach (MovieDTO item in list)
                {
                    if (item.MovieID.Equals(movieID))
                    {
                        list.Remove(item);
                    }
                }
                gvStaffList.DataSource = list;
                gvStaffList.DataBind();
                SetMessageTextAndColor("Successfully deleted", Color.Green);
                Clear();
            }
            else
            {
                SetMessageTextAndColor("Failed to delete", Color.Red);
            }
        }
        /// <summary>
        /// Helper method to determine the wait time between report runs
        /// </summary>
        /// <returns>the wait time between report runs</returns>
        private TimeSpan GetRepetitionInterval()
        {
            // get "now" date variables
            DateTime now          = DateTime.Now;
            double   nowMS        = now.TimeOfDay.TotalMilliseconds;
            int      nowDayOfWeek = (int)now.DayOfWeek;

            // set up loop variables
            int    minDayOfWeek = -1;
            double minMS        = -1;

            MySqlConnection connection  = null;
            ScheduleDAO     scheduleDAO = null;

            try {
                connection  = DatabaseUtil.OpenDataSource();
                scheduleDAO = new ScheduleDAO(connection);

                foreach (Schedule schedule in scheduleDAO.GetScheduleItems())
                {
                    // get "scheduled" date variables
                    int    dayOfWeek = (int)schedule.DayOfTheWeek;
                    double ms        = schedule.TimeOfDay.TotalMilliseconds;

                    // ensure every item compared is in the future or right now
                    if (dayOfWeek < nowDayOfWeek || (dayOfWeek == nowDayOfWeek && ms < nowMS))
                    {
                        dayOfWeek += 7;
                    }

                    // if min DoW is not set, or if the scheduled DoW is less than the min, check MS
                    if (minDayOfWeek < 0 || minDayOfWeek > dayOfWeek || (minDayOfWeek == dayOfWeek && minMS > ms))
                    {
                        minDayOfWeek = dayOfWeek;
                        minMS        = ms;
                    }
                }
            }
            finally {
                if (connection != null)
                {
                    connection.Dispose();
                }
                if (scheduleDAO != null)
                {
                    scheduleDAO.Dispose();
                }
            }

            if (minMS < 0 || minDayOfWeek < 0)
            {
                throw new NoScheduleException("No schedules found, can not schedule next report run.");
            }
            else
            {
                TimeSpan returnTimeSpan = TimeSpan.FromDays(minDayOfWeek - nowDayOfWeek).Add(TimeSpan.FromMilliseconds(minMS - nowMS));
                _logger.DebugFormat("Next reporter run scheduled for: {0}", DateTime.Now.Add(returnTimeSpan).ToString());
                return(returnTimeSpan);
            }
        }
Beispiel #5
0
        //Страница бронирования мест
        //Id - это id сеанса(Schedule)
        public IActionResult OnGet(int id)
        {
            Id = id;
            //Не авторизован - на главную станицу
            if (!_authService.IsAuthenticated)
            {
                return(Redirect(Url.Content("~/")));
            }
            var schedule = ScheduleDAO.GetSchedule($"id_schedule = {id}").FirstOrDefault();

            schedule.Hall = ScheduleDAO.GetHallByScheduleId(id);

            var bookings = BookingDAO.GetBookingByScheduleId(id);

            foreach (var booking in bookings)
            {
                booking.Schedule = schedule;
            }

            BookingPageViewModel = new BookingPageViewModel
            {
                //Передаем сеанс с указаным id
                Schedule = schedule,
                //Передаем все бронирования на этот сеанс
                BookingsInSchedule = bookings
            };
            return(Page());
        }
Beispiel #6
0
        public static ScheduleDAO MapToScheduleDAO(Schedule schedule)
        {
            var s = new ScheduleDAO();

            s.ScheduleId  = schedule.ScheduleId;
            s.StudentId   = schedule.StudentId;
            s.ProfessorId = schedule.ProfessorId;

            s.Course1Id   = schedule.Course1Id;
            s.Course1Time = schedule.Course1Time;

            s.Course2Id   = schedule.Course2Id;
            s.Course2Time = schedule.Course2Time;

            s.Course3Id   = schedule.Course3Id;
            s.Course3Time = schedule.Course3Time;

            s.Course4Id   = schedule.Course4Id;
            s.Course4Time = schedule.Course4Time;

            s.Course5Id   = schedule.Course5Id;
            s.Course5Time = schedule.Course5Time;

            s.Course6Id   = schedule.Course6Id;
            s.Course6Time = schedule.Course6Time;

            s.Course7Id   = schedule.Course7Id;
            s.Course7Time = schedule.Course7Time;

            return(s);
        }
        public ActionResult insertSchedule(FormCollection formCollection)
        {
            foreach (string key in formCollection.AllKeys)
            {
                Response.Write("Key + " + key + " ");
                Response.Write(formCollection[key] + "</br>");
            }

            DateTime StartTime = Convert.ToDateTime(formCollection["StartTime"]);
            DateTime EndTime   = Convert.ToDateTime(formCollection["EndTime"]);
            DateTime Sche_Date = Convert.ToDateTime(formCollection["Sche_Date"]);

            SessionDAO sesDAO  = new SessionDAO();
            Session    session = sesDAO.getSessionByTime(StartTime, EndTime);

            int id_Ses = -1;

            if (session == null)
            {
                id_Ses = sesDAO.createSession(StartTime, EndTime);
            }
            else
            {
                id_Ses = session.id_Ses;
            }

            int id_F = Convert.ToInt32(formCollection["id_F"]);

            ScheduleDAO scheDAO = new ScheduleDAO();

            scheDAO.createSchedule(id_Ses, Sche_Date, id_F);
            return(View());
        }
Beispiel #8
0
 private void SaveScheduleDB(Schedule schedule)
 {
     using (var connection = DependencyService.Get <ISQLite>().GetConnection())
     {
         var dao = new ScheduleDAO(connection);
         dao.Save(schedule);
     }
 }
        // GET: Admin/Schedules
        public ActionResult Index(int page = 1, int pageSize = 10)
        {
            var dao       = new ScheduleDAO();
            var model     = dao.ListAllPaging(page, pageSize);
            var schedules = db.Schedules.Include(s => s.Class).Include(s => s.Subject);

            return(View(model));
        }
Beispiel #10
0
        public static ScheduleDAO MapToScheduleDAO(Schedule scheduleToMap)
        {
            ScheduleDAO schedule = new ScheduleDAO();

            schedule.Id              = scheduleToMap.Id;
            schedule.StudentId       = scheduleToMap.StudentId;
            schedule.CourseSessionId = scheduleToMap.CourseSessionId;

            return(schedule);
        }
        public ActionResult Get(uint id)
        {
            if (!Authentication.IsValid())
            {
                return(Json(new { Error = "Not Authenticated" }));
            }
            JsonResult json = Json(new { Object = ScheduleDAO.GetById(id) });

            json.MaxJsonLength = int.MaxValue;
            return(json);
        }
Beispiel #12
0
        public static Schedule MapToSchedule(ScheduleDAO schedule)
        {
            var s = new Schedule();

            s.ScheduleId = schedule.Id;
            s.PersonId   = schedule.Person.Id;
            s.CourseId   = schedule.Course.Id;
            s.Active     = schedule.Active;

            return(s);
        }
Beispiel #13
0
        public static ScheduleDAO MapToScheduleDAO(Schedule schedule)
        {
            var s = new ScheduleDAO();

            s.Id     = schedule.ScheduleId;
            s.Person = PersonMapper.MapToPersonDAO(schedule.Person);
            s.Course = CourseMapper.MapToCourseDAO(schedule.Course);
            s.Active = schedule.Active;

            return(s);
        }
Beispiel #14
0
        /// <summary>
        /// Convert ScheduleDAO into Schedule.
        /// </summary>
        /// <param name="scheduleDAO">The ScheduleDAO to convert.</param>
        /// <returns>The Schedule.</returns>
        public static Schedule MapToSchedule(ScheduleDAO scheduleDAO)
        {
            RegistrationData data = new RegistrationData();

            Schedule schedule = data.FindOrCreateSchedule(scheduleDAO.Id);

            schedule.ScheduleId = scheduleDAO.Id;
            schedule.StartTime  = scheduleDAO.StartTime;
            schedule.TimeBlocks = scheduleDAO.TimeBlocks;

            return(schedule);
        }
Beispiel #15
0
    public static string SignOut(string sno, string sequence, string remark)
    {
        if (!ScheduleField.Sequence.TestValue(sequence) || !ScheduleField.SignOutRemark.TestValue(remark))
        {
            return("数据格式或长度错误 请联系管理员!");
        }
        DateTime nowtime = DateTime.Now;

        SqlQueryCondition[] sqlconditions1 = new SqlQueryCondition[] {
            new SqlQueryCondition(UserField.StudentNmber, SqlQueryConditionOperator.Equal, sno),
            new SqlQueryCondition(UserField.Status, SqlQueryConditionOperator.Equal, 1)
        };
        object[,] user = UserDAO.Select(new UserField[] { UserField.Id, UserField.Name }, new SqlQueryCondition(sqlconditions1, SqlQueryLogicalOperator.And));
        if (user.Length == 0)
        {
            return("未找到该用户的信息,请检查学号是否填写正确!");
        }
        SqlQueryCondition[] sqlconditions2 = new SqlQueryCondition[] {
            new SqlQueryCondition(ScheduleField.Date, SqlQueryConditionOperator.Equal, nowtime),
            new SqlQueryCondition(ScheduleField.Sequence, SqlQueryConditionOperator.Equal, sequence),
            new SqlQueryCondition(ScheduleField.Attendant, SqlQueryConditionOperator.Equal, user[0, 0])
        };
        object[,] schedule = ScheduleDAO.Select(new ScheduleField[] { ScheduleField.Id, ScheduleField.SignInTime, ScheduleField.SignOutTime },
                                                new SqlQueryCondition(sqlconditions2, SqlQueryLogicalOperator.And));
        if (schedule.Length == 0)
        {
            return("未找到你的值班信息,请检查班次是否错误!");
        }
        if (schedule[0, 1] == DBNull.Value)
        {
            return("你还未进行入站签到,请先入站签到!");
        }
        if (schedule[0, 2] != DBNull.Value)
        {
            return("你已对此班签出!");
        }
        if (nowtime.TimeOfDay < dutytimes[sequence].EndTime - aheadtime)
        {
            return("此时签出太早了,请晚点再来!");
        }
        if (nowtime.TimeOfDay > dutytimes[sequence].EndTime + gracetime)
        {
            return("你来晚了,签出时间已过!");
        }
        ScheduleDAO.Update(new ScheduleField[] { ScheduleField.SignOutTime, ScheduleField.SignOutRemark }, new object[] { nowtime.TimeOfDay, remark },
                           new SqlQueryCondition(ScheduleField.Id, SqlQueryConditionOperator.Equal, schedule[0, 0]));
        UserLogDAO.Insert((int)user[0, 0], "signout{" + sequence + '\r' + remark + "}");
        return("true\n" + user[0, 1].ToString() + " 第" + sequence + "班 " + nowtime.ToLongTimeString() + "签出");
    }
Beispiel #16
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            string idstr = boxID.Text;

            try
            {
                User usr = new User();

                if (!String.IsNullOrEmpty(idstr))
                {
                    usr.Id = int.Parse(idstr);
                }
                usr.Name        = boxNombre.Text;
                usr.Appat       = boxApPat.Text;
                usr.Apmat       = boxApMat.Text;
                usr.Email       = boxEmail.Text;
                usr.Institution = InstitutionDAO.GetInstitution(int.Parse(selInstitution.SelectedValue));
                usr.Schedule    = ScheduleDAO.GetSchedule(int.Parse(Request.Form["selSchedule"]));
                usr.Username    = boxUsername.Text;
                usr.Password    = boxPassword.Text;

                User sUser = (User)Session["user"];
                if (sUser.Type == "manager")
                {
                    usr.Type = "agent";
                }
                else
                {
                    usr.Type = Request.Form["selType"];
                }

                if (String.IsNullOrEmpty(idstr)) //new
                {
                    UserDAO.AddUser(usr);
                }
                else //update
                {
                    UserDAO.ModUser(usr);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }

            Response.Redirect("~/UserList");
            Context.ApplicationInstance.CompleteRequest();
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            string idstr = boxID.Text;

            try
            {
                Schedule schedule = new Schedule();

                schedule.Name           = boxNombre.Text;
                schedule.Description    = boxDescripcion.Text;
                schedule.Fk_institution = int.Parse(selInstitution.SelectedValue);
                schedule.Lunesin        = boxLunesin.Text;
                schedule.Lunesout       = boxLunesout.Text;
                schedule.Martesin       = boxMartesin.Text;
                schedule.Martesout      = boxMartesout.Text;
                schedule.Miercolesin    = boxMiercolesin.Text;
                schedule.Miercolesout   = boxMiercolesout.Text;
                schedule.Juevesin       = boxJuevesin.Text;
                schedule.Juevesout      = boxJuevesout.Text;
                schedule.Viernesin      = boxViernesin.Text;
                schedule.Viernesout     = boxViernesout.Text;
                schedule.Sabadoin       = boxSabadoin.Text;
                schedule.Sabadoout      = boxSabadoout.Text;
                schedule.Domingoin      = boxDomingoin.Text;
                schedule.Domingoout     = boxDomingoout.Text;

                if (String.IsNullOrEmpty(idstr)) //new
                {
                    ScheduleDAO.AddSchedule(schedule);
                }
                else //update
                {
                    schedule.Id = int.Parse(boxID.Text);
                    ScheduleDAO.ModSchedule(schedule);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.StackTrace);
                Debug.WriteLine(ex.Message);
            }

            Response.Redirect("~/ScheduleList");
            Context.ApplicationInstance.CompleteRequest();
        }
        public void UpdateList()
        {
            using (var connection = DependencyService.Get <ISQLite>().GetConnection())
            {
                ScheduleDAO dao    = new ScheduleDAO(connection);
                var         listDB = dao.List;

                var query =
                    listDB
                    .OrderBy(l => l.DateSchedule)
                    .ThenBy(l => l.TimeSchedule);

                this.List.Clear();
                foreach (var itemDB in query)
                {
                    this.List.Add(itemDB);
                }
            }
        }
Beispiel #19
0
 public IActionResult OnGet(int id)
 {
     UserViewModel          = UserDAO.GetUserById(id);
     UserViewModel.Bookings = BookingDAO.GetBookingsByUserId(id);
     foreach (var booking in UserViewModel.Bookings)
     {
         booking.Schedule      = ScheduleDAO.GetSchedule($"id_schedule = {booking.ScheduleId}").FirstOrDefault();
         booking.Schedule.Hall = ScheduleDAO.GetHallByScheduleId(booking.Schedule.Id);
         booking.Schedule.Film = FilmViewModelDAO.GetFilms($"WHERE id = {booking.Schedule.FilmId}", false).FirstOrDefault();
         if (booking.Row == 0)
         {
             booking.Schedule.PricePerSeat /= 2;
         }
         else if (booking.Row == booking.Schedule.Hall.SeatsRowCount.Length - 1)
         {
             booking.Schedule.PricePerSeat = Math.Round(booking.Schedule.PricePerSeat * (decimal)1.2);
         }
     }
     return(Page());
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                User sUser = (User)Session["user"];

                if (sUser == null)
                {
                    Response.Redirect("~/Login");
                }

                string idstr = Request["Id"];

                if (String.IsNullOrEmpty(idstr)) //new schedule
                {
                    btnBorrar.Visible = false;
                    lblId.Visible     = false;
                    boxID.Visible     = false;
                }
                else //load schedule
                {
                    try
                    {
                        boxID.Enabled = false;
                        Schedule schedule = ScheduleDAO.GetSchedule(int.Parse(idstr));

                        boxID.Text           = schedule.Id.ToString();
                        boxNombre.Text       = schedule.Name;
                        boxDescripcion.Text  = schedule.Description;
                        boxLunesin.Text      = schedule.Lunesin;
                        boxLunesout.Text     = schedule.Lunesout;
                        boxMartesin.Text     = schedule.Martesin;
                        boxMartesout.Text    = schedule.Martesout;
                        boxMiercolesin.Text  = schedule.Miercolesin;
                        boxMiercolesout.Text = schedule.Miercolesout;
                        boxJuevesin.Text     = schedule.Juevesin;
                        boxJuevesout.Text    = schedule.Juevesout;
                        boxViernesin.Text    = schedule.Viernesin;
                        boxViernesout.Text   = schedule.Viernesout;
                        boxSabadoin.Text     = schedule.Sabadoin;
                        boxSabadoout.Text    = schedule.Sabadoout;
                        boxDomingoin.Text    = schedule.Domingoin;
                        boxDomingoout.Text   = schedule.Domingoout;
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.StackTrace);
                        Debug.WriteLine(ex.Message);
                    }
                }

                List <Institution> institutions = InstitutionDAO.GetInstitutions();
                int ins_fk = 1;

                if (!String.IsNullOrEmpty(Request["Id"]))
                {
                    ins_fk = ScheduleDAO.GetSchedule(int.Parse(boxID.Text)).Fk_institution;
                }

                if (sUser.Type == "admin")
                {
                    foreach (Institution ins in institutions)
                    {
                        if (!String.IsNullOrEmpty(Request["Id"]) && ins.Id == ins_fk) //not postback, requesting id info,
                        {
                            selInstitution.Items.Add(new ListItem(ins.Id + " - " + ins.Name, ins.Id.ToString()));
                            selInstitution.SelectedValue = ins.Id.ToString();
                            //selInstitution.InnerText += ("<option value=\"" + ins.Id + "\" selected>" + ins.Id + "-" + ins.Name + "</option>");
                        }
                        else
                        {
                            //selInstitution.InnerText += ("<option value=\"" + ins.Id + "\">" + ins.Id + "-" + ins.Name + "</option>");
                            selInstitution.Items.Add(new ListItem(ins.Id + " - " + ins.Name, ins.Id.ToString()));
                        }
                    }
                }
                else if (sUser.Type == "manager")
                {
                    selInstitution.Items.Add(new ListItem(sUser.Institution.Id + " - " + sUser.Institution.Name, sUser.Institution.Id.ToString()));
                    //selInstitution.InnerText += ("<option value=\"" + sUser.Institution.Id + "\" selected>" + sUser.Institution.Name + "</option>");
                }
            }
        }
 protected void btnBorrar_Click(object sender, EventArgs e)
 {
     ScheduleDAO.RemoveSchedule(int.Parse(boxID.Text));
     Response.Redirect("~/ScheduleList");
     Context.ApplicationInstance.CompleteRequest();
 }
 public IEnumerable <Schedule> GetList()
 {
     return(ScheduleDAO.GetList());
 }
 public Schedule GetById(uint id)
 {
     return(ScheduleDAO.GetById(id));
 }