Esempio n. 1
0
        public ActionResult UpdateNtf(int id, string status)
        {
            var eid    = Convert.ToInt32(Session["Event_ID"]);
            var ID     = Convert.ToInt32(id);
            var Status = Convert.ToBoolean(status);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var call = db.Polls.Where(x => x.Event_ID == eid).ToList();



                foreach (var poo in call)
                {
                    poo.IsActive = false;
                }


                var result = db.Polls.Where(a => a.Polls_ID == ID).SingleOrDefault();
                if (result != null)
                {
                    result.IsActive = Status;
                }
                db.SaveChanges();

                var results = new { ID = result.Polls_ID, TID = result.Polls_Type_ID };
                return(Json(results));
            }
        }
Esempio n. 2
0
        public ActionResult _SetshowRate(int?checkid)
        {
            var ID = Convert.ToInt32(Session["Event_ID"]);


            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                List <Polls> QRate = new List <Polls>();
                QRate = db.Polls.Where(x => x.Event_ID == ID && x.Polls_ID == checkid).ToList();



                var SesID = Convert.ToString(Session["Ses_ID"]);

                List <Outer> ShowRate = new List <Outer>();
                ShowRate = db.Outer.Where(x => x.Polls_ID == checkid && x.OuterSes_ID == SesID).ToList();

                ViewBag.ShowRate = ShowRate;

                //viewbagdata
                ViewBag.MyQRate = QRate;

                return(View());
            }
        }
Esempio n. 3
0
        public ActionResult _SetshowMulti(int?checkid)
        {
            var ID = Convert.ToInt32(Session["Event_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                List <Polls> QMulti = new List <Polls>();
                QMulti = db.Polls.Where(x => x.Event_ID == ID && x.Polls_ID == checkid).ToList();

                //viewbagdata
                ViewBag.MyQMulti = QMulti;
                var SesID = Convert.ToString(Session["Ses_ID"]);

                var ShowOption = from Outer in db.Outer
                                 join Outerop in db.OuterOptions on Outer.Outer_ID equals Outerop.Outer_ID
                                 join OptionID in db.Options on Outerop.Options_ID equals OptionID.Options_ID
                                 where Outer.Polls_ID == checkid
                                 select new OuterOption
                {
                    Outer        = Outer,
                    OuterOptions = Outerop,
                    Options      = OptionID
                };

                ViewBag.ShowOption = ShowOption.Where(x => x.Outer.OuterSes_ID == SesID).ToList();

                return(PartialView());
            }
        }
Esempio n. 4
0
        public ActionResult EDITEvent(string Name, string Event_Code, DateTime Start_Date, DateTime End_Date, int ID, string Password)
        {
            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                Eit bussiness = new Eit();

                bool IsDupicate = bussiness.CheckEdit(Event_Code, Start_Date, End_Date, ID);
                if (!IsDupicate)
                {
                    var EditView = db.Event.Where(x => x.Event_ID == ID).SingleOrDefault();


                    EditView.Event_Code     = Event_Code;
                    EditView.Start_Date     = Start_Date;
                    EditView.End_Date       = End_Date;
                    EditView.Event_Name     = Name;
                    EditView.Event_Password = Password;
                    db.SaveChanges();

                    var alerte = new { Result = "กิจกรรมได้รับการอัพเดต" };

                    return(Json(alerte));
                }
                else
                {
                    // TempData["msg"] = "<script>alert('Your Timeline is already Exist.');</script>";
                    var alerte = new { Result = "ช่วงระเวลากิจกรรมของคุณเกิดความซ้ำซ้อน" };
                    return(Json(alerte));
                }
            }
        }
Esempio n. 5
0
        public ActionResult _QMulti(int?pid)
        {
            var ID = Convert.ToInt32(Session["Event_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                List <Polls> QMulti = new List <Polls>();
                QMulti = db.Polls.Where(x => x.Event_ID == ID && x.Polls_ID == pid).ToList();

                //viewbagdata
                ViewBag.MyQMulti = QMulti;
                var Is = db.Polls.Where(x => x.Polls_ID == pid).Select(x => x.IsMulti).ToArray();
                ViewBag.IsMulti = Is;
                var Max = db.Polls.Where(x => x.Polls_ID == pid).Select(x => x.MaxMulti).ToArray();
                ViewBag.MaxLimit = Max;

                var Multi = db.Options.Where(x => x.Polls_ID == pid).ToList();
                ViewBag.MyChoose = Multi;

                var numLimit     = QMulti.Select(x => x.LimitPerson).Single();
                var numusercount = db.Outer.Where(x => x.Polls_ID == pid).Count();
                if (numLimit == numusercount)
                {
                    ViewBag.Limitcheck = 1;
                }
                else
                {
                    ViewBag.Limitcheck = 0;
                }

                Session["Poll_ID"] = pid;

                return(PartialView());
            }
        }
Esempio n. 6
0
        public ActionResult _QCloud(int?pid)
        {
            var ID = Convert.ToInt32(Session["Event_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                List <Polls> QCloud = new List <Polls>();
                QCloud = db.Polls.Where(x => x.Event_ID == ID && x.Polls_ID == pid).ToList();

                var numLimit     = QCloud.Select(x => x.LimitPerson).Single();
                var numusercount = db.Outer.Where(x => x.Polls_ID == pid).Count();
                if (numLimit == numusercount)
                {
                    ViewBag.Limitcheck = 1;
                }
                else
                {
                    ViewBag.Limitcheck = 0;
                }
                //viewbagdata

                ViewBag.MyQCloud = QCloud;

                Session["Poll_ID"] = pid;

                return(PartialView());
            }
        }
Esempio n. 7
0
        public ActionResult _QRate(int?pid)
        {
            var ID = Convert.ToInt32(Session["Event_ID"]);


            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var pol = db.Polls.Where(x => x.Polls_ID == pid).SingleOrDefault();
                ViewBag.whatRate = pol;

                var numLimit     = pol.LimitPerson;
                var numusercount = db.Outer.Where(x => x.Polls_ID == pid).Count();
                if (numLimit == numusercount)
                {
                    ViewBag.Limitcheck = 1;
                }
                else
                {
                    ViewBag.Limitcheck = 0;
                }

                List <Polls> QRate = new List <Polls>();
                QRate = db.Polls.Where(x => x.Event_ID == ID && x.Polls_ID == pid).ToList();


                Session["Poll_ID"] = pid;

                //viewbagdata

                ViewBag.MyQRate = QRate;

                return(View());
            }
        }
Esempio n. 8
0
        public bool CheckDupicate(string CodeUpperCase, DateTime startDate, DateTime endDate)
        {
            bool result = false;

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var Lookstart = db.Event.Where(x => x.Event_Code == CodeUpperCase).Select(x => x.Start_Date).ToList();
                var Lookend   = db.Event.Where(x => x.Event_Code == CodeUpperCase).Select(x => x.End_Date).ToList();
                var LookUp    = new { start = Lookstart.ToArray(), end = Lookend.ToArray() };
                var LookCount = Lookstart.Count();

                if (db.Event.Any(x => x.Event_Code == CodeUpperCase))
                {
                    List <DateTime> allEvents = new List <DateTime>();
                    for (int i = 0; i < LookCount; i++)
                    {
                        allEvents.Add(LookUp.start[i]); //Make sure the start date is included in the list of dates!

                        var tempDate = LookUp.start[i];
                        var tempend  = LookUp.end[i];
                        while (tempDate < tempend) //Less than or Equals means the end date will be added as well
                        {
                            tempDate = tempDate.AddDays(1);
                            allEvents.Add(tempDate);
                        }
                    }

                    List <DateTime> allEventsAdd = new List <DateTime>();

                    allEventsAdd.Add(startDate); //Make sure the start date is included in the list of dates!

                    var tempDateAdd = startDate;
                    var tempendAdd  = endDate;
                    while (tempDateAdd < tempendAdd) //Less than or Equals means the end date will be added as well
                    {
                        tempDateAdd = tempDateAdd.AddDays(1);
                        allEventsAdd.Add(tempDateAdd);
                    }

                    for (int i = 0; i < allEventsAdd.Count(); i++)
                    {
                        var datacheck = allEventsAdd[i];
                        if (allEvents.Any(x => x.Date == datacheck))
                        {
                            result = true;
                        }
                    }
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }
Esempio n. 9
0
        public ActionResult CrateUser(string FirstName, string LastName, string password, string Email, string ConfirmPassword)
        {
            if (FirstName == "")
            {
                var results = new { Result = "กรุณากรอกข้อมูลทั้งหมด", Poll = "" };
                return(Json(results));
            }
            if (LastName == "")
            {
                var results = new { Result = "กรุณากรอกข้อมูลทั้งหมด", Poll = "" };
                return(Json(results));
            }
            if (Email == "")
            {
                var results = new { Result = "กรุณากรอกข้อมูลทั้งหมด", Poll = "" };
                return(Json(results));
            }
            if (password != ConfirmPassword)
            {
                var results = new { Result = "รหัสผ่านของคุณทั้งสองช่องไม่เหมือนกัน", Poll = "" };
                return(Json(results));
            }
            using (ProjectJobEntities db = new ProjectJobEntities())

            {
                if (db.Users.Any(x => x.Email == Email))
                {
                    var results = new { Result = "อีเมลของคุณถูกใช้แล้ว", Poll = "" };
                    return(Json(results));
                }
                password = PasswordStorage.CreateHash(password);

                var chars    = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
                var random   = new Random();
                var RandomID = new string(Enumerable.Repeat(chars, 13).Select(s => s[random.Next(s.Length)]).ToArray());

                db.Users.Add(new Users()
                {
                    FirstName = FirstName,
                    LastName  = LastName,
                    Password  = password,
                    Email     = Email,
                    Ses_ID    = RandomID
                });

                db.SaveChanges();
            }

            ModelState.Clear();
            var result = new { Result = "การสมัครสมาชิกสำเร็จ", Poll = 1 };

            return(Json(result));
        }
Esempio n. 10
0
        public ActionResult _Cloud(int ID)
        {
            var eid = Convert.ToInt32(Session["Event_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var all = db.Outer.Where(x => x.Polls_ID == ID).ToList();

                var MA = all.Select(x => x.Outer_Text);

                string[] word = MA.ToArray();
                string[] wait = { "ยังไม่มีการตอบคำถามในโพลคำถามนี้" };
                if (word.Length == 0)
                {
                    word = wait;
                }

                Dictionary <string, int> RepeatedWordCount = new Dictionary <string, int>();

                for (int i = 0; i < word.Length; i++)           //loop the splited string
                {
                    if (RepeatedWordCount.ContainsKey(word[i])) // Check if word already exist in dictionary update the count
                    {
                        int value = RepeatedWordCount[word[i]];
                        RepeatedWordCount[word[i]] = value + 1;
                    }
                    else
                    {
                        RepeatedWordCount.Add(word[i], 1);  // if a string is repeated and not added in dictionary , here we are adding
                    }
                }
                ViewBag.obj = RepeatedWordCount;
                var viewte = from po in db.Polls
                             join pot in db.Polls_Type on po.Polls_Type_ID equals pot.Polls_Type_ID
                             where po.Polls_ID == ID
                             select new SelectPolltype
                {
                    Polls_ID        = po.Polls_ID,
                    Polls_Name      = po.Polls_Name,
                    Polls_Type_ID   = pot.Polls_Type_ID,
                    Polls_Type_Name = pot.Polls_Type_Name,
                    Type_Color      = pot.Type_Color,
                    Type_icon       = pot.Type_icon,
                    IsActive        = po.IsActive
                };
                var viewter = viewte.ToList();
                ViewBag.view = viewter;


                return(View());
            }
        }
Esempio n. 11
0
        public ActionResult LinkQuestionPage(int ID)
        {
            using (ProjectJobEntities db = new ProjectJobEntities())

            {
                var model = db.Event.Where(x => x.Event_ID == ID).SingleOrDefault();

                Session["Event_ID"] = ID;

                Session["Event_Code"] = model.Event_Code;
            }
            return(Json(new { Url = "QuestionsPage" }));
        }
Esempio n. 12
0
        public ActionResult UpdateUser(string FirstName, string LastName, int User_ID)
        {
            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var UpdateUser = db.Users.Where(x => x.User_ID == User_ID).SingleOrDefault();

                UpdateUser.FirstName = FirstName;
                UpdateUser.LastName  = LastName;

                db.SaveChanges();

                return(Json(JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 13
0
        public ActionResult DeletEvent(int EventID)
        {
            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                Event EventDetail = db.Event.Find(EventID);
                db.Event.Remove(EventDetail);
                db.SaveChanges();


                var alerte = new { Result = "ลบเสร็จสิ้น" };

                return(Json(alerte));
            }
        }
Esempio n. 14
0
        public ActionResult DeletPoll(int PollID)
        {
            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                Polls pollDetail = db.Polls.Find(PollID);
                db.Polls.Remove(pollDetail);
                db.SaveChanges();



                var alertt = "ลบเสร็จสิ้น";
                return(Json(alertt));
            }
        }
Esempio n. 15
0
        public ActionResult _SetMulti(int?pid)
        {
            var ID = Convert.ToInt32(Session["Event_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                List <Polls> QText = new List <Polls>();
                QText = db.Polls.Where(x => x.Event_ID == ID && x.Polls_ID == pid).ToList();

                //viewbagdata
                ViewBag.MyQText = QText;

                return(PartialView());
            }
        }
Esempio n. 16
0
        public ActionResult _SettingUser()
        {
            var ID = Convert.ToInt32(Session["User_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var userlist = db.Users.Where(x => x.User_ID == ID).ToList();

                //viewbagdata
                ViewBag.Userlist = userlist;


                return(View());
            }
        }
Esempio n. 17
0
        public ActionResult _LookupEditEvent(int EID)
        {
            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var EditView = db.Event.Where(x => x.Event_ID == EID).Select(x => new EventViewModel()
                {
                    Event_ID = x.Event_ID, Event_Code = x.Event_Code, Event_Name = x.Event_Name, End_Date = x.End_Date, Start_Date = x.Start_Date, Event_Password = x.Event_Password
                }).ToList();
                var EventPassword = EditView.Select(x => x.Event_Password).ToArray();
                ViewBag.EditView      = EditView;
                ViewBag.EventPassword = EventPassword;

                return(View());
            }
        }
Esempio n. 18
0
        public ActionResult LinkPage(int ID)
        {
            var UID = Convert.ToInt32(Session["User_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())

            {
                var model = db.Event.Where(x => x.Users_ID == UID && x.Event_ID == ID).SingleOrDefault();

                Session["User_ID"]    = UID;
                Session["Event_ID"]   = ID;
                Session["Event_Code"] = model.Event_Code;
                Session["Event_Name"] = model.Event_Name;
            }
            return(Json(new { Url = "PollPage" }));
        }
Esempio n. 19
0
        public bool CheckPollClose(int PollID)
        {
            bool result = false;

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                if (db.Polls.Any(x => x.Polls_ID == PollID))
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }
Esempio n. 20
0
        // GET: Event
        public ActionResult Home()
        {
            var ID = Convert.ToInt32(Session["User_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                List <Event> eventlist = new List <Event>();

                eventlist = db.Event.Where(x => x.Users_ID == ID).OrderByDescending(q => q.Event_ID).ToList();

                //viewbagdata
                ViewBag.MyEventlist = eventlist;

                ViewBag.CountList = eventlist.Count();
                return(View());
            }
        }
Esempio n. 21
0
        public JsonResult FindIsActive(int EventID)
        {
            var session = Convert.ToString(Session["Ses_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var findActive = from ev in db.Event
                                 join po in db.Polls on ev.Event_ID equals po.Event_ID
                                 where ev.Event_ID == EventID
                                 select new Eventpoll
                {
                    Event = ev,
                    Poll  = po
                };

                var numActive   = findActive.Where(x => x.Poll.IsActive == true).ToList();
                var CountActive = numActive.Count();



                if (CountActive == 1)
                {
                    var PollActive = findActive.FirstOrDefault(x => x.Poll.IsActive == true);


                    if (PollActive != null)
                    {
                        var React = new { CheckAct = "1", ID = PollActive.Poll.Polls_ID, Type = PollActive.Poll.Polls_Type_ID };
                        return(Json(React, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        var React = new { CheckAct = "0" };
                        return(Json(React, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    var React = new { CheckAct = "0" };
                    return(Json(React, JsonRequestBehavior.AllowGet));
                }
            }
        }
Esempio n. 22
0
        public ActionResult PollPage()
        {
            var eid = Convert.ToInt32(Session["Event_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                List <Polls_Type> pollType = new List <Polls_Type>();
                pollType = db.Polls_Type.ToList();

                //viewbagdata
                ViewBag.MyPolist = pollType;



                List <Polls> pol = new List <Polls>();
                pol = db.Polls.Where(x => x.Event_ID == eid).OrderByDescending(q => q.Polls_ID).ToList();

                //viewbagdata
                ViewBag.MyPol = pol;


                List <TypePollView> viewP = new List <TypePollView>();

                var varis = from po in db.Polls
                            join pot in db.Polls_Type on po.Polls_Type_ID equals pot.Polls_Type_ID

                            where po.Event_ID == eid
                            orderby po.Polls_ID descending
                            select new TypePollView
                {
                    Poll       = po,
                    Polls_Type = pot
                };

                viewP              = varis.ToList();
                ViewBag.ThisPo     = viewP;
                ViewBag.ThisActive = eid;



                return(View());
            }
        }
Esempio n. 23
0
        public ActionResult validatePassword(int EventID, string Password)
        {
            using (ProjectJobEntities db = new ProjectJobEntities())

            {
                var model      = db.Event.Where(x => x.Event_ID == EventID).SingleOrDefault();
                var dbPassword = model.Event_Password.ToString();

                if (Password != dbPassword)
                {
                    var results = new { Result = "รหัสผ่านกิจกรรมผิด", Pascheck = "" };
                    return(Json(results));
                }
                else
                {
                    var results = new { evnet_ID = EventID, Pascheck = "1" };

                    return(Json(results));
                }
            }
        }
Esempio n. 24
0
        public ActionResult _Text(int ID)
        {
            var id  = Convert.ToInt32(Session["User_ID"]);
            var eid = Convert.ToInt32(Session["Event_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var Text = from po in db.Polls
                           join ev in db.Event on po.Event_ID equals ev.Event_ID
                           join st in db.Outer on po.Polls_ID equals st.Polls_ID
                           where po.Polls_ID == ID
                           select new PollEvOuter
                {
                    Poll  = po,
                    Event = ev,
                    Outer = st,
                };
                var viewText = Text.OrderByDescending(q => q.Outer.Outer_ID).ToList();
                ViewBag.ThisTextnCloud = viewText;
                ViewBag.ThisTextCount  = viewText.Count();
                var viewte = from po in db.Polls
                             join pot in db.Polls_Type on po.Polls_Type_ID equals pot.Polls_Type_ID
                             where po.Polls_ID == ID
                             select new SelectPolltype
                {
                    Polls_ID        = po.Polls_ID,
                    Polls_Name      = po.Polls_Name,
                    Polls_Type_ID   = pot.Polls_Type_ID,
                    Polls_Type_Name = pot.Polls_Type_Name,
                    Type_Color      = pot.Type_Color,
                    Type_icon       = pot.Type_icon,
                    IsActive        = po.IsActive
                };
                var viewter = viewte.ToList();
                ViewBag.view = viewter;


                return(PartialView());
            }
        }
Esempio n. 25
0
        public ActionResult _FindOuterOptions(int OuterID, int PollID)
        {
            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var ShowOption = from Outer in db.Outer
                                 join Outerop in db.OuterOptions on Outer.Outer_ID equals Outerop.Outer_ID
                                 join OptionID in db.Options on Outerop.Options_ID equals OptionID.Options_ID
                                 where Outer.Polls_ID == PollID
                                 select new OuterOption
                {
                    Outer        = Outer,
                    OuterOptions = Outerop,
                    Options      = OptionID
                };

                var AllOptions = ShowOption.Where(x => x.Outer.Outer_ID == OuterID).ToList();

                ViewBag.AllOptions = AllOptions;

                return(PartialView());
            }
        }
Esempio n. 26
0
        public ActionResult QuestionsPage()
        {
            var eid = Convert.ToInt32(Session["Event_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var findActive = from ev in db.Event
                                 join po in db.Polls on ev.Event_ID equals po.Event_ID
                                 where ev.Event_ID == eid
                                 select new Eventpoll
                {
                    Event = ev,
                    Poll  = po
                };
                //var PollActive = findActive.SingleOrDefault(x => x.Poll.IsActive == true);

                //ViewBag.Active = PollActive;
                ViewBag.ThisActive = eid;

                return(View());
            }
        }
Esempio n. 27
0
        public ActionResult Autherize(string password, string Email)
        {
            using (ProjectJobEntities db = new ProjectJobEntities())

            {
                if (Email != null && password != null)
                {
                    var model = db.Users.Where(x => x.Email == Email).SingleOrDefault();

                    if (model == null)
                    {
                        var results = new { Result = "บัญชีนี้ไม่ได้ถูกลงทะเบียนในระบบ, กรุณาสมัครสมาชิก ", Poll = "" };
                        return(Json(results));
                    }


                    bool result = PasswordStorage.VerifyPassword(password, model.Password);


                    if (result)
                    {
                        Session["User_ID"]   = model.User_ID;
                        Session["FirstName"] = model.FirstName;
                        Session["LastName"]  = model.LastName;
                        Session["Email"]     = model.Email;
                        Session["Ses_ID"]    = model.Ses_ID;
                        var results = new { Result = "เข้าสู่ระบบสำเร็จ", Poll = 1 };
                        return(Json(results));
                    }
                    else
                    {
                        var results = new { Result = "อีเมลหรือรหัสผ่านของคุณผิด", Poll = "" };
                        return(Json(results));;
                    }
                }
                return(View());
            }
        }
Esempio n. 28
0
        public ActionResult _LookupEditPoll(int PID)
        {
            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var EditViewPoll = db.Polls.Where(x => x.Polls_ID == PID).Select(x => new PollView()
                {
                    Polls_ID = x.Polls_ID, Polls_Type_ID = x.Polls_Type_ID, Polls_Name = x.Polls_Name, Event_ID = x.Event_ID, Rating = x.Rating, IsMulti = x.IsMulti, MaxMulti = x.MaxMulti, LimitPerson = x.LimitPerson
                }).ToList();
                var typePoll  = EditViewPoll.Select(x => x.Polls_Type_ID).ToArray();
                var LimitPoll = EditViewPoll.Select(x => x.LimitPerson).ToArray();

                var EditViewOption = db.Options.Where(x => x.Polls_ID == PID).Select(x => new OptionView()
                {
                    Polls_ID = x.Polls_ID, Options_ID = x.Options_ID, Options_Name = x.Options_Name
                }).ToList();
                ViewBag.OptionsLength  = EditViewOption.Count();
                ViewBag.EditViewOption = EditViewOption;
                ViewBag.EditViewRate   = EditViewPoll;
                ViewBag.EditViewType   = typePoll;
                ViewBag.EditLimitPoll  = LimitPoll;
                return(View());
            }
        }
Esempio n. 29
0
        public JsonResult FindHasSession()
        {
            var session       = Convert.ToString(Session["Ses_ID"]);
            var SessionPollID = Convert.ToInt32(Session["Poll_ID"]);

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var HasSession = db.Outer.Where(x => x.OuterSes_ID == session && x.Polls_ID == SessionPollID).Count();

                var PollActive = db.Polls.FirstOrDefault(x => x.Polls_ID == SessionPollID);

                if (HasSession != 0)
                {
                    var React = new { Checksession = "1", ID = PollActive.Polls_ID, Type = PollActive.Polls_Type_ID };
                    return(Json(React, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    var React = new { Checksession = "2" };
                    return(Json(React, JsonRequestBehavior.AllowGet));
                }
            }
        }
Esempio n. 30
0
        public bool CheckEdit(string EventCode, DateTime startDate, DateTime endDate, int ID)
        {
            bool result = false;

            using (ProjectJobEntities db = new ProjectJobEntities())
            {
                var checkBack = db.Event.Where(x => x.Event_ID != ID);
                if (checkBack.Any(x => x.Event_Code == EventCode && x.Start_Date == startDate && x.End_Date == endDate))
                {
                    if (checkBack.Any(x => x.Start_Date == startDate))
                    {
                        if (checkBack.Any(x => x.End_Date == endDate))
                        {
                            result = true;
                        }
                    }
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }