コード例 #1
0
        public ActionResult Save(NominationModel model, HttpPostedFileBase[] files)
        {
            string _loggedInUserID = System.Web.HttpContext.Current.Session["UserID"].ToString();

            _repoResponse   = new RepositoryResponse();
            _nominationRepo = new NominationRepo();

            if (string.IsNullOrEmpty(model.NominationID))
            {
                _repoResponse = _nominationRepo.NominationRestrictionCount(_loggedInUserID);
                if (!_repoResponse.success)
                {
                    return(Json(new { success = _repoResponse.success, message = _repoResponse.message }));
                }
            }

            if (ModelState.IsValid)
            {
                _loginRepo = new LoginRepo();
                //FileUpload(files);

                _repoResponse = _nominationRepo.AddOrEditNominationDetails(_loggedInUserID, model);

                if (_repoResponse.success)
                {
                    _loginRepo = new LoginRepo();
                    int _empSOMRole = int.Parse(System.Web.HttpContext.Current.Session["EmpSOMRole"].ToString());
                    int count       = _loginRepo.getActionCounts(_loggedInUserID, _empSOMRole);
                    HttpContext.Session["NotifyCount"] = count;

                    return(Json(new { success = true, message = _repoResponse.message, Data = _repoResponse.Data }));
                }
                else
                {
                    return(Json(new { success = false, message = _repoResponse.message, Data = _repoResponse.Data }));
                }
            }
            else
            {
                List <string> fieldOrder = new List <string>(new string[] {
                    "UserName", "Password"
                })
                                           .Select(f => f.ToLower()).ToList();

                var _message1 = ModelState
                                .Select(m => new { Order = fieldOrder.IndexOf(m.Key.ToLower()), Error = m.Value })
                                .OrderBy(m => m.Order)
                                .SelectMany(m => m.Error.Errors.Select(e => e.ErrorMessage)).ToList();

                _message = string.Join("<br/>", _message1);

                return(Json(new { success = false, message = _message }));
            }
        }
コード例 #2
0
        public ActionResult Reject(NominationModel model)
        {
            _repoResponse   = new RepositoryResponse();
            _nominationRepo = new NominationRepo();
            string _loggedInUserID = System.Web.HttpContext.Current.Session["UserID"].ToString();

            _repoResponse = _nominationRepo.NominationFormDHOperations(_loggedInUserID, model, (int)NominationStatus.HoD_Reject);

            _loginRepo = new LoginRepo();
            int _empSOMRole = int.Parse(System.Web.HttpContext.Current.Session["EmpSOMRole"].ToString());
            int count       = _loginRepo.getActionCounts(_loggedInUserID, _empSOMRole);

            HttpContext.Session["NotifyCount"] = count;

            return(Json(new { success = _repoResponse.success, message = _repoResponse.message }));
        }
コード例 #3
0
 //Neelam Issue Id:60562 end
 public string SendTrainingEffectiveness(NominationModel objNominationmodel)
 {
     return(_repository.SendTrainingEffectiveness(objNominationmodel));
 }
コード例 #4
0
 public int UpdateTrainingEffectiveness(NominationModel objNominationmodel)
 {
     return(_repository.UpdateTrainingEffectiveness(objNominationmodel));
 }
コード例 #5
0
 public int SaveAndUpdateStatusOfTraining(NominationModel objNominationModel, string CourseID)
 {
     return(_repository.SaveAndUpdateStatusOfTraining(objNominationModel, CourseID));
 }
コード例 #6
0
 public int SaveFeedbackDetailsByRMO(NominationModel objNominationModel, string CourseID)
 {
     return(_repository.SaveFeedbackDetailsByRMO(objNominationModel, CourseID));
 }
コード例 #7
0
 public int SaveAccomodationAndFoodDetails(NominationModel objNominationModel)
 {
     return(_repository.SaveAccomodationAndFoodDetails(objNominationModel));
 }
コード例 #8
0
        public ActionResult FeedbackGrid(string CourseID, string Command)
        {
            if (Convert.ToInt32(CourseID) == 0)
            {
                return(RedirectToAction("FeedbackForRMO"));
            }
            else
            {
                //Feedback to be sent to participants need to be picked from attendance screen
                DataSet EmpId = _service.GetEmployeesFeedbackByCourseId(CourseID);

                List <string> Empname             = new List <string>();
                int           ParticipantsCount   = _service.getParticipantsCount(CourseID);
                int           FeedbackFilledCount = _service.getFeedbackFilledCount(CourseID);

                List <FeedbackModel> objListFeedbackModel = new List <FeedbackModel>();
                for (int j = 0; j < EmpId.Tables[0].Rows.Count; j++)
                {
                    DataSet FeedbackGridRatings = _service.GetFeedbackRatings(CourseID, EmpId.Tables[0].Rows[j]["EMPId"].ToString());
                    if (FeedbackGridRatings.Tables[0].Rows.Count != 0)
                    {
                        for (int i = 0; i < FeedbackGridRatings.Tables[0].Rows.Count - 4; i++)
                        {
                            FeedbackModel objFeedbackModel = new FeedbackModel();
                            objFeedbackModel.EmpID   = Convert.ToInt32(FeedbackGridRatings.Tables[0].Rows[i]["EmpID"]);
                            objFeedbackModel.EmpName = _service.GetEmpNameByEmpID(FeedbackGridRatings.Tables[0].Rows[i]["EmpID"].ToString());
                            objFeedbackModel.Rating  = Convert.ToInt32(FeedbackGridRatings.Tables[0].Rows[i]["Rating"]);
                            objListFeedbackModel.Add(objFeedbackModel);
                        }
                        DataSet FeedbackGridComments = _service.GetFeedbackRatings(CourseID, EmpId.Tables[0].Rows[j]["EMPId"].ToString());

                        for (int i = FeedbackGridRatings.Tables[0].Rows.Count - 4; i < FeedbackGridRatings.Tables[0].Rows.Count; i++)
                        {
                            FeedbackModel objFeedbackModel = new FeedbackModel();
                            objFeedbackModel.EmpID            = Convert.ToInt32(FeedbackGridComments.Tables[0].Rows[i]["EmpID"]);
                            objFeedbackModel.EmpName          = _service.GetEmpNameByEmpID(FeedbackGridComments.Tables[0].Rows[i]["EmpID"].ToString());
                            objFeedbackModel.CommentsFeedback = FeedbackGridComments.Tables[0].Rows[i]["CommentsFeedback"].ToString();
                            objListFeedbackModel.Add(objFeedbackModel);
                        }
                    }
                }

                //to calculate average rating start
                List <double> Total       = new List <double>();
                DataSet       description = _service.GetQuestionDescription();

                for (int i = 0; i < description.Tables[0].Rows.Count - 4; i++)
                {
                    Total.Add(_service.GetAverageRatingsFromParticipants(description.Tables[0].Rows[i]["QuestionMasterID"].ToString(), CourseID));
                }

                double knowledge = 0, TrainingMethodology = 0, PresentationSkills, TrainerOverall = 0, Content = 0, Facility = 0, Overall = 0;
                //Harsha- Issue Id: 58954- Start
                //Description: Need to remove training face from feedback page
                for (int i = 0; i < 4; i++)
                {
                    knowledge += Total[i];
                }
                knowledge = Math.Round(knowledge / 4, 1, MidpointRounding.AwayFromZero);

                for (int i = 4; i < 7; i++)
                {
                    TrainingMethodology += Total[i];
                }
                TrainingMethodology = Math.Round(TrainingMethodology / 3, 1, MidpointRounding.AwayFromZero);

                PresentationSkills = Total[7];

                for (int i = 8; i < 10; i++)
                {
                    TrainerOverall += Total[i];
                }
                TrainerOverall = Math.Round(TrainerOverall / 2, 1, MidpointRounding.AwayFromZero);

                for (int i = 10; i < 15; i++)
                {
                    Content += Total[i];
                }
                Content = Math.Round(Content / 5, 1, MidpointRounding.AwayFromZero);

                for (int i = 15; i < 18; i++)
                {
                    Facility += Total[i];
                }
                Facility = Math.Round(Facility / 3, 1, MidpointRounding.AwayFromZero);

                for (int i = 18; i < 20; i++)
                {
                    Overall += Total[i];
                }
                //Harsha- Issue Id: 58954- End
                Overall = Math.Round(Overall / 2, 1, MidpointRounding.AwayFromZero);

                double TrainerAverageRating = Math.Round((knowledge + TrainingMethodology + PresentationSkills + TrainerOverall) / 4, 1, MidpointRounding.AwayFromZero);

                List <double> TrainerAverage = new List <double>();
                TrainerAverage.Add(knowledge);
                TrainerAverage.Add(TrainingMethodology);
                TrainerAverage.Add(PresentationSkills);
                TrainerAverage.Add(TrainerOverall);
                TrainerAverage.Add(Content);
                TrainerAverage.Add(Facility);
                TrainerAverage.Add(Overall);
                TrainerAverage.Add(TrainerAverageRating);

                //List<>


                //End
                for (int i = 0; i < EmpId.Tables[0].Rows.Count; i++)
                {
                    Empname.Add(_service.GetEmpNameByEmpID(EmpId.Tables[0].Rows[i]["EMPId"].ToString()));
                }

                NominationModel        objNominationModel = new NominationModel();
                DataSet                dsNominationModel  = _service.GetFeedbackDetailsForRMO(CourseID);
                List <NominationModel> lstNominationModel = new List <NominationModel>();

                objNominationModel.FeedbackLastDate = Convert.ToDateTime(dsNominationModel.Tables[0].Rows[0]["FeedbackLastDate"]);

                if (dsNominationModel.Tables[0].Rows[0]["FeedbackToBeSentTrainer"].ToString() != "")
                {
                    objNominationModel.FeedbackToBeSentTrainer = Convert.ToDateTime(dsNominationModel.Tables[0].Rows[0]["FeedbackToBeSentTrainer"]);
                    if (dsNominationModel.Tables[0].Rows[0]["FeedbackSentToTrainer"].ToString() != "")
                    {
                        objNominationModel.FeedbackSentToTrainer = Convert.ToDateTime(dsNominationModel.Tables[0].Rows[0]["FeedbackSentToTrainer"]);
                    }
                    else
                    {
                        objNominationModel.FeedbackSentToTrainer = null;
                    }
                    objNominationModel.ReasonSLANotMet     = dsNominationModel.Tables[0].Rows[0]["ReasonSLANotMet"].ToString();
                    objNominationModel.CommentsForFeedback = dsNominationModel.Tables[0].Rows[0]["CommentsForFeedback"].ToString();
                    lstNominationModel.Add(objNominationModel);
                }
                else
                {
                    objNominationModel.FeedbackToBeSentTrainer = null;
                    lstNominationModel.Add(objNominationModel);
                }

                List <QuestionModel> lstQuestionModel = new List <QuestionModel>();
                DataSet desc = _service.GetQuestionDescription();

                for (int i = 0; i < desc.Tables[0].Rows.Count; i++)
                {
                    QuestionModel objQuestionModel = new QuestionModel();
                    objQuestionModel.Description      = desc.Tables[0].Rows[i]["Description"].ToString();
                    objQuestionModel.QuestionMasterID = Convert.ToInt32(desc.Tables[0].Rows[i]["QuestionMasterID"]);
                    lstQuestionModel.Add(objQuestionModel);
                }


                var result = new { objectList = objListFeedbackModel, stringList = Empname, nominationModel = lstNominationModel, TotalRating = Total, AvgTrainer = TrainerAverage, TotalParticpants = ParticipantsCount, NoOfFeedbackFilled = FeedbackFilledCount };

                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #9
0
        public ActionResult FeedbackFormRMO(FeedbackQuestionViewModel objFeedbackQuestionViewModel, string Command, string CourseID)
        {
            int update_status = 0;

            if (Command == "Save")
            {
                NominationModel objNominationModel = new NominationModel();
                objNominationModel.FeedbackToBeSentTrainer = objFeedbackQuestionViewModel.NominationModel.FeedbackToBeSentTrainer;
                objNominationModel.FeedbackSentToTrainer   = objFeedbackQuestionViewModel.NominationModel.FeedbackSentToTrainer;
                objNominationModel.ReasonSLANotMet         = objFeedbackQuestionViewModel.NominationModel.ReasonSLANotMet;
                objNominationModel.CommentsForFeedback     = objFeedbackQuestionViewModel.NominationModel.CommentsForFeedback;

                update_status = _service.SaveFeedbackDetailsByRMO(objNominationModel, CourseID);

                //objFeedbackQuestionViewModel.CourseNames = new SelectList(_service.GetTrainingNameList(), "Key", "Value");
                return(RedirectToAction("ViewTechnicalTrainingRequest", "Training"));
            }
            else if (Command == "Send Feedback")
            {
                NominationModel objNominationModel = new NominationModel();
                objNominationModel.FeedbackToBeSentTrainer = objFeedbackQuestionViewModel.NominationModel.FeedbackToBeSentTrainer;
                objNominationModel.FeedbackSentToTrainer   = objFeedbackQuestionViewModel.NominationModel.FeedbackSentToTrainer;
                objNominationModel.ReasonSLANotMet         = objFeedbackQuestionViewModel.NominationModel.ReasonSLANotMet;
                objNominationModel.CommentsForFeedback     = objFeedbackQuestionViewModel.NominationModel.CommentsForFeedback;
                objNominationModel.SendFeedback            = true;
                objNominationModel.CourseID = Convert.ToInt32(CourseID);

                int statusUpdate = _service.SaveAndUpdateStatusOfTraining(objNominationModel, CourseID);

                List <double> Total       = new List <double>();
                DataSet       description = _service.GetQuestionDescription();

                for (int i = 0; i < description.Tables[0].Rows.Count; i++)
                {
                    Total.Add(_service.GetAverageRatingsFromParticipants(description.Tables[0].Rows[i]["QuestionMasterID"].ToString(), CourseID));
                }

                DataSet TrainingDetails = _service.GetTrainingDetailsByCourseId(CourseID);
                EmailHelper.SendMailToTrainerWithRatings(Total, TrainingDetails);
                TempData["Result"] = "Feedback details saved successfully and mail is sent to trainer";
                return(RedirectToAction("FeedbackForRMO", "Feedback"));
            }
            //Harsha Issue Id- 58436- Start
            //Description: on training record: if no emp fill feedback the show comment in SLA Met  columns
            else if (Command == "No Feedback Received")
            {
                NominationModel objNominationModel = new NominationModel();
                objNominationModel.FeedbackToBeSentTrainer = null;
                objNominationModel.FeedbackSentToTrainer   = null;
                objNominationModel.ReasonSLANotMet         = "";
                objNominationModel.CommentsForFeedback     = "";
                objNominationModel.SendFeedback            = false;
                objNominationModel.CourseID           = Convert.ToInt32(CourseID);
                objNominationModel.NoFeedbackReceived = true;
                int statusUpdate = _service.SaveAndUpdateStatusOfTraining(objNominationModel, CourseID);
                return(RedirectToAction("ViewTechnicalTrainingRequest", "Training"));
            }
            //Harsha Issue Id- 58436- End
            else
            {
                return(View());
            }
        }
コード例 #10
0
 public string SendTrainingEffectiveness(NominationModel objNominationmodel)
 {
     throw new NotImplementedException();
 }
コード例 #11
0
 public int UpdateTrainingEffectiveness(NominationModel objNominationmodel)
 {
     throw new NotImplementedException();
 }
コード例 #12
0
 public int SaveAndUpdateStatusOfTraining(NominationModel objNominationModel, string CourseID)
 {
     throw new NotImplementedException();
 }
コード例 #13
0
 public int SaveFeedbackDetailsByRMO(NominationModel objNominationModel, string CourseID)
 {
     throw new NotImplementedException();
 }
コード例 #14
0
 public int SaveAccomodationAndFoodDetails(NominationModel objNominationModel)
 {
     throw new NotImplementedException();
 }
コード例 #15
0
        // GET: Nomination
        //[HttpGet]
        public ActionResult Nomination(long ID = 0)
        {
            _repoResponse = new RepositoryResponse();
            NominationModel model = new NominationModel();

            if (ID > 0)
            {
                string subPath = "~/Uploads/nominationID/";
                string fpath   = string.Empty;
                bool   exists  = System.IO.Directory.Exists(subPath);
                if (exists)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(subPath));
                }
                fpath = Server.MapPath(subPath);

                _nominationRepo = new NominationRepo();
                string _loggedInUserID = System.Web.HttpContext.Current.Session["UserID"].ToString();
                _repoResponse = _nominationRepo.GetNominationByID(_loggedInUserID, ID, fpath);
                if (_repoResponse.success)
                {
                    model = _repoResponse.Data;

                    List <SelectListItem> lstItem = new List <SelectListItem>();

                    SelectListItem s1 = new SelectListItem();
                    s1.Text  = "Cost(in Lakhs)";
                    s1.Value = "1";
                    lstItem.Add(s1);

                    SelectListItem s2 = new SelectListItem();
                    s2.Text  = "Time(in hours)";
                    s2.Value = "2";
                    lstItem.Add(s2);

                    SelectListItem s3 = new SelectListItem();
                    s3.Text  = "Paper(in Sheets)";
                    s3.Value = "3";
                    lstItem.Add(s3);
                    model.Savings = lstItem;

                    return(View(model));
                }
            }
            else
            {
                string _loggedInUserID = System.Web.HttpContext.Current.Session["UserID"].ToString();
                if (!string.IsNullOrEmpty(_loggedInUserID))
                {
                    _nominationRepo = new NominationRepo();
                    _repoResponse   = new RepositoryResponse();
                    _repoResponse   = _nominationRepo.NominationRestrictionCount(_loggedInUserID);

                    if (!_repoResponse.success)
                    {
                        model.NominationMessage = _repoResponse.message;
                    }
                }


                model.Name           = System.Web.HttpContext.Current.Session["UserFullName"].ToString();
                model.EmployeeNumber = System.Web.HttpContext.Current.Session["UserID"].ToString();
                model.Department     = System.Web.HttpContext.Current.Session["UserDepartment"].ToString();

                List <SelectListItem> lstItem = new List <SelectListItem>();

                SelectListItem s1 = new SelectListItem();
                s1.Text  = "Cost(in Lakhs)";
                s1.Value = "1";
                lstItem.Add(s1);

                SelectListItem s2 = new SelectListItem();
                s2.Text  = "Time(in hours)";
                s2.Value = "2";
                lstItem.Add(s2);

                SelectListItem s3 = new SelectListItem();
                s3.Text  = "Paper(in Sheets)";
                s3.Value = "3";
                lstItem.Add(s3);
                model.Savings = lstItem;

                return(View(model));
            }
            return(Json(new { success = _repoResponse.success.ToString(), message = _repoResponse.message }));
        }