Beispiel #1
0
        public ActionResult Index()
        {
            ITarget target = new Adapterr.Adapterr();

            Session["Exams"] = target.SafeData();
            return(View());
        }
        public ActionResult Index(Exam objUser)
        {
            if (Session["Login"] != null)
            {
                CalendarViewModel calendarViewModel2 = new CalendarViewModel {
                    date = DateTime.Now, objUser = objUser
                };
                ITarget         target   = new Adapterr.Adapterr();
                Receiver        receiver = new Receiver();
                Command.Command command  = new ConcreteCommand(receiver);
                Invoker         invoker  = new Invoker();
                invoker.SetCommand(command);
                invoker.AddExam(objUser, int.Parse((string)Session["ID"]));
                try
                {
                    Session["Exams"] = target.SafeData(DateTime.Now.Month + "-" + DateTime.Now.Year, int.Parse((string)Session["ID"]));
                }
                catch (Exception e)
                {
                    Session["LogSub"] = e.Message;
                }
                return(View(calendarViewModel2));
            }
            CalendarViewModel calendarViewModel = new CalendarViewModel {
                date = DateTime.Now, objUser = null
            };

            return(View(calendarViewModel));
        }
        public ActionResult Index()
        {
            if (Session["Login"] != null)
            {
                ITarget target = new Adapterr.Adapterr();
                try
                {
                    Session["Exams"] = target.SafeData(DateTime.Now.Month + "-" + DateTime.Now.Year, int.Parse((string)Session["ID"]));
                }
                catch (Exception e)
                {
                    Session["LogSub"] = e.Message;
                }
            }
            CalendarViewModel calendarViewModel = new CalendarViewModel {
                date = DateTime.Now, objUser = null
            };

            return(View(calendarViewModel));
        }
Beispiel #4
0
        public ActionResult Index(User objUser)
        {
            Data.Singleton.Singleton singleton = Data.Singleton.Singleton.Instance;
            User obj = singleton.Subject(objUser);

            if (obj != null)
            {
                IClient permission = new Factory().Run(obj.Flag);
                ViewBag.Message = permission.GetName();
                ITarget target = new Adapterr.Adapterr();

                Session["ID"]     = obj.ID.ToString();
                Session["ECTS"]   = obj.ECTS;
                Session["Login"]  = obj.Login.ToString();
                Session["LogSub"] = SendMessage.Main(obj.ID);
                Session["Exams"]  = target.SafeData(DateTime.Now.Month + "-" + DateTime.Now.Year, int.Parse((string)Session["ID"]));

                return(View());
            }


            return(View(objUser));
        }
Beispiel #5
0
        public ActionResult Autherize(User user)
        {
            using (SimpleDataBase db = new SimpleDataBase())
            {
                User userDetails = null;
                var  users       = db.User.Where(u => u.Login == user.Login && u.Hash == user.Hash);
                if (users != null && users.Count() != 0)
                {
                    userDetails = users.First();
                }
                if (userDetails == null)
                {
                    user.LoginErrorMessage = "Wrong login or password";
                    Console.WriteLine("QQQQ");
                    return(View("Index", user));
                }
                else
                {
                    user.LoginErrorMessage = "";
                    Data.Singleton.Singleton singleton = Data.Singleton.Singleton.Instance;
                    User obj = singleton.Subject(user);
                    if (obj != null)
                    {
                        IClient permission = new Factory().Run(obj.Flag);
                        Session["LoginAs"] = permission.GetName();
                        ITarget target = new Adapterr.Adapterr();

                        Session["ID"]     = obj.ID.ToString();
                        Session["ECTS"]   = obj.ECTS;
                        Session["Login"]  = obj.Login.ToString();
                        Session["LogSub"] = SendMessage.Main(obj.ID);
                        Session["Exams"]  = target.SafeData(DateTime.Now.Month + "-" + DateTime.Now.Year, int.Parse((string)Session["ID"]));
                    }
                    return(RedirectToAction("Index", "Home"));
                }
            }
        }