Exemplo n.º 1
0
        // GET: StarOfMonth Details By ID

        public ActionResult GetStarOfMonthDetails(int ID = 0)
        {
            _repoResponse = new RepositoryResponse();
            StarOfMonthModel model = new StarOfMonthModel();

            if (ID > 0)
            {
                _statRepo = new StarOfMonthRepo();
                string _loggedInUserID = System.Web.HttpContext.Current.Session["UserID"].ToString();
                _repoResponse = _statRepo.LoadStarOfMonthDetailsByID(ID, _loggedInUserID);
                if (_repoResponse.success)
                {
                    model = _repoResponse.Data;
                    return(Json(new { success = _repoResponse.success, message = _repoResponse.message, data = model }));
                }
            }
            else if (ID == -1)
            {
                _statRepo = new StarOfMonthRepo();
                string _loggedInUserID = System.Web.HttpContext.Current.Session["UserID"].ToString();
                _repoResponse = _statRepo.LoadStarOfMonthDetailsByID(ID, _loggedInUserID);
                if (_repoResponse.success)
                {
                    model = _repoResponse.Data;
                    return(Json(new { success = _repoResponse.success, message = _repoResponse.message, data = model }));
                }
            }
            return(Json(new { success = _repoResponse.success, message = _repoResponse.message, data = model }));
        }
Exemplo n.º 2
0
        public RepositoryResponse LoadStarOfMonthDetailsForGrid(string dept, string date)
        {
            baseModel = new RepositoryResponse();
            string subMonth = string.Empty;
            string subYear  = string.Empty;

            try
            {
                using (objSOMEntities = new SOMEntities())
                    using (objIPEntities = new IntranetPortalEntities())
                    {
                        var _StarDetails = (from em in objIPEntities.EmpMasters.AsEnumerable()
                                            join nom in objSOMEntities.Nominations.AsEnumerable() on em.EmployeeNumber equals nom.EmployeeNumber
                                            join st in objSOMEntities.StarOfTheMonths.AsEnumerable() on nom.NominationId equals st.NominationID
                                            select new { em, nom, st }).OrderByDescending(r => r.nom.ID).ToList();

                        if (!string.IsNullOrEmpty(date))
                        {
                            string[] sDate = date.Split('-');
                            subMonth = sDate[0];
                            subYear  = sDate[1];
                        }

                        if (!string.IsNullOrEmpty(dept) && dept != "--ALL--")
                        {
                            _StarDetails = _StarDetails.Where(r => r.em.Department == dept).ToList();
                        }
                        if (!string.IsNullOrEmpty(subMonth) && !string.IsNullOrEmpty(subYear))
                        {
                            _StarDetails = _StarDetails.Where(r => r.nom.SubmittedMonth == subMonth && r.nom.SubmittedYear == subYear).ToList();
                        }
                        List <StarOfMonthModel> lstStar = new List <StarOfMonthModel>();
                        foreach (var item in _StarDetails)
                        {
                            StarOfMonthModel model = new StarOfMonthModel();
                            model.TransID      = item.st.TransID;
                            model.EmpId        = item.st.EmpId.ToString();
                            model.EmpName      = item.em.EmployeeName;
                            model.NominationID = item.nom.NominationId;
                            model.Department   = item.em.Department;
                            model.Month        = item.st.Month;
                            model.Year         = item.st.Year;
                            lstStar.Add(model);
                        }
                        return(baseModel = new RepositoryResponse {
                            success = true, message = "", Data = lstStar
                        });
                    }
            }
            catch (Exception ex)
            {
                baseModel = new RepositoryResponse {
                    success = false, message = ex.ToString()
                };
            }
            return(baseModel);
        }
Exemplo n.º 3
0
        // GET: StarOfMonth
        public ActionResult Index()
        {
            _loginRepo        = new LoginRepo();
            _panelMembersRepo = new PanelMembersRepo();
            _statRepo         = new StarOfMonthRepo();
            string sMonth = Assistant.GetMonthFromCurrentDate();
            string sYear  = Assistant.GetYearFromCurrentDate();

            StarOfMonthModel model = new StarOfMonthModel();

            model.DeptFilterlst  = _loginRepo.GetDepartmentDetails();
            model.DateFilterlst  = _loginRepo.GetMonthYearFilter();
            model.MonthFilterlst = _panelMembersRepo.LoadListofMonth(sMonth);
            model.YearFilterlst  = _panelMembersRepo.LoadListofFutureYears(5, sYear);
            //model.NominationIDlst = _statRepo.LoadNominationIDsByEmpID("");
            model.NominationIDlst = _statRepo.LoadNominationIDsEvalCompByMonthAndYear(sMonth, sYear);
            return(View(model));
        }
Exemplo n.º 4
0
 public RepositoryResponse LoadStarOfMonthDetailsByID(int ID, string loggedInuserID)
 {
     baseModel = new RepositoryResponse();
     try
     {
         using (objSOMEntities = new SOMEntities())
             using (objIPEntities = new IntranetPortalEntities())
             {
                 var data = objSOMEntities.StarOfTheMonths.Where(r => r.TransID == ID).FirstOrDefault();
                 if (data != null)
                 {
                     var usr = objIPEntities.EmpMasters.Where(r => r.EmployeeNumber == data.EmpId.ToString()).FirstOrDefault();
                     var nom = objSOMEntities.Nominations.Where(r => r.NominationId == data.NominationID).FirstOrDefault();
                     StarOfMonthModel model = new StarOfMonthModel();
                     model.TransID      = data.TransID;
                     model.EmpId        = data.EmpId.ToString();
                     model.EmpName      = usr.EmployeeName;
                     model.Description  = data.Description;
                     model.Month        = data.Month;
                     model.Year         = data.Year;
                     model.NominationID = data.NominationID;
                     model.SOMComments  = nom.SOMComments;
                     baseModel          = new RepositoryResponse {
                         success = true, message = "", Data = model
                     };
                 }
             }
     }
     catch (Exception ex)
     {
         baseModel = new RepositoryResponse {
             success = false, message = "", Data = ex.ToString()
         };;
     }
     return(baseModel);
 }
Exemplo n.º 5
0
        public ActionResult Save(StarOfMonthModel model)
        {
            string _loggedInUserID = System.Web.HttpContext.Current.Session["UserID"].ToString();

            _repoResponse = new RepositoryResponse();
            _statRepo     = new StarOfMonthRepo();

            if (ModelState.IsValid)
            {
                _repoResponse = _statRepo.AddOrEditStarOfMonth(model, _loggedInUserID);
                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;

                    // reload SOM information

                    IStarOfMonthRepo      starOfTheMonth = new StarOfMonthRepo();
                    List <EmpMasterModel> _data          = starOfTheMonth.GetLastThreeStarOftheMonthEmpDetails();
                    if (_data == null)
                    {
                        HttpContext.Session.Add("SOM_Month_Count", "0");
                    }
                    else
                    {
                        HttpContext.Session.Add("SOM_Month_Count", _data.Count);
                    }

                    for (int i = 0; i < _data.Count; i++)
                    {
                        HttpContext.Session.Add("SOM_Month_" + i, _data[i].EMPMonth);
                        HttpContext.Session.Add("SOM_Image_" + i, _data[i].ImagePath);
                    }


                    return(Json(new { success = true, message = _repoResponse.message }));
                }
                else
                {
                    return(Json(new { success = false, message = _repoResponse.message }));
                }
            }
            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 }));
            }
        }
Exemplo n.º 6
0
        public RepositoryResponse AddOrEditStarOfMonth(StarOfMonthModel model, string loggedInuserID)
        {
            _nominationRepo = new NominationRepo();
            baseModel       = new RepositoryResponse();
            try
            {
                string nomID = string.Empty;
                //string IPValue = string.Empty;
                Nomination dbNomModel = new Nomination();
                using (objSOMEntities = new SOMEntities())
                {
                    //var config = objSOMEntities.Configurations.Where(r => r.Module == "SOM" && r.Type == "UPDATEIP" && r.IsActive == true).FirstOrDefault();
                    //IPValue = config.Value;
                    var dbModel = objSOMEntities.StarOfTheMonths.Where(r => r.TransID == model.TransID).FirstOrDefault();
                    if (string.IsNullOrEmpty(model.SelectedNominationID))
                    {
                        dbNomModel = objSOMEntities.Nominations.Where(r => r.NominationId == dbModel.NominationID).FirstOrDefault();
                    }
                    else
                    {
                        dbNomModel = objSOMEntities.Nominations.Where(r => r.NominationId == model.SelectedNominationID.Replace("\r\n", "")).FirstOrDefault();
                    }


                    if (dbModel == null)
                    {
                        nomID   = dbNomModel.NominationId;
                        dbModel = new StarOfTheMonth.DataBase.StarOfTheMonth();

                        dbModel.EmpId      = int.Parse(dbNomModel.EmployeeNumber);
                        dbModel.IsApproved = true;
                        dbModel.IsDisplay  = true;

                        if (string.IsNullOrEmpty(model.Month))
                        {
                            dbModel.Month = model.MonthFilter;
                        }
                        else
                        {
                            dbModel.Month = model.Month;
                        }
                        if (string.IsNullOrEmpty(model.Year))
                        {
                            dbModel.Year = model.YearFilter;
                        }
                        else
                        {
                            dbModel.Year = model.Year;
                        }

                        dbModel.NominationID = dbNomModel.NominationId;
                        dbModel.Description  = dbNomModel.Idea;
                        dbModel.ApprovedBy   = int.Parse(loggedInuserID);
                        dbModel.CreatedBy    = int.Parse(loggedInuserID);
                        //dbModel.CreatedDate = toISTDate(DateTime.Now);
                        dbModel.ModifiedBy = int.Parse(loggedInuserID);
                        // dbModel.ModifiedDate = toISTDate(DateTime.Now);

                        objSOMEntities.StarOfTheMonths.Add(dbModel);
                        objSOMEntities.SaveChanges();
                        baseModel = new RepositoryResponse {
                            success = true, message = "Star of Month Declared Successfully", Data = ""
                        };
                    }
                    else
                    {
                        nomID = dbModel.NominationID;
                        //dbModel.EmpId = int.Parse(model.EmpId);
                        //dbModel.IsApproved = true;
                        //dbModel.IsDisplay = true;
                        //dbModel.Description = model.Description;
                        dbModel.Month = model.MonthFilter;
                        dbModel.Year  = model.YearFilter;
                        //dbModel.NominationID = model.NominationID;
                        dbModel.CreatedBy = int.Parse(loggedInuserID);
                        //dbModel.CreatedDate = DateTime.UtcNow;
                        dbModel.ModifiedBy = int.Parse(loggedInuserID);
                        //dbModel.ModifiedDate = DateTime.UtcNow;
                        objSOMEntities.SaveChanges();
                        baseModel = new RepositoryResponse {
                            success = true, message = "Star of Month Declared updated Successfully", Data = ""
                        };
                    }

                    if (dbNomModel != null)
                    {
                        dbNomModel.SOMComments      = model.SOMComments;
                        dbNomModel.SOMSubmittedDate = DateTime.Now.ToString("ddMMyyyy");
                        dbNomModel.SOMSignature     = loggedInuserID;
                        dbNomModel.Status           = (int)NominationStatus.TQC_Declare_SOM;
                        dbNomModel.ModifiedBy       = loggedInuserID;
                        objSOMEntities.SaveChanges();
                    }

                    Evaluation    evalDbModel = objSOMEntities.Evaluations.Where(r => r.NominationID == nomID && r.EvaluatorID != "").FirstOrDefault();
                    long          HODId       = _nominationRepo.GetReportingIDByEmpID(dbNomModel.EmployeeNumber);
                    AuditLogModel objAuditLog = new AuditLogModel();
                    objAuditLog.CurrentStatus    = NominationStatus.TQC_Declare_SOM;
                    objAuditLog.EmployeeNumber   = dbNomModel.EmployeeNumber;
                    objAuditLog.IsNewAlert       = true;
                    objAuditLog.IsNotification   = true;
                    objAuditLog.DepartmentHeadID = HODId.ToString();
                    objAuditLog.TQCHeadID        = loggedInuserID;
                    objAuditLog.EvaluatorID      = evalDbModel.EvaluatorID;
                    objAuditLog.NominationID     = nomID;
                    objAuditLog.CreatedBy        = loggedInuserID;
                    _nominationRepo.AddEntryIntoAuditLog(objAuditLog);
                }


                //if (string.IsNullOrEmpty(IPValue) && IPValue == "true")
                //{
                //    AddOrEditStarOfMonth_IntranetPortal(model, loggedInuserID);
                //}
            }
            catch (Exception ex)
            {
                baseModel = new RepositoryResponse {
                    success = false, message = ex.ToString()
                };
            }
            return(baseModel);
        }
Exemplo n.º 7
0
        public RepositoryResponse AddOrEditStarOfMonth_IntranetPortal(StarOfMonthModel model, string loggedInuserID)
        {
            _nominationRepo = new NominationRepo();
            baseModel       = new RepositoryResponse();
            try
            {
                string     nomID      = string.Empty;
                Nomination dbNomModel = new Nomination();
                using (objSOMEntities = new SOMEntities())
                    using (objIPEntities = new IntranetPortalEntities())
                    {
                        var dbModel = objIPEntities.StarOfTheMonths.Where(r => r.TransID == model.TransID).FirstOrDefault();
                        if (string.IsNullOrEmpty(model.SelectedNominationID))
                        {
                            dbNomModel = objSOMEntities.Nominations.Where(r => r.NominationId == dbModel.NominationID).FirstOrDefault();
                        }
                        else
                        {
                            dbNomModel = objSOMEntities.Nominations.Where(r => r.NominationId == model.SelectedNominationID.Replace("\r\n", "")).FirstOrDefault();
                        }

                        if (dbModel == null)
                        {
                            nomID   = dbNomModel.NominationId;
                            dbModel = new StarOfTheMonth.DataBase.StarOfTheMonth();

                            dbModel.EmpId      = int.Parse(dbNomModel.EmployeeNumber);
                            dbModel.IsApproved = true;
                            dbModel.IsDisplay  = true;

                            if (string.IsNullOrEmpty(model.Month))
                            {
                                dbModel.Month = model.MonthFilter;
                            }
                            else
                            {
                                dbModel.Month = model.Month;
                            }
                            if (string.IsNullOrEmpty(model.Year))
                            {
                                dbModel.Year = model.YearFilter;
                            }
                            else
                            {
                                dbModel.Year = model.Year;
                            }

                            dbModel.NominationID = dbNomModel.NominationId;
                            dbModel.Description  = dbNomModel.Idea;

                            dbModel.CreatedBy  = int.Parse(loggedInuserID);
                            dbModel.ModifiedBy = int.Parse(loggedInuserID);

                            objIPEntities.StarOfTheMonths.Add(dbModel);
                            objIPEntities.SaveChanges();
                            baseModel = new RepositoryResponse {
                                success = true, message = "Star of Month Details Added Successfully", Data = ""
                            };
                        }
                        else
                        {
                            nomID              = dbModel.NominationID;
                            dbModel.Month      = model.MonthFilter;
                            dbModel.Year       = model.YearFilter;
                            dbModel.CreatedBy  = int.Parse(loggedInuserID);
                            dbModel.ModifiedBy = int.Parse(loggedInuserID);
                            objIPEntities.SaveChanges();
                            baseModel = new RepositoryResponse {
                                success = true, message = "Star of Month Details updated Successfully", Data = ""
                            };
                        }
                    }
            }
            catch (Exception ex)
            {
                baseModel = new RepositoryResponse {
                    success = false, message = ex.ToString()
                };
            }
            return(baseModel);
        }
Exemplo n.º 8
0
        public RepositoryResponse AddorUpdateEvaluationData(EvaluationModel model, string _loggedInUserID, bool isSubmit)
        {
            baseModel = new RepositoryResponse();

            try
            {
                using (objSOMEntities = new SOMEntities())
                {
                    Evaluation db = objSOMEntities.Evaluations.Where(r => r.ID == model.ID).FirstOrDefault();
                    if (db == null)
                    {
                        objSOMEntities.Evaluations.Add(ConvertEvaluation_Model2DB(model, _loggedInUserID, isSubmit));
                        objSOMEntities.SaveChanges();
                        if (isSubmit)
                        {
                            baseModel = new RepositoryResponse {
                                success = true, message = "Evaluations Scroe Details Submitted to TQC Successfully"
                            };
                        }
                        else
                        {
                            baseModel = new RepositoryResponse {
                                success = true, message = "Evaluations Scroe Details added Successfully"
                            };
                        }
                    }
                    else
                    {
                        db.TotalScore         = int.Parse(model.TotalScore);
                        db.AheadOfPlan        = model.AheadOfPlan;
                        db.AsPerPlan          = model.AsPerPlan;
                        db.BasedOnInstruction = model.BasedOnInstruction;

                        db.BreakthroughImprovement         = model.BreakthroughImprovement;
                        db.CoordiantionWithInTheDept       = model.CoordiantionWithInTheDept;
                        db.CoordinationWithAnotherFunction = model.CoordinationWithAnotherFunction;

                        db.CoordinationWithMultipleFunctions = model.CoordinationWithMultipleFunctions;
                        db.Delayed = model.Delayed;
                        //db.EmployeeID = model.EmployeeID;
                        db.NominationID = model.NominationID;

                        //db.EvaluatorID = model.EvaluatorID;
                        db.FollowedUp = model.FollowedUp;
                        //db.ID = model.ID;

                        db.Implemented = model.Implemented;
                        db.ImplementedInAllApplicableAreas = model.ImplementedInAllApplicableAreas;
                        db.ImplementedPartially            = model.ImplementedPartially;
                        db.ImprovementFromCurrentSituation = model.ImprovementFromCurrentSituation;

                        db.IsActive             = true;
                        db.Participated         = model.Participated;
                        db.PreventionOfaFailure = model.PreventionOfaFailure;

                        db.ProactiveIdeaGeneratedBySelf  = model.ProactiveIdeaGeneratedBySelf;
                        db.ReactiveIdeaDrivenBySituation = model.ReactiveIdeaDrivenBySituation;
                        db.ScopeIdentified = model.ScopeIdentified;

                        if (isSubmit)
                        {
                            db.Status = (int)NominationStatus.Evaluators_Assign_TQC;
                        }
                        else
                        {
                            db.Status = (int)NominationStatus.Evaluators_Save;
                        }
                        db.ModifiedBy = _loggedInUserID;
                        objSOMEntities.SaveChanges();

                        if (isSubmit)
                        {
                            configRepo = new ConfigurationRepo();
                            bool result = configRepo.SendEmailUsingSOM_Evaluator_Assign_TQC(db.NominationID, _loggedInUserID);
                            if (result)
                            {
                                baseModel = new RepositoryResponse {
                                    success = true, message = "Evaluations Scroe Details Submitted to TQC Successfully and Send Mail to TQC"
                                };
                            }
                            else
                            {
                                baseModel = new RepositoryResponse {
                                    success = true, message = "Evaluations Scroe Details Submitted to TQC Successfully. Unable to Send Mail to TQC"
                                };
                            }
                        }
                        else
                        {
                            baseModel = new RepositoryResponse {
                                success = true, message = "Evaluations Scroe Details updated Successfully"
                            };
                        }
                    }
                }
                using (objSOMEntities = new SOMEntities())
                {
                    if (isSubmit)
                    {
                        var nomDet = objSOMEntities.Nominations.Where(r => r.NominationId == model.NominationID).FirstOrDefault();
                        nomDet.Status     = (int)NominationStatus.Evaluators_Assign_TQC;
                        nomDet.ModifiedBy = _loggedInUserID;
                        objSOMEntities.SaveChanges();
                    }
                }
                if (isSubmit)
                {
                    nomRepo = new NominationRepo();
                    //Add entry into Audit Log
                    AuditLogModel objAuditLog = new AuditLogModel();
                    objAuditLog.CurrentStatus  = NominationStatus.Evaluators_Assign_TQC;
                    objAuditLog.EmployeeNumber = model.EmployeeNumber;
                    objAuditLog.IsNewAlert     = true;
                    objAuditLog.IsNotification = true;
                    objAuditLog.NominationID   = model.NominationID;
                    objAuditLog.CreatedBy      = _loggedInUserID;
                    objAuditLog.EvaluatorID    = _loggedInUserID;
                    nomRepo.AddEntryIntoAuditLog(objAuditLog);

                    Nomination _nomModel;
                    using (objSOMEntities = new SOMEntities())
                    {
                        _nomModel = objSOMEntities.Nominations.Where(r => r.NominationId == model.NominationID).FirstOrDefault();
                    }
                    // Add entry into SOM
                    StarOfMonthModel SOMmodel = new StarOfMonthModel();
                    SOMmodel.Month        = _nomModel.SubmittedMonth;
                    SOMmodel.Year         = _nomModel.SubmittedYear;
                    SOMmodel.Description  = _nomModel.Idea;
                    SOMmodel.EmpId        = model.EmployeeNumber;
                    SOMmodel.NominationID = model.NominationID;
                    SOMmodel.IsDisplay    = true;
                    SOMmodel.IsApproved   = true;
                    SOMmodel.ApprovedBy   = int.Parse(_loggedInUserID);
                    SOMmodel.CreatedBy    = int.Parse(_loggedInUserID);
                    SOMmodel.CreatedDate  = DateTime.Now;
                    SOMmodel.ModifiedBy   = int.Parse(_loggedInUserID);
                    SOMmodel.ModifiedDate = DateTime.Now;
                    starRepo = new StarOfMonthRepo();
                    //starRepo.AddOrEditStarOfMonth(SOMmodel, _loggedInUserID);
                }

                if (isSubmit) //Send Nomination Submit Details to DH
                {
                    using (objSOMEntities = new SOMEntities())
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                baseModel = new RepositoryResponse {
                    success = false, message = ex.ToString()
                };
            }
            return(baseModel);
        }