Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "Subject_Id,Subject_Name")] Subject subject)
        {
            LogManager.createlog("create", subject.ToString());
            if (ModelState.IsValid)
            {
                db.Subject.Add(subject);
                try {
                    db.SaveChanges();
                }
                catch (DbEntityValidationException e)
                {
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                          eve.Entry.Entity.GetType().Name, eve.Entry.State);
                        foreach (var ve in eve.ValidationErrors)
                        {
                            Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                              ve.PropertyName, ve.ErrorMessage);
                        }
                    }
                }
                return(RedirectToAction("Index"));
            }

            return(View(subject));
        }
        public ActionResult Create([Bind(Include = "Account_Id,Login,Password,Account_Type")] Account account)
        {
            if (ModelState.IsValid)
            {
                LogManager.createlog("create", account.ToString());
                db.Account.Add(account);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(account));
        }
        public ActionResult Create([Bind(Include = "Class_Room_Number,Employee_Id,Size,Subject_Id,Equipment_Description")] Class_Room class_Room)
        {
            LogManager.createlog("create", class_Room.ToString());
            if (ModelState.IsValid)
            {
                db.Class_Room.Add(class_Room);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Employee_Id = new SelectList(db.Employee, "Employee_ID", "First_Name", class_Room.Employee_Id);
            return(View(class_Room));
        }
Ejemplo n.º 4
0
        public ActionResult Create([Bind(Include = "Employee_ID,First_Name,Middle_Name,Surname,Pesel_Number,Telefon_Number,Account_Id,Hire_Date,Birth_Date,Adress")] Employee employee)
        {
            LogManager.createlog("create", employee.ToString());
            if (ModelState.IsValid)
            {
                db.Employee.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Account_Id = new SelectList(db.Account, "Account_Id", "Login", employee.Account_Id);
            return(View(employee));
        }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "Event_Id,Employee_Id,Start_Time,Duration_In_Days,Describe,Account_Group")] Event @event)
        {
            LogManager.createlog("create", @event.ToString());
            if (ModelState.IsValid)
            {
                db.Event.Add(@event);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Employee_Id = new SelectList(db.Employee, "Employee_Id", "First_Name", @event.Employee_Id);
            return(View(@event));
        }
Ejemplo n.º 6
0
        public ActionResult Create([Bind(Include = "Legal_Guardian_Id,First_Name,Middle_Name,Surname,Telefon_Number,Account_Id,Adress")] Legal_Guardian legal_Guardian)
        {
            LogManager.createlog("create", legal_Guardian.ToString());
            if (ModelState.IsValid)
            {
                db.Legal_Guardian.Add(legal_Guardian);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Account_Id = new SelectList(db.Account, "Account_Id", "Login", legal_Guardian.Account_Id);
            return(View(legal_Guardian));
        }
        public ActionResult Create([Bind(Include = "Class_Number,Profile,Employee_Id")] School_Class school_Class)
        {
            LogManager.createlog("create", school_Class.ToString());
            if (ModelState.IsValid)
            {
                db.School_Class.Add(school_Class);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Employee_Id  = new SelectList(db.Employee, "Employee_ID", "First_Name", school_Class.Employee_Id);
            ViewBag.Class_Number = new SelectList(db.Lesson, "Class_Number", "Subject_Name", school_Class.Class_Number);
            return(View(school_Class));
        }
Ejemplo n.º 8
0
        public ActionResult Create([Bind(Include = "Note_Id,Pupil_Id,Employee_Id,Note_Date,Positve,Describe")] Note note)
        {
            LogManager.createlog("create", note.ToString());
            if (ModelState.IsValid)
            {
                db.Note.Add(note);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.Employee_Id = new SelectList(db.Employee, "Employee_ID", "Surname", note.Employee_Id);
            ViewBag.Pupil_Id = new SelectList(db.Pupil, "Pupil_Id", "Surname", note.Pupil_Id);
            return View(note);
        }
Ejemplo n.º 9
0
        public ActionResult Create([Bind(Include = "Pupil_Id,First_Name,Middle_Name,Surname,Pesel_Number,Legal_Guardian_Id,Birth_Date,School_Id_Card_Number,Account_Id,Class_Number")] Pupil pupil)
        {
            LogManager.createlog("create", pupil.ToString());
            if (ModelState.IsValid)
            {
                db.Pupil.Add(pupil);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Account_Id        = new SelectList(db.Account, "Account_Id", "Login", pupil.Account_Id);
            ViewBag.Legal_Guardian_Id = new SelectList(db.Legal_Guardian, "Legal_Guardian_Id", "First_Name", pupil.Legal_Guardian_Id);
            ViewBag.Class_Number      = new SelectList(db.School_Class, "Class_Number", "Profile", pupil.Class_Number);
            return(View(pupil));
        }
Ejemplo n.º 10
0
        public ActionResult Create([Bind(Include = "Lesson_Id,Class_Number,Subject_Id,Employee_Id,Day_Of_Week,Start_Time,Class_Room_Number")] Lesson lesson)
        {
            LogManager.createlog("create", lesson.ToString());
            if (ModelState.IsValid)
            {
                db.Lesson.Add(lesson);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Class_Room_Number = new SelectList(db.Class_Room, "Class_Room_Number", "Class_Room_Number", lesson.Class_Room_Number);
            ViewBag.Employee_Id       = new SelectList(db.Employee, "Employee_ID", "First_Name", lesson.Employee_Id);
            ViewBag.Class_Number      = new SelectList(db.School_Class, "Class_Number", "Profile", lesson.Class_Number);
            ViewBag.Subject_Id        = new SelectList(db.Subject, "Subject_Id", "Subject_Name", lesson.Subject_Id);
            return(View(lesson));
        }
Ejemplo n.º 11
0
        public ActionResult Create([Bind(Include = "Mark_Id,Value,Weight,Pupil_Id,Employee_Id,Subject_Id,Describe,Mark_Date")] Mark mark)
        {
            Mark accountTemp = db.Mark.Find(mark.Mark_Id);

            LogManager.createlog("Edit", accountTemp.ToString());
            LogManager.createlog("create", mark.ToString());
            if (ModelState.IsValid)
            {
                db.Mark.Add(mark);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Employee_Id = new SelectList(db.Employee, "Employee_ID", "First_Name", mark.Employee_Id);
            ViewBag.Subject_Id  = new SelectList(db.Subject, "Subject_Id", "Subject_Name", mark.Subject_Id);
            ViewBag.Pupil_Id    = new SelectList(db.Pupil, "Pupil_Id", "First_Name", mark.Pupil_Id);
            return(View(mark));
        }
 public ActionResult AddMarks(int[] Id, String[] Value, String[] Weight, String[] Description, String Subject1)
 {
     if (Id == null && Subject1 == null)
     {
         sub = null;
     }
     if (Subject1 != null)
     {
         sub = Subject1;
     }
     Console.WriteLine();
     if (Id == null)
     {
         Id = new int[0];
     }
     for (int i = 0; i < Id.Length; i++)
     {
         if (sub != null && Value[i] != "" && Weight[i] != "")
         {
             Mark mark = new Mark();
             mark.Describe    = Description[i];
             mark.Value       = int.Parse(Value[i]);
             mark.Weight      = decimal.Parse(Weight[i].Replace('.', ','));
             mark.Pupil_Id    = Id[i];
             mark.Mark_Date   = DateTime.Now;
             mark.Employee_Id = PersonAccount.GetEmployeeFromAccountId().Employee_Id;
             mark.Subject_Id  = db.Subject.Where(a => a.Subject_Name.Equals(sub)).ToList().ElementAt(0).Subject_Id;
             db.Mark.Add(mark);
             db.SaveChanges();
             LogManager.createlog("create", mark.ToString());
         }
     }
     ViewBag.Class_Name = db.School_Class.ToList();
     ViewBag.Subjects   = db.Subject.Select(a => a.Subject_Name).ToList();
     return(View());
 }