Exemplo n.º 1
0
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HRMS_Training_Request_Application hRMS_Training_Request_Application = db.HRMS_Training_Request_Application.Find(id);
            var user = Convert.ToInt64(Session["id"]);
            HRMS_Emp_Details employeedetail = db.HRMS_Emp_Details.Where(rec => rec.EMP_ID == hRMS_Training_Request_Application.EmpID).FirstOrDefault();

            hRMS_Training_Request_Application.EmployeeName  = employeedetail.Display_Name;
            hRMS_Training_Request_Application.ApprovedBy_ID = user;
            hRMS_Training_Request_Application.ApprovedDate  = DateTime.Now;
            if (hRMS_Training_Request_Application == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Department  = db.HRMS_DEPT.Where(rec => rec.Parent_ID != null && rec.IsActive == true);
            ViewBag.Designation = db.HRMS_DESG_MS.Where(rec => rec.IsActive == true);
            //ViewBag.Skill = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name");
            //ViewBag.EmpID = new SelectList(db.Accounts, "ID", "UserName", hRMS_Training_Request_Application.EmpID);
            //ViewBag.ApprovedBy_ID = new SelectList(db.Accounts, "ID", "UserName", hRMS_Training_Request_Application.ApprovedBy_ID);
            //ViewBag.DepartmentId = new SelectList(db.HRMS_DEPT, "Dept_Id", "Dept_Name", hRMS_Training_Request_Application.DepartmentId);
            //ViewBag.designationID = new SelectList(db.HRMS_DESG_MS, "Desg_Id", "Desg_Name", hRMS_Training_Request_Application.designationID);
            ViewBag.Skill = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name", hRMS_Training_Request_Application.Skill);
            return(View(hRMS_Training_Request_Application));
        }
Exemplo n.º 2
0
        //[ValidateAntiForgeryToken]
        public JsonResult Create(TrainingProgramCommon hRMS_ProgramDetail)
        {
            HRMS_ProgramDetail obj = hRMS_ProgramDetail.ProDetail;

            if (obj.ToDate < obj.FromDate)
            {
                var msg = "ToDate must be greater than FromDate!";
                return(Json(msg, JsonRequestBehavior.AllowGet));
            }
            else
            {
                db.HRMS_ProgramDetail.Add(obj);
                db.SaveChanges();
                ViewBag.msg = "Program Added Succesfully! Now Add Faculty!";
                var ID = db.HRMS_ProgramDetail.Where(x => x.TrainingID == obj.TrainingID).Select(x => x.ID).FirstOrDefault();

                //update in training request table (programFlag)
                HRMS_Training_Request_Application req = db.HRMS_Training_Request_Application.Find(obj.TrainingID);
                req.ProgramFlag     = 1; //admin can only edit program detail
                db.Entry(req).State = EntityState.Modified;
                db.SaveChanges();


                return(Json(ID, JsonRequestBehavior.AllowGet));
                //return RedirectToAction("Index");
            }
        }
Exemplo n.º 3
0
        // GET: RequestApplication/Details/5
        public ActionResult Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HRMS_Training_Request_Application hRMS_Training_Request_Application = db.HRMS_Training_Request_Application.Find(id);

            if (hRMS_Training_Request_Application == null)
            {
                return(HttpNotFound());
            }
            return(View(hRMS_Training_Request_Application));
        }
Exemplo n.º 4
0
        public ActionResult RemoveApplication(long id)
        {
            HRMS_Training_Request_Application hRMS_Training_Request_Application = db.HRMS_Training_Request_Application.Find(id);

            if (hRMS_Training_Request_Application.Status == 0)
            {
                db.HRMS_Training_Request_Application.Remove(hRMS_Training_Request_Application);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            else
            {
                ViewBag.RequestApplicationStatus = "You can only remove panding applications";

                return(RedirectToAction("Index"));
            }
        }
Exemplo n.º 5
0
        public ActionResult Create([Bind(Include = "ApplicationId,request_date,EmpID,designationID,DepartmentId,Training_Name,TrainingDetails,ApprovedDate,Status,ApprovedBy_ID,Approved_Remarks,Skill")] HRMS_Training_Request_Application hRMS_Training_Request_Application)
        {
            long             emp_id         = Convert.ToInt64(Session["id"]);
            HRMS_Emp_Details employeedetail = db.HRMS_Emp_Details.Where(rec => rec.EMP_ID == emp_id).FirstOrDefault();

            hRMS_Training_Request_Application.EmployeeName  = employeedetail.Display_Name;
            hRMS_Training_Request_Application.designationID = employeedetail.Designation;
            hRMS_Training_Request_Application.DepartmentId  = employeedetail.Department;

            if (ModelState.IsValid)
            {
                var existTrainingName = db.HRMS_Training_Request_Application.Where(rec => rec.Training_Name == hRMS_Training_Request_Application.Training_Name && rec.EmpID == hRMS_Training_Request_Application.EmpID).FirstOrDefault();
                if (existTrainingName == null)
                {
                    hRMS_Training_Request_Application.Status = 0;

                    db.HRMS_Training_Request_Application.Add(hRMS_Training_Request_Application);
                    db.SaveChanges();
                    ViewBag.RequestStatus = "Training Request is Added successfully.";
                    ViewBag.Department    = db.HRMS_DEPT.Where(rec => rec.Parent_ID != null && rec.IsActive == true);
                    ViewBag.Designation   = db.HRMS_DESG_MS.Where(rec => rec.IsActive == true);
                    ViewBag.Skill         = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name");
                    return(View());
                }
                else
                {
                    ViewBag.RequestStatus = "This Training Request is already exist!";
                    ViewBag.Department    = db.HRMS_DEPT.Where(rec => rec.Parent_ID != null && rec.IsActive == true);
                    ViewBag.Designation   = db.HRMS_DESG_MS.Where(rec => rec.IsActive == true);
                    ViewBag.Skill         = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name");
                    return(View());
                }
            }

            //ViewBag.EmpID = new SelectList(db.Accounts, "ID", "UserName", hRMS_Training_Request_Application.EmpID);
            //ViewBag.ApprovedBy_ID = new SelectList(db.Accounts, "ID", "UserName", hRMS_Training_Request_Application.ApprovedBy_ID);
            //ViewBag.DepartmentId = new SelectList(db.HRMS_DEPT, "Dept_Id", "Dept_Name", hRMS_Training_Request_Application.DepartmentId);
            //ViewBag.designationID = new SelectList(db.HRMS_DESG_MS, "Desg_Id", "Desg_Name", hRMS_Training_Request_Application.designationID);
            //ViewBag.Skill = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name", hRMS_Training_Request_Application.Skill);
            ViewBag.Department  = db.HRMS_DEPT.Where(rec => rec.Parent_ID != null && rec.IsActive == true);
            ViewBag.Designation = db.HRMS_DESG_MS.Where(rec => rec.IsActive == true);
            ViewBag.Skill       = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name");
            return(View(hRMS_Training_Request_Application));
        }
Exemplo n.º 6
0
        public ActionResult Create()
        {
            long userId = Convert.ToInt64(Session["id"]);
            HRMS_Training_Request_Application Request_Application = new HRMS_Training_Request_Application();
            HRMS_Emp_Details Emp_Details = db.HRMS_Emp_Details.FirstOrDefault(rec => rec.EMP_ID == userId);

            Request_Application.EmpID         = userId;
            Request_Application.DepartmentId  = Emp_Details.Department;
            Request_Application.designationID = Emp_Details.Designation;
            Request_Application.request_date  = DateTime.Now.Date;
            Request_Application.EmployeeName  = Emp_Details.Display_Name;
            //ViewBag.EmpID = new SelectList(db.Accounts, "ID", "UserName");
            //ViewBag.ApprovedBy_ID = new SelectList(db.Accounts, "ID", "UserName");
            ViewBag.Department  = db.HRMS_DEPT.Where(rec => rec.Parent_ID != null && rec.IsActive == true);
            ViewBag.Designation = db.HRMS_DESG_MS.Where(rec => rec.IsActive == true);

            ViewBag.Skill = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name");
            return(View(Request_Application));
        }
Exemplo n.º 7
0
        //[ValidateAntiForgeryToken]
        public JsonResult Edit(TrainingProgramCommon hRMS_ProgramDetail)
        {
            HRMS_ProgramDetail obj = hRMS_ProgramDetail.ProDetail;

            if (obj.Extra == "Hello")
            {
                var msg = "Sorry";
                return(Json(msg, JsonRequestBehavior.AllowGet));
            }

            if (obj.ToDate < obj.FromDate)
            {
                var msg = "ToDate must be greater than FromDate!";
                return(Json(msg, JsonRequestBehavior.AllowGet));
            }
            else
            {
                if (obj.TrainingStatus == "Completed")
                {
                    HRMS_Training_Request_Application req = db.HRMS_Training_Request_Application.Where(x => x.ApplicationId == obj.TrainingID).FirstOrDefault();
                    req.ProgramFlag     = 2; //completed
                    db.Entry(req).State = EntityState.Modified;
                    db.SaveChanges();
                }

                if (obj.TrainingStatus == "Cancel")
                {
                    HRMS_Training_Request_Application req = db.HRMS_Training_Request_Application.Where(x => x.ApplicationId == obj.TrainingID).FirstOrDefault();
                    req.ProgramFlag     = 3; //Cancel
                    db.Entry(req).State = EntityState.Modified;
                    db.SaveChanges();
                }

                db.Entry(obj).State = EntityState.Modified;
                db.SaveChanges();
                var msg = "Done";
                return(Json(msg, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 8
0
        public ActionResult Edit([Bind(Include = "ApplicationId,request_date,EmpID,designationID,DepartmentId,Training_Name,TrainingDetails,ApprovedDate,Status,ApprovedBy_ID,Approved_Remarks,Skill")] HRMS_Training_Request_Application hRMS_Training_Request_Application)
        {
            HRMS_Emp_Details employeedetail = db.HRMS_Emp_Details.Where(rec => rec.EMP_ID == hRMS_Training_Request_Application.EmpID).FirstOrDefault();

            hRMS_Training_Request_Application.EmployeeName  = employeedetail.Display_Name;
            hRMS_Training_Request_Application.designationID = employeedetail.Designation;
            hRMS_Training_Request_Application.DepartmentId  = employeedetail.Department;

            if (ModelState.IsValid)
            {
                db.Entry(hRMS_Training_Request_Application).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            //ViewBag.EmpID = new SelectList(db.Accounts, "ID", "UserName", hRMS_Training_Request_Application.EmpID);
            //ViewBag.ApprovedBy_ID = new SelectList(db.Accounts, "ID", "UserName", hRMS_Training_Request_Application.ApprovedBy_ID);
            //ViewBag.DepartmentId = new SelectList(db.HRMS_DEPT, "Dept_Id", "Dept_Name", hRMS_Training_Request_Application.DepartmentId);
            //ViewBag.designationID = new SelectList(db.HRMS_DESG_MS, "Desg_Id", "Desg_Name", hRMS_Training_Request_Application.designationID);
            //ViewBag.Skill = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name", hRMS_Training_Request_Application.Skill);
            // ViewBag.Department = db.HRMS_DEPT.Where(rec => rec.Parent_ID != null && rec.IsActive == true);
            // ViewBag.Designation = db.HRMS_DESG_MS.Where(rec => rec.IsActive == true);
            //ViewBag.Skill = new SelectList(db.HRMS_TRAINING_SKILL_MS, "Skill_ID", "Skill_Name", hRMS_Training_Request_Application.Skill);
            return(RedirectToAction("Index"));
        }