public ActionResult Create(HttpPostedFileBase file, HttpPostedFileBase file1, [Bind(Include = "Event_ID,Title,Description,IssuedBY,Admin_ID")] EVENT eVENT)
        {
            if (file.ContentLength > 0)
            {
                string filename = Path.GetFileName(file.FileName);
                string filepath = Path.Combine(Server.MapPath("~/EVENT PDF"), filename);
                file.SaveAs(filepath);
                eVENT.FileDirectory = filename;
            }

            if (file1.ContentLength > 0)
            {
                string filename1 = Path.GetFileName(file1.FileName);
                string filepath1 = Path.Combine(Server.MapPath("~/EVENT IMAGES"), filename1);
                file1.SaveAs(filepath1);
                //eVENT.FileDirectory = filename;
                eVENT.ImageDirectory = filename1;
            }



            if (ModelState.IsValid)
            {
                eVENT.AnnouncementDate = System.DateTime.Now;
                db.EVENTs.Add(eVENT);
                db.SaveChanges();
                //  return RedirectToAction("Index");
            }

            ViewBag.Admin_ID = new SelectList(db.ADMINs, "Admin_ID", "AdminName", eVENT.Admin_ID);
            ModelState.Clear();
            ViewBag.Message = "successfully entered";
            return(View());
            //return View(eVENT);
        }
Ejemplo n.º 2
0
        public ActionResult Save(string str, string s)
        {
            List <OilMaterialOrderDetail> od = JsonConvert.DeserializeObject <List <OilMaterialOrderDetail> >(s);
            OilMaterialOrder oi = JsonConvert.DeserializeObject <OilMaterialOrder>(str);

            oi.No            = "YLSQ" + DateTime.Now.ToString("yyyyMMddHHmmssffffff");
            oi.Id            = Guid.NewGuid();
            oi.CreateTime    = DateTime.Now.ToLocalTime();
            oi.ApplyPersonId = (Session["userInfo"] as Staff).Id;
            oi.IsDel         = false;

            osms.OilMaterialOrder.Add(oi);

            foreach (var item in od)
            {
                item.Id         = Guid.NewGuid();
                item.OrderId    = oi.Id;
                item.CreateTime = oi.CreateTime;
                item.IsDel      = false;

                osms.OilMaterialOrderDetail.Add(item);
            }

            int i = osms.SaveChanges();

            if (i > 0)
            {
                return(Content("AddOk"));
            }
            else
            {
                return(Content("NO"));
            }
        }
Ejemplo n.º 3
0
        public ActionResult isdel(Job j)
        {
            Job job = osms.Job.Where(x => x.Id == j.Id).FirstOrDefault();

            UpdateModel(job);
            int a = osms.SaveChanges();

            return(Content(""));
        }
 public ActionResult Create([Bind(Include = "Admin_ID,AdminName,AdminEmail,AdminPassword,AdminContactNumber,AdminAddress")] ADMIN aDMIN)
 {
     if (ModelState.IsValid)
     {
         db.ADMINs.Add(aDMIN);
         db.SaveChanges();
         //  return RedirectToAction("Index");
     }
     ModelState.Clear();
     ViewBag.Message = "successfully registered";
     return(View());
     // return View(aDMIN);
 }
        public ActionResult Create([Bind(Include = "Teacher_ID,TeacherName,TeacherEmail,TeacherPassword,TeacherContactNumber,TeacherAddress,Admin_ID")] TEACHER tEACHER)
        {
            if (ModelState.IsValid)
            {
                db.TEACHERs.Add(tEACHER);
                db.SaveChanges();
                //  return RedirectToAction("Index");
            }

            ViewBag.Admin_ID = new SelectList(db.ADMINs, "Admin_ID", "AdminName", tEACHER.Admin_ID);
            ModelState.Clear();
            ViewBag.Message = "successfully created";
            return(View());
            // return View(tEACHER);
        }
        public ActionResult Create([Bind(Include = "Class_ID,ClassName,TotalSectons,TotalStudents,Admin_ID")] CLASS cLASS)
        {
            if (ModelState.IsValid)
            {
                db.CLASSes.Add(cLASS);
                db.SaveChanges();
                //return RedirectToAction("Index");
            }

            ViewBag.Admin_ID = new SelectList(db.ADMINs, "Admin_ID", "AdminName", cLASS.Admin_ID);
            ModelState.Clear();
            ViewBag.Message = "successfully created";
            return(View());
            // return View(cLASS);
        }
        public ActionResult Create([Bind(Include = "Payment_ID,PaymentAmount,PaymentDate,PaymentMonth")] PAYMENT pAYMENT)
        {
            if (ModelState.IsValid)
            {
                pAYMENT.Student_ID = Convert.ToInt32(Session["StudentId"]);
                db.PAYMENTs.Add(pAYMENT);
                db.SaveChanges();
                //return RedirectToAction("Index");
            }

            ViewBag.Student_ID = new SelectList(db.STUDENTs, "Student_ID", "StudentName", pAYMENT.Student_ID);
            ModelState.Clear();
            ViewBag.Message = "successfully registered";
            return(View());
            // return View(pAYMENT);
        }
Ejemplo n.º 8
0
        public ActionResult editStaffRole(List <Role> r, Guid strid)
        {
            var a = osms.StaffRole.Where(x => x.StaffId == strid).ToList();

            if (a.Count() > 0)
            {
                foreach (var item in a)
                {
                    osms.StaffRole.Remove(item);
                }
            }

            if (r != null)
            {
                foreach (var item in r)
                {
                    StaffRole sro = new StaffRole();
                    sro.id      = Guid.NewGuid();
                    sro.RoleId  = item.Id;
                    sro.StaffId = strid;
                    osms.StaffRole.Add(sro);
                }
            }


            osms.SaveChanges();
            return(Json("OK", JsonRequestBehavior.AllowGet));
        }
        public ActionResult Create([Bind(Include = "Section_ID,SectionName,TotalStudents,Admin_ID,Class_ID,SectionGroup")] SECTION sECTION)
        {
            if (ModelState.IsValid)
            {
                db.SECTIONs.Add(sECTION);
                db.SaveChanges();
                // return RedirectToAction("Index");
            }

            ViewBag.Admin_ID = new SelectList(db.ADMINs, "Admin_ID", "AdminName", sECTION.Admin_ID);
            ViewBag.Class_ID = new SelectList(db.CLASSes, "Class_ID", "ClassName", sECTION.Class_ID);
            ModelState.Clear();
            ViewBag.Message = "successfully created";
            return(View());
            // return View(sECTION);
        }
        public ActionResult Create([Bind(Include = "Review_ID,ReviewDescription")] GUARDIANREVIEW gUARDIANREVIEW)
        {
            if (ModelState.IsValid)
            {
                gUARDIANREVIEW.Guardian_ID = Convert.ToInt32(Session["GuardianId"]);
                db.GUARDIANREVIEWs.Add(gUARDIANREVIEW);
                db.SaveChanges();
                //  return RedirectToAction("Index");
            }

            ViewBag.Guardian_ID = new SelectList(db.GUARDIANs, "Guardian_ID", "GuardianName", gUARDIANREVIEW.Guardian_ID);
            ModelState.Clear();
            ViewBag.Message = "Your review has been sent";
            return(View());
            // return View(gUARDIANREVIEW);
        }
Ejemplo n.º 11
0
        public ActionResult del(Guid strId)
        {
            OrganizationStructure or = osms.OrganizationStructure.Where(x => x.Id == strId).FirstOrDefault();

            osms.Entry <OrganizationStructure>(or).State = System.Data.Entity.EntityState.Modified;
            or.IsDel = true;
            int a = osms.SaveChanges();

            if (a > 0)
            {
                return(Content("OK"));
            }
            else
            {
                return(Content("NO"));
            }
        }
Ejemplo n.º 12
0
        public ActionResult Create([Bind(Include = "Guardian_ID,GuardianName,GuardianEmail,GuardianPassword,GuardianContactNumber,GuardianAddress,Admin_ID,Student_ID")] GUARDIAN gUARDIAN)
        {
            if (ModelState.IsValid)
            {
                db.GUARDIANs.Add(gUARDIAN);
                db.SaveChanges();
                // return RedirectToAction("Index");
            }

            ViewBag.Admin_ID   = new SelectList(db.ADMINs, "Admin_ID", "AdminName", gUARDIAN.Admin_ID);
            ViewBag.Student_ID = new SelectList(db.STUDENTs, "Student_ID", "StudentName", gUARDIAN.Student_ID);

            ModelState.Clear();
            ViewBag.Message = "successfully created";
            return(View());
            //   return View(gUARDIAN);
        }
Ejemplo n.º 13
0
        public ActionResult Create([Bind(Include = "Student_ID,StudentName,StudentEmail,StudentPassword,StudentContactNumber,StudentAddress,Admin_ID,Class_ID,Section_ID")] STUDENT sTUDENT)
        {
            if (ModelState.IsValid)
            {
                db.STUDENTs.Add(sTUDENT);
                db.SaveChanges();
                //   return RedirectToAction("Index");
            }

            ViewBag.Admin_ID   = new SelectList(db.ADMINs, "Admin_ID", "AdminName", sTUDENT.Admin_ID);
            ViewBag.Class_ID   = new SelectList(db.CLASSes, "Class_ID", "ClassName", sTUDENT.Class_ID);
            ViewBag.Section_ID = new SelectList(db.SECTIONs, "Section_ID", "SectionName", sTUDENT.Section_ID);

            ModelState.Clear();
            ViewBag.Message = "successfully added";
            return(View());
            //   return View(sTUDENT);
        }
Ejemplo n.º 14
0
        public ActionResult Create([Bind(Include = "Subject_ID,SubjectName,Class_ID,Teacher_ID,Admin_ID")] SUBJECT sUBJECT)
        {
            if (ModelState.IsValid)
            {
                db.SUBJECTs.Add(sUBJECT);
                db.SaveChanges();
                //  return RedirectToAction("Index");
            }

            ViewBag.Admin_ID   = new SelectList(db.ADMINs, "Admin_ID", "AdminName", sUBJECT.Admin_ID);
            ViewBag.Class_ID   = new SelectList(db.CLASSes, "Class_ID", "ClassName", sUBJECT.Class_ID);
            ViewBag.Teacher_ID = new SelectList(db.TEACHERs, "Teacher_ID", "TeacherName", sUBJECT.Teacher_ID);

            ModelState.Clear();
            ViewBag.Message = "successfully created";
            return(View());
            // return View(sUBJECT);
        }
Ejemplo n.º 15
0
        public ActionResult Create([Bind(Include = "Result_ID,ExamDate,MarksObtained,Grade,Student_ID,Class_ID,Section_ID,Subject_ID,Teacher_ID,Admin_ID")] RESULT rESULT)
        {
            if (ModelState.IsValid)
            {
                db.RESULTs.Add(rESULT);
                db.SaveChanges();
                //   return RedirectToAction("Index");
            }

            ViewBag.Admin_ID   = new SelectList(db.ADMINs, "Admin_ID", "AdminName", rESULT.Admin_ID);
            ViewBag.Class_ID   = new SelectList(db.CLASSes, "Class_ID", "ClassName", rESULT.Class_ID);
            ViewBag.Section_ID = new SelectList(db.SECTIONs, "Section_ID", "SectionName", rESULT.Section_ID);
            ViewBag.Student_ID = new SelectList(db.STUDENTs, "Student_ID", "StudentName", rESULT.Student_ID);
            ViewBag.Subject_ID = new SelectList(db.SUBJECTs, "Subject_ID", "SubjectName", rESULT.Subject_ID);
            ViewBag.Teacher_ID = new SelectList(db.TEACHERs, "Teacher_ID", "TeacherName", rESULT.Teacher_ID);

            ModelState.Clear();
            ViewBag.Message = "successfully added";
            return(View());
            //    return View(rESULT);
        }
Ejemplo n.º 16
0
        public ActionResult Create([Bind(Include = "Attendance_ID,Attendance_Date,Attendance_Status,Student_ID,Class_ID,Section_ID,Subject_ID,Teacher_ID,Admin_ID")] ATTENDANCE aTTENDANCE)
        {
            if (ModelState.IsValid)
            {
                db.ATTENDANCEs.Add(aTTENDANCE);
                db.SaveChanges();
                // return RedirectToAction("Index");
            }


            ViewBag.Admin_ID   = new SelectList(db.ADMINs, "Admin_ID", "AdminName", aTTENDANCE.Admin_ID);
            ViewBag.Class_ID   = new SelectList(db.CLASSes, "Class_ID", "ClassName", aTTENDANCE.Class_ID);
            ViewBag.Section_ID = new SelectList(db.SECTIONs, "Section_ID", "SectionName", aTTENDANCE.Section_ID);
            ViewBag.Student_ID = new SelectList(db.STUDENTs, "Student_ID", "StudentName", aTTENDANCE.Student_ID);
            ViewBag.Subject_ID = new SelectList(db.SUBJECTs, "Subject_ID", "SubjectName", aTTENDANCE.Subject_ID);
            ViewBag.Teacher_ID = new SelectList(db.TEACHERs, "Teacher_ID", "TeacherName", aTTENDANCE.Teacher_ID);

            ModelState.Clear();
            ViewBag.Message = "successfully created";
            return(View());
            // return View(aTTENDANCE);
        }
Ejemplo n.º 17
0
        public ActionResult upApprover(Guid strid)
        {
            Approver a = osms.Approver.Where(x => x.Id == strid).FirstOrDefault();
            Approver b = osms.Approver.Where(x => x.ProcessItemId == a.ProcessItemId & x.Order == (a.Order - 1)).FirstOrDefault();

            osms.Entry(a).State = System.Data.Entity.EntityState.Modified;
            osms.Entry(b).State = System.Data.Entity.EntityState.Modified;

            a.Order = a.Order - 1;
            b.Order = b.Order + 1;

            int l = osms.SaveChanges();

            if (l > 0)
            {
                return(Content("OK"));
            }
            else
            {
                return(Content("NO"));
            }
        }
Ejemplo n.º 18
0
        public ActionResult start(OilMaterialOrder oi, Guid?p_id)
        {
            //var list = (from a in osms.ProcessStepRecord join b in osms.Staff on a.WaitForExecutionStaffId equals b.Id join c in osms.Job on b.JobId equals c.Id join d in osms.OrganizationStructure on b.OrgID equals d.Id where a.RefOrderId == strRefOrderId orderby a.StepOrder select new { Result = a.Result, WhetherToExecute = a.WhetherToExecute, uName = b.Name, JobName = c.Name, OrgName = d.Name }).ToList();
            var ap = osms.Approver.Where(x => x.ProcessItemId == p_id).ToList();

            Staff sta = osms.Staff.Where(x => x.Id == oi.ApplyPersonId).FirstOrDefault();

            //获取机构
            List <Guid?> listOrg = new List <Guid?>();

            listOrg.Add(sta.OrgID);
            selorg(sta.OrgID, ref listOrg);

            foreach (var item in ap)
            {
                var s = (from a in osms.Staff
                         join b in osms.Job
                         on a.JobId equals b.Id
                         where (listOrg.Contains(a.OrgID)) && b.Code == item.JobCode
                         select new
                {
                    WaitForExecutionStaffId = a.Id
                }).FirstOrDefault();

                ProcessStepRecord psr = new ProcessStepRecord();
                psr.Id         = Guid.NewGuid();
                psr.StepOrder  = item.Order;
                psr.CreateTime = DateTime.Now.ToLocalTime();
                psr.UpdateTime = DateTime.Now.ToLocalTime();
                psr.WaitForExecutionStaffId = s.WaitForExecutionStaffId;
                psr.WhetherToExecute        = false;
                psr.No         = oi.No;
                psr.RefOrderId = oi.Id;
                psr.Result     = false;
                psr.Type       = (osms.ProcessItem.Where(x => x.Id == p_id).FirstOrDefault()).Code;
                psr.Discrible  = "未审批";

                osms.ProcessStepRecord.Add(psr);
            }

            int i = osms.SaveChanges();

            if (i > 0)
            {
                return(Content("OK"));
            }
            else
            {
                return(Content("NO"));
            }
        }
        public ActionResult Create(HttpPostedFileBase file, [Bind(Include = "ClassRoutine_ID,Class_ID,Section_ID,Admin_ID")] CLASSROUTINE cLASSROUTINE)
        {
            if (file.ContentLength > 0)
            {
                string filename = Path.GetFileName(file.FileName);
                string filepath = Path.Combine(Server.MapPath("~/CLASS ROUTINE FILES"), filename);
                file.SaveAs(filepath);
                cLASSROUTINE.ClassRoutineDirectory = filename;
            }

            if (ModelState.IsValid)
            {
                db.CLASSROUTINEs.Add(cLASSROUTINE);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Admin_ID   = new SelectList(db.ADMINs, "Admin_ID", "AdminName", cLASSROUTINE.Admin_ID);
            ViewBag.Class_ID   = new SelectList(db.CLASSes, "Class_ID", "ClassName", cLASSROUTINE.Class_ID);
            ViewBag.Section_ID = new SelectList(db.SECTIONs, "Section_ID", "SectionName", cLASSROUTINE.Section_ID);
            ViewBag.Message    = "successfully created";

            return(View(cLASSROUTINE));
        }
Ejemplo n.º 20
0
        public ActionResult Create(HttpPostedFileBase file, [Bind(Include = "TeacherRoutine_ID,Teacher_ID,Admin_ID")] TEACHER_ROUTINE tEACHER_ROUTINE)
        {
            if (file.ContentLength > 0)
            {
                string filename = Path.GetFileName(file.FileName);
                string filepath = Path.Combine(Server.MapPath("~/TEACHER ROUTINE"), filename);
                file.SaveAs(filepath);
                tEACHER_ROUTINE.TeacherRoutineDirectory = filename;
            }
            if (ModelState.IsValid)
            {
                db.TEACHER_ROUTINE.Add(tEACHER_ROUTINE);
                db.SaveChanges();
                //   return RedirectToAction("Index");
            }

            ViewBag.Admin_ID   = new SelectList(db.ADMINs, "Admin_ID", "AdminName", tEACHER_ROUTINE.Admin_ID);
            ViewBag.Teacher_ID = new SelectList(db.TEACHERs, "Teacher_ID", "TeacherName", tEACHER_ROUTINE.Teacher_ID);
            ModelState.Clear();
            ViewBag.Message = "successfully created";
            return(View());

            //  return View(tEACHER_ROUTINE);
        }