Ejemplo n.º 1
0
        public ActionResult Details(int skillid)
        {
            DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();

            DSRCManagementSystem.Models.Skills ObjLD = new DSRCManagementSystem.Models.Skills();

            var Details = (from s in db.Skills
                           join ms in db.SkillsTechnologies on s.Technology equals ms.SkillId
                           join u in db.Users on s.ApprovedBy equals u.UserID
                           where s.Id == skillid

                           select new Skills()
            {
                ApprovedName = u.FirstName + " " + ((u.LastName).Length > 0? u.LastName:" "),       // s.User.Firstname_lastname
                ApprovedDate = s.ApprovedDate
            }).FirstOrDefault();


            return(View(Details));
        }
Ejemplo n.º 2
0
        public ActionResult EmployeeSkills(Skills model)
        {
            DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();
            Skills obj       = new Skills();
            var    TechList  = db.SkillsTechnologies.Where(x => x.IsActive == true).ToList();
            var    LevelList = db.Master_TrainingLevel.ToList();
            var    yearlist  = db.Master_years.OrderByDescending(x => x.year).ToList();

            string[] l = new string[LevelList.Count];
            for (int j = 0; j < LevelList.Count; j++)
            {
                l[j] = LevelList[j].LevelName;
            }

            string[] t = new string[TechList.Count];

            for (int k = 0; k < TechList.Count; k++)
            {
                t[k] = TechList[k].SkillName;
            }

            string[] y = new string[yearlist.Count];
            for (int i = 0; i < yearlist.Count; i++)
            {
                // y[i] = yearlist[i].year1.ToString();
                y[i] = yearlist[i].year.ToString();
            }

            DSRCManagementSystem.Models.Skills ObjLD = new DSRCManagementSystem.Models.Skills();
            ModelState.Clear();

            skilllist     sk       = new skilllist();
            List <Skills> skl      = new List <Skills>();
            List <Skills> userSkl  = new List <Skills>();
            List <Skills> userSkl1 = new List <Skills>();
            Skills        lModel   = new Skills();

            int userId = Convert.ToInt32(Session["UserID"]);

            var users = (from c in db.UserReportings
                         join b in db.Users on c.UserID equals b.UserID
                         where c.ReportingUserID == userId
                         select new
            {
                Name = b.FirstName + " " + (b.LastName ?? " "),
                id = c.UserID
            }).OrderBy(o => o.Name).ToList();

            var requestStatus = (from rs in db.Master_SkillStatus
                                 select new
            {
                RequestStatusId = rs.AssessmentStatusID,
                RequestStatus = rs.AssessmentStatus
            }).ToList();

            ViewBag.requestStatus = new SelectList(requestStatus, "RequestStatusId", "RequestStatus", model.RequestStatusId);
            ViewBag.UsersREP      = new SelectList(users, "id", "Name", model.UserId);

            List <Skills> modelObj = new List <Skills>();

            //var skillSet
            modelObj = (from s in db.Skills
                        join ms in db.SkillsTechnologies on s.Technology equals ms.SkillId
                        join tl in db.Master_TrainingLevel on s.Level equals tl.LevelId
                        join ss in db.SkillsSpecifications on s.Specialization equals ss.SpecificationId
                        join ur in db.UserReportings on s.UserId equals ur.UserID
                        join u in db.Users on s.UserId equals u.UserID
                        where ur.ReportingUserID == userId
                        select new Skills()
            {
                Id = s.Id,
                UserId = u.UserID,
                UName = u.FirstName + " " + (u.LastName ?? ""),
                TechnologyID = s.Technology,
                Technology = ms.SkillName,
                SpecificationId = s.Specialization,
                Specification = ss.Specification,
                LevelId = s.Level,
                level = tl.LevelName,
                Primary = (bool)s.Primary,
                Secondary = (bool)s.Secondary,
                //  DateAssessed = (s.Date).ToString("dd/MM/yyyy"),
                LastUsed = s.LastUsed,
                experiance = s.experiance,
                Status = (int)s.status
            }).ToList();

            if (model.RequestStatusId != 0 && model.UserId != 0)
            {
                modelObj = modelObj.Where(o => o.Status == model.RequestStatusId && o.UserId == model.UserId).ToList();
            }
            else if (model.RequestStatusId != 0)
            {
                modelObj = modelObj.Where(o => o.Status == model.RequestStatusId).ToList();
            }
            else if (model.UserId != 0)
            {
                modelObj = modelObj.Where(o => o.UserId == model.UserId).ToList();
            }

            ViewBag.userSkills = modelObj;



            List <SelectListItem> LevelList1 = new List <SelectListItem>();
            List <SelectListItem> TechList1  = new List <SelectListItem>();
            List <SelectListItem> yearlist11 = new List <SelectListItem>();
            List <SelectListItem> specList1  = new List <SelectListItem>();


            lModel.speciIdList = specList1;

            foreach (var list in LevelList)
            {
                LevelList1.Add(new SelectListItem {
                    Text = list.LevelName, Value = Convert.ToString(list.LevelId)
                });
            }
            lModel.LevelIDList = LevelList1;

            foreach (var list in TechList)
            {
                TechList1.Add(new SelectListItem {
                    Text = list.SkillName, Value = Convert.ToString(list.SkillId)
                });
            }
            lModel.TechIDList = TechList1;

            foreach (var list in yearlist)
            {
                yearlist11.Add(new SelectListItem {
                    Text = list.year.ToString(), Value = Convert.ToString(list.year)
                });
            }
            lModel.yearidlist = yearlist11;


            for (int i = 0; i < 1; i++)
            {
                Skills lm = new Skills();
                lm.SpecificationId = 0;
                lm.LevelId         = 0;
                lm.Id           = 0;
                lm.DateAssessed = null;
                lm.LastUsed     = 0;
                lm.Primary      = false;
                lm.Secondary    = false;
                skl.Add(lm);
            }

            sk.skilllists = skl;
            sk.SKL        = lModel;



            return(View(modelObj));
        }
Ejemplo n.º 3
0
        public ActionResult Skills(string ID)
        {
            int INCOMING = 0;

            if (ID == null)
            {
                INCOMING          = 2;
                ViewData["Phase"] = INCOMING;
            }
            else if (ID == "")
            {
                INCOMING = 0;
            }
            else
            {
                INCOMING          = Convert.ToInt32(ID);
                ViewData["Phase"] = INCOMING;
            }


            DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();
            Skills obj = new Skills();

            var TechList = db.SkillsTechnologies.Where(x => x.IsActive == true).ToList();

            int userId            = Convert.ToInt32(Session["UserID"]);
            var LevelList         = db.Master_TrainingLevel.ToList();
            var reportingPersonId = db.UserReportings.Where(x => x.UserID == userId).Select(x => x.ReportingUserID).ToList();


            List <ReportingPerson> reportingPersons = (from u in db.Users.Where(o => o.IsActive == true)
                                                       where reportingPersonId.Contains(u.UserID)
                                                       select new ReportingPerson
            {
                UserID = u.UserID,
                Name = (u.FirstName + " " + (u.LastName ?? "")).Trim()
            }).OrderBy(o => o.Name).ToList();

            //ViewBag.details = new SelectList(reportingPersons, "UserID", "Name");
            //var yearlist = db.Master_years.OrderByDescending(x => x.year1).ToList();
            var yearlist = db.Master_years.OrderByDescending(x => x.year).ToList();

            // var speclist = db.SkillsSpecifications.Where(x=>x.IsActive==true).ToList();


            string[] l = new string[LevelList.Count];
            for (int j = 0; j < LevelList.Count; j++)
            {
                l[j] = LevelList[j].LevelName;
            }

            string[] t = new string[TechList.Count];

            for (int k = 0; k < TechList.Count; k++)
            {
                t[k] = TechList[k].SkillName;
            }

            string[] y = new string[yearlist.Count];
            for (int i = 0; i < yearlist.Count; i++)
            {
                // y[i] = yearlist[i].year1.ToString();
                y[i] = yearlist[i].year.ToString();
            }

            //string[] s = new string[speclist.Count];
            //for (int r = 0; r < speclist.Count; r++)
            //{
            //    s[r] = speclist[r].Specification;
            //}



            DSRCManagementSystem.Models.Skills ObjLD = new DSRCManagementSystem.Models.Skills();
            ModelState.Clear();

            skilllist     sk       = new skilllist();
            List <Skills> skl      = new List <Skills>();
            List <Skills> userSkl  = new List <Skills>();
            List <Skills> userSkl1 = new List <Skills>();
            Skills        lModel   = new Skills();


            var skillSet = db.Skills.Where(skill => skill.UserId == userId && skill.status != 1 && skill.Isactive == true).Join(db.SkillsTechnologies, skill => skill.Technology, tech => tech.SkillId, (skill, tech) => new

            {
                skillMain = skill,
                techMain  = tech
            }).Join(db.Master_TrainingLevel, skillLevel => skillLevel.skillMain.Level, level => level.LevelId, (allData, level) => new
            {
                skill = allData,
                level = level
            });

            foreach (var item in skillSet)
            {
                Skills lm = new Skills();
                lm.Id            = item.skill.skillMain.Id;
                lm.Technology    = item.skill.techMain.SkillName;
                lm.Specification = item.skill.skillMain.SkillsSpecification.Specification;
                lm.level         = item.level.LevelName;
                lm.Primary       = (bool)item.skill.skillMain.Primary;
                lm.Secondary     = (bool)item.skill.skillMain.Secondary;
                lm.DateAssessed  = ((DateTime)item.skill.skillMain.Date).ToString("dd/MM/yyyy");
                lm.LastUsed      = item.skill.skillMain.LastUsed;
                lm.experiance    = item.skill.skillMain.experiance;
                lm.Status        = (int)item.skill.skillMain.status;
                if (INCOMING != 0)
                {
                    if (lm.Status == INCOMING)
                    {
                        userSkl.Add(lm);
                    }
                }
                //else if (INCOMING != null && INCOMING!=0)
                //{
                //    if (lm.Status == 2)
                //    {
                //        userSkl.Add(lm);

                //    }

                //}
                else
                {
                    userSkl.Add(lm);
                }
            }
            ViewBag.userSkills = userSkl;

            var skillSet1 = db.Skills.Where(skill => skill.UserId == userId && skill.status == 1 && skill.Isactive == true).Join(db.SkillsTechnologies, skill => skill.Technology, tech => tech.SkillId, (skill, tech) => new
            {
                skillMain = skill,
                techMain  = tech
            }).Join(db.Master_TrainingLevel, skillLevel => skillLevel.skillMain.Level, level => level.LevelId, (allData, level) => new
            {
                skill = allData,
                level = level
            });

            foreach (var item in skillSet1)
            {
                Skills lm = new Skills();


                lm.Id            = item.skill.skillMain.Id;
                lm.Technology    = item.skill.techMain.SkillName;
                lm.Specification = item.skill.skillMain.SkillsSpecification.Specification;
                lm.level         = item.level.LevelName;
                lm.Primary       = (bool)item.skill.skillMain.Primary;
                lm.Secondary     = (bool)item.skill.skillMain.Secondary;
                lm.DateAssessed  = ((DateTime)item.skill.skillMain.Date).ToString("dd/MM/yyyy");
                lm.LastUsed      = item.skill.skillMain.LastUsed;
                lm.experiance    = item.skill.skillMain.experiance;
                userSkl1.Add(lm);
            }
            ViewBag.userSkills1 = userSkl1;

            List <SelectListItem> LevelList1   = new List <SelectListItem>();
            List <SelectListItem> TechList1    = new List <SelectListItem>();
            List <SelectListItem> yearlist11   = new List <SelectListItem>();
            List <SelectListItem> specList1    = new List <SelectListItem>();
            List <SelectListItem> ApproveList1 = new List <SelectListItem>();

            //foreach (var list in speclist)
            //{
            //    specList1.Add(new SelectListItem { Text = list.Specification, Value = Convert.ToString(list.SpecificationId) });
            //}
            lModel.speciIdList = specList1;

            foreach (var list in LevelList)
            {
                LevelList1.Add(new SelectListItem {
                    Text = list.LevelName, Value = Convert.ToString(list.LevelId)
                });
            }
            lModel.LevelIDList = LevelList1;

            foreach (var list in TechList)
            {
                TechList1.Add(new SelectListItem {
                    Text = list.SkillName, Value = Convert.ToString(list.SkillId)
                });
            }
            lModel.TechIDList = TechList1;

            foreach (var list in yearlist)
            {
                //yearlist11.Add(new SelectListItem { Text = list.year1.ToString(), Value = Convert.ToString(list.year1) });
                yearlist11.Add(new SelectListItem {
                    Text = list.year.ToString(), Value = Convert.ToString(list.year)
                });
            }
            lModel.yearidlist = yearlist11;


            foreach (var list in reportingPersons)
            {
                ApproveList1.Add(new SelectListItem {
                    Text = Convert.ToString(list.Name), Value = Convert.ToString(list.UserID)
                });
            }
            lModel.ApprovedList = ApproveList1;


            for (int i = 0; i < 1; i++)
            {
                Skills lm = new Skills();
                lm.SpecificationId = 0;
                lm.LevelId         = 0;
                lm.Id           = 0;
                lm.DateAssessed = null;
                lm.LastUsed     = 0;
                lm.Primary      = false;
                lm.Secondary    = false;
                skl.Add(lm);
            }

            sk.skilllists = skl;
            sk.SKL        = lModel;

            var SkillStatus = db.Master_SkillStatus.Where(o => o.AssessmentStatusID == 2 || o.AssessmentStatusID == 3).ToList();

            ViewBag.skillstatus = new SelectList(SkillStatus, "AssessmentStatusID", "AssessmentStatus");
            return(View("Skills", sk));
        }