Esempio n. 1
0
        public ActionResult PresidentSchDoc(PresidentSchProp pr, string part1, string part2, string part3, string part4)
        {
            if (ModelState.IsValid)
            {
                string x = part1 + part2 + part3 + part4;

                pr.bankAccountNmb = x;
                pr.docState       = DocState.sended;
                pr.student        = db.Student.Find(getUser().student.StudentID);
                db.PresidentSchProp.Add(pr);
                db.ForPresidentSchProp.Add(pr.table);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View());
        }
Esempio n. 2
0
        public ActionResult PresidentSchDoc()
        {
            var query2 = from dates in db.Dates where dates.what == Document.rektorski where dates.importantdate == true select dates;

            List <Dates> ListDates = query2.ToList();

            ViewBag.dateCheck = true;
            if (ListDates.Count > 0)
            {
                DateTime dt3 = DateTime.Now;
                DateTime dt1 = Convert.ToDateTime(ListDates.ElementAt(0).startdate);
                DateTime dt2 = Convert.ToDateTime(ListDates.ElementAt(0).enddate);

                if (dt1.Date <= dt3.Date && dt3.Date <= dt2.Date)
                {
                    ViewBag.dateCheck = false;
                }
            }
            else
            {
                ViewBag.dateCheck = false;
            }


            PresidentSchProp pr = new PresidentSchProp();

            ApplicationUser user = getUser();

            ViewBag.isSended = false;

            if (user.student != null)
            {
                int id = user.student.StudentID;

                var props = from docs in db.PresidentSchProp where docs.student.StudentID == id select docs;

                if (props.Any())
                {
                    ViewBag.isSended = true;
                    return(View(props.First()));
                }
            }
            return(View(pr));
        }