public List <EmpMasterModel> GetLastThreeStarOftheMonthEmpDetails() { string currentYear = DateTime.Now.ToString("yyyy"); List <EmpMasterModel> lstEmpModel = new List <EmpMasterModel>(); using (objSOMEntities = new SOMEntities()) using (objIPEntities = new IntranetPortalEntities()) { var somData = objSOMEntities.StarOfTheMonths.Where(r => r.Year == currentYear).OrderByDescending(r => r.TransID).ToList(); foreach (var item in somData) { var emp = objIPEntities.EmpMasters.Where(r => r.EmployeeNumber == item.EmpId.ToString()).FirstOrDefault(); if (emp != null) { EmpMasterModel model = new EmpMasterModel(); model.EmpID = emp.EmpID; model.EmployeeName = emp.EmployeeName; model.EmployeeNumber = emp.EmployeeNumber; model.ImagePath = emp.ImagePath; model.EMPMonth = item.Month; model.EMPYear = item.Year; lstEmpModel.Add(model); } } } return(lstEmpModel); }
public RepositoryResponse AddNotification(string sCategory, string sMessage, string sSourceUser, string sDestinationUser, string CreatedUser) { baseModel = new RepositoryResponse(); try { using (objSOMEntities = new SOMEntities()) { Notification dbModel = new Notification(); dbModel.Category = sCategory; dbModel.CreatedBy = CreatedUser; dbModel.DestinationUser = sDestinationUser; dbModel.SourceUser = sSourceUser; dbModel.Message = sMessage; dbModel.UserSeen = false; dbModel.IsActive = true; objSOMEntities.Notifications.Add(dbModel); objSOMEntities.SaveChanges(); baseModel = new RepositoryResponse { success = true, message = "Notification Details added Successfully" }; } } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = "Notification Details unable to add" }; } return(baseModel); }
public RepositoryResponse LoadEmpNominationDetails(long ID, string nominationID, string empNum) { baseModel = new RepositoryResponse(); try { using (objSOMEntities = new SOMEntities()) using (objIPEntities = new IntranetPortalEntities()) { EmpMaster a = new EmpMaster(); Nomination c = new Nomination(); var _NomDetails = (from em in objIPEntities.EmpMasters.AsEnumerable() join nom in objSOMEntities.Nominations.AsEnumerable() on em.EmployeeNumber equals nom.EmployeeNumber.ToString() where nom.IsActive == true && nom.NominationId == nominationID && em.EmployeeNumber == empNum select new { em, nom }).OrderByDescending(r => r.nom.ID).FirstOrDefault(); var _data = objSOMEntities.Evaluations.Where(r => r.ID == ID && r.IsActive == true).FirstOrDefault(); EvaluationModel model = ConvertEvaluation_DB2Model(_NomDetails.em, _data, _NomDetails.nom, 1); baseModel = new RepositoryResponse { success = true, message = "Get Evaluation details Successfully", Data = model }; } } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = ex.ToString() }; } return(baseModel); }
public List <AutoCompleteBox> GetStarOfMembersDetailsByEmpName(bool isRequiredDept) { List <AutoCompleteBox> lstAutoCompBox = new List <AutoCompleteBox>(); List <AuditLog> lstValue = new List <AuditLog>(); using (objSOMEntities = new SOMEntities()) { lstValue = objSOMEntities.AuditLogs.Where(r => r.CurrentStatus == (int)NominationStatus.Evaluators_Assign_TQC && r.IsActive == true).ToList(); } using (objSOMEntities = new SOMEntities()) using (objIPEntities = new IntranetPortalEntities()) { var empDet = (from a in lstValue.AsEnumerable() join b in objIPEntities.EmpMasters.AsEnumerable() on a.EmployeeNumber equals b.EmployeeNumber select new { b.EmployeeNumber, b.Department, b.EmployeeName }); foreach (var item in empDet) { AutoCompleteBox objAutoCompleteBox = new AutoCompleteBox(); if (isRequiredDept) { objAutoCompleteBox.ID = item.EmployeeNumber + "###" + item.Department; } else { objAutoCompleteBox.ID = item.EmployeeNumber; } objAutoCompleteBox.Value = item.EmployeeName; lstAutoCompBox.Add(objAutoCompleteBox); } } return(lstAutoCompBox); }
public RepositoryResponse DeleteStarOfMonthDetailsByID(int ID, string loggedInuserID) { baseModel = new RepositoryResponse(); try { using (objSOMEntities = new SOMEntities()) { var data = objSOMEntities.StarOfTheMonths.Where(r => r.TransID == ID).FirstOrDefault(); if (data != null) { objSOMEntities.StarOfTheMonths.Remove(data); objSOMEntities.SaveChanges(); baseModel = new RepositoryResponse { success = true, message = "Star of month details deleted Sucessfully", Data = "" }; } } } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = "", Data = ex.ToString() };; } return(baseModel); }
public RepositoryResponse GetNotificationsByEmployeeNumber(string userID) { try { List <Notification> lstNotifications = new List <Notification>(); using (objSOMEntities = new SOMEntities()) { //if (IsSeen == false) //{ // lstNotifications = objSOMEntities.Notifications.Where(r => r.DestinationUser == userID.ToString() && r.IsActive == true // && r.UserSeen == IsSeen).OrderByDescending(r => r.ID).ToList(); //} //else //{ lstNotifications = objSOMEntities.Notifications.Where(r => r.DestinationUser == userID && r.IsActive == true) .OrderByDescending(r => r.ID).ToList(); //} } baseModel = new RepositoryResponse { success = true, message = "Notification Details added Successfully", Data = lstNotifications }; } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = "Notification Details unable to add" }; } return(baseModel); }
public List <AutoCompleteBox> GetEmpDetailsByEmpName(bool isRequiredDept) { List <AutoCompleteBox> lstAutoCompBox = new List <AutoCompleteBox>(); using (objSOMEntities = new SOMEntities()) using (objIPEntities = new IntranetPortalEntities()) { var emp = objIPEntities.EmpMasters.Where(r => r.IsActive == true).ToList(); foreach (var item in emp) { AutoCompleteBox objAutoCompleteBox = new AutoCompleteBox(); if (isRequiredDept) { objAutoCompleteBox.ID = item.EmployeeNumber + "###" + item.Department; } else { objAutoCompleteBox.ID = item.EmployeeNumber; } objAutoCompleteBox.Value = item.EmployeeName; lstAutoCompBox.Add(objAutoCompleteBox); } } return(lstAutoCompBox); }
public RepositoryResponse GetUserDetailsByUserID(string userID) { RepositoryResponse baseModel = new RepositoryResponse(); using (objSOMEntities = new SOMEntities()) using (objIPEntities = new IntranetPortalEntities()) { var userDet = objIPEntities.EmpMasters.Where(r => r.EmployeeNumber == userID && r.IsActive == true).FirstOrDefault(); if (userDet != null) { EmpMasterModel model = new EmpMasterModel(); model.UserName = userDet.UserName; model.UserRole = userDet.UserRole; model.EmployeeNumber = userDet.EmployeeNumber; model.Department = userDet.Department; model.Grade = userDet.Grade; model.EmployeeName = userDet.EmployeeName; //model.EmployeeSOMRole = GetEmployeeRole(userID, userDet.Grade); int value = GetSOMEmployeeRoleByUser(userDet); model.EmployeeSOMRole = value; model.EmployeeSOMRoleAsString = EnumHelper.GetDescription((SOMEmpRole)value); baseModel = new RepositoryResponse { success = true, message = "user Details retrieved Successfully", Data = model }; } else { baseModel = new RepositoryResponse { success = false, message = "user Details not available" }; } } return(baseModel); }
public RepositoryResponse GetLoginUserDetails(string userName) { RepositoryResponse baseModel = new RepositoryResponse(); using (objSOMEntities = new SOMEntities()) using (objIPEntities = new IntranetPortalEntities()) { var userDet = objIPEntities.EmpMasters.Where(r => r.UserName == userName && r.IsActive == true).FirstOrDefault(); if (userDet != null) { EmpMasterModel model = new EmpMasterModel(); model.UserName = userDet.UserName; model.EmployeeName = userDet.EmployeeName; model.UserRole = userDet.UserRole; model.EmployeeNumber = userDet.EmployeeNumber; model.Department = userDet.Department; model.Grade = userDet.Grade; baseModel = new RepositoryResponse { success = true, message = "user Details retrieved Successfully", Data = model }; } else { baseModel = new RepositoryResponse { success = false, message = "user Details not available" }; } } return(baseModel); }
public bool SendEmailUsingSOM_HoD_Reject_Nominee(string nominationID, string loggedInUserID) { string subject = string.Empty; string message = string.Empty; //string subject = "Star of the Month HoD Reject to Nominee"; //string message = "Dear ##UserName##, <br><br>"; //message += "<pre> The HoD user has rejected Nomination from please refer HoD comments section. Please find the below details. " + "</pre><br><br>"; //message += "<pre> HoD Name : ##HODUserName## </pre>"; //message += "<pre> HoD Employee No : ##HODUserNo## </pre>"; //message += "<pre> HoD Comments : ##HoDComments## </pre>"; //message += "<pre> Nominee User Name : ##NomineeUserName## </pre>"; //message += "<pre> Nominee Employee No : ##NomineeUserNo## </pre>"; //message += "<pre> Nomination ID : ##NominationID## </pre>"; //message += "<pre> Project Title : ##ProjectTitle## </pre>"; //message += "<pre> Submitted Month : ##SubMonth## </pre>"; //message += "<pre> Submitted Year : ##SubYear## </pre>"; //message += "<br><br>"; //message += "Thanks,<br>"; //message += "##NomineeUserName##"; using (objSOMEntities = new SOMEntities()) using (objIPEntities = new IntranetPortalEntities()) { var nom = objSOMEntities.Nominations.Where(r => r.NominationId == nominationID).FirstOrDefault(); var emp = objIPEntities.EmpMasters.Where(r => r.EmployeeNumber == nom.EmployeeNumber).FirstOrDefault(); var rptPerson = objIPEntities.EmpMasters.Where(r => r.EmployeeNumber == emp.ReportingPersonId.ToString()).FirstOrDefault(); message.Replace("##HODUserName##", rptPerson.EmployeeName); message.Replace("##HODUserNo##", rptPerson.EmployeeName); message.Replace("##HoDComments##", nom.DHComments); message.Replace("##UserName##", rptPerson.EmployeeName); message.Replace("##NomineeUserName##", emp.EmployeeName); message.Replace("##NomineeUserNo##", nom.EmployeeNumber); message.Replace("##NominationID##", nom.NominationId); message.Replace("##ProjectTitle##", nom.ProjectTitle); message.Replace("##SubMonth##", nom.SubmittedMonth); message.Replace("##SubYear##", nom.SubmittedYear); //ConfigurationModel emailDet = GetEmailDetails(); //EmailParam objEmail = new EmailParam(); //objEmail.PrimaryEnableSsl = true; //objEmail.PrimaryFrom = emailDet.FromUserID; //objEmail.PrimaryPassword = emailDet.Password; //objEmail.PrimaryPortNo = int.Parse(emailDet.PortNo); //objEmail.PrimarySMTP = emailDet.SMTP; //objEmail.ToEmailAddress = emp.EmployeeEmail; //objEmail.MailContent = message; //objEmail.MailSubject = subject; //SendEmail sendEmail = new SendEmail(); ////sendEmail.SendEmailUsingPrimary(objEmail); return(SendEmail_New.SendHtmlFormattedEmail(message, subject, emp.EmployeeEmail)); } }
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); }
public RepositoryResponse AddOrEditConfigurationDetails(ConfigurationModel model, string _loggedInUserID) { baseModel = new RepositoryResponse(); try { using (objSOMEntities = new SOMEntities()) { var db = objSOMEntities.Configurations.Where(r => r.ID == model.ID).First(); if (db == null) { db = new Configuration(); db.Description = model.Description; db.Module = model.Module; if (db.Module == "SMTP" && db.Type == "SMTPDetails") { db.Value = model.SMTP + "; " + model.PortNo + "; " + model.FromUserID + "; " + model.Password; } else { db.Value = model.Value; } db.Type = model.Type; db.CreatedBy = _loggedInUserID; objSOMEntities.Configurations.Add(db); objSOMEntities.SaveChanges(); baseModel = new RepositoryResponse { success = true, message = "Successfully Added Configuration Details" }; } else { //db.Description = model.Description; if (db.Module == "SMTP" && db.Type == "SMTPDetails") { db.Value = model.SMTP + "; " + model.PortNo + "; " + model.FromUserID + "; " + model.Password; } else { db.Value = model.Value; } db.ModifiedBy = _loggedInUserID; objSOMEntities.SaveChanges(); baseModel = new RepositoryResponse { success = true, message = "Successfully updated Configuration Details" }; } } } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = ex.ToString() }; } return(baseModel); }
public RepositoryResponse GetNotificationsByEmployeeNumberTOP3(string userID) { try { List <Notification> lstNotifications = new List <Notification>(); string mes = string.Empty; using (objSOMEntities = new SOMEntities()) { lstNotifications = objSOMEntities.Notifications.Where(r => r.DestinationUser == userID && r.IsActive == true && r.UserSeen == false).OrderByDescending(r => r.ID).Take(3).ToList(); string messageFormat = "<li> " + "<p> " + "##message##<a href='/Dashboard/Notification'> more details... </a> " + "<span class='timeline-icon'><i class='fa fa-bell' style='color:##colorName##'></i></span> " + "<span class='timeline-date'>##dateTime##</span> " + "</p> " + "</li> "; int _count = 0; foreach (var item in lstNotifications) { mes = item.Message; if ((bool)item.UserSeen) { string mess = string.Empty; mess = messageFormat.Replace("##message##", item.Message); mess = mess.Replace("##colorName##", "red"); mess = mess.Replace("##dateTime##", item.CreatedDate); _message += mess; _count += 1; } else { string mess = string.Empty; mess = messageFormat.Replace("##message##", item.Message); mess = mess.Replace("##colorName##", "green"); mess = mess.Replace("##dateTime##", item.CreatedDate); //mess = mess.Replace("##dateTime##", Helper.DateFormater(item.CreatedDate) + ", " + Helper.TimeFormater(item.CreatedTime)); _message += mess; } } } baseModel = new RepositoryResponse { success = true, message = "Notification Details added Successfully", Data = _message }; } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = "Notification Details unable to add", Data = "" }; } return(baseModel); }
public bool SendEmailUsingSOM_Nominee_Submit_HOD(string nominationID, string loggedInUserID) { string subject = string.Empty; string message = string.Empty; //string subject = "Star of the Month Nominee Form Submit to HoD"; //string message = "Dear ##UserName##, <br><br>"; //message += "<pre> The below Nominee user has submitted Nomination from for your review. Please find the below details. " + "</pre><br><br>"; //message += "<pre> Nominee User name : ##NomineeUserName## </pre>"; //message += "<pre> Nominee Employee No : ##NomineeUserNo## </pre>"; //message += "<pre> Nomination ID : ##NominationID## </pre>"; //message += "<pre> Project Title : ##ProjectTitle## </pre>"; //message += "<pre> Submitted Month : ##SubMonth## </pre>"; //message += "<pre> Submitted Year : ##SubYear## </pre>"; //message += "<br><br>"; //message += "Thanks,<br>"; //message += "##NomineeUserName##"; using (objSOMEntities = new SOMEntities()) using (objIPEntities = new IntranetPortalEntities()) { var config = objSOMEntities.Configurations.Where(r => r.Module == "MAIL" && r.Type == "Nomination" && r.IsActive == true).FirstOrDefault(); message = config.Value; subject = config.Description; var nom = objSOMEntities.Nominations.Where(r => r.NominationId == nominationID).FirstOrDefault(); var emp = objIPEntities.EmpMasters.Where(r => r.EmployeeNumber == nom.EmployeeNumber).FirstOrDefault(); var rptPerson = objIPEntities.EmpMasters.Where(r => r.EmployeeNumber == emp.ReportingPersonId.ToString()).FirstOrDefault(); message.Replace("##UserName##", rptPerson.EmployeeName); message.Replace("##NomineeUserName##", emp.EmployeeName); message.Replace("##NomineeUserNo##", nom.EmployeeNumber); message.Replace("##NominationID##", nom.NominationId); message.Replace("##ProjectTitle##", nom.ProjectTitle); message.Replace("##SubMonth##", nom.SubmittedMonth); message.Replace("##SubYear##", nom.SubmittedYear); //ConfigurationModel emailDet = GetEmailDetails(); //EmailParam objEmail = new EmailParam(); //objEmail.PrimaryEnableSsl = true; //objEmail.PrimaryFrom = emailDet.FromUserID; //objEmail.PrimaryPassword = emailDet.Password; //objEmail.PrimaryPortNo = int.Parse(emailDet.PortNo); //objEmail.PrimarySMTP = emailDet.SMTP; //objEmail.ToEmailAddress = rptPerson.EmployeeEmail; //objEmail.MailContent = message; //objEmail.MailSubject = subject; //SendEmail sendEmail = new SendEmail(); //sendEmail.SendEmailUsingPrimary(objEmail); return(SendEmail_New.SendHtmlFormattedEmail(message, subject, rptPerson.EmployeeEmail)); } }
public RepositoryResponse AddOrEditTQCHeadDetails(TQCHeadModel model, string _loggedInUserID) { baseModel = new RepositoryResponse(); TQCHead dbModel; try { using (objSOMEntities = new SOMEntities()) { DateTime now = DateTime.Now; dbModel = new TQCHead(); //var usr = objSOMEntities.EmpMasters.Where(r => r.EmpID == model.EmployeeID).FirstOrDefault(); dbModel = objSOMEntities.TQCHeads.Where(r => r.ID == model.ID).FirstOrDefault(); if (dbModel != null) { dbModel.StartDate = Assistant.SOMDateConversionFrom_UIToDb((DateTime)model.StartDate); dbModel.EndDate = "01019999"; dbModel.EmployeeNumber = model.EmpNumber; dbModel.Name = model.EmpName; dbModel.IsActive = true; dbModel.ModifiedBy = _loggedInUserID; objSOMEntities.SaveChanges(); baseModel = new RepositoryResponse { success = true, message = "TQC Head Details updated Successfully" }; } else { dbModel = new TQCHead(); dbModel.EmployeeNumber = model.EmpNumber; dbModel.Name = model.EmpName; dbModel.StartDate = Assistant.SOMDateConversionFrom_UIToDb((DateTime)model.StartDate); dbModel.EndDate = "01019999"; dbModel.IsActive = true; dbModel.CreatedBy = _loggedInUserID; objSOMEntities.TQCHeads.Add(dbModel); objSOMEntities.SaveChanges(); baseModel = new RepositoryResponse { success = true, message = "TQC Head Details added Successfully" }; } } } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = ex.ToString() }; } return(baseModel); }
public RepositoryResponse AddOrEditPanelMembersDetails(PanelMembersModel model, string _loggedInUserID) { baseModel = new RepositoryResponse(); EvaluatorAvailability dbModel; try { using (objSOMEntities = new SOMEntities()) using (objIPEntities = new IntranetPortalEntities()) { DateTime now = DateTime.Now; dbModel = new EvaluatorAvailability(); var usr = objIPEntities.EmpMasters.Where(r => r.EmployeeNumber == model.EvaluatorID.ToString()).FirstOrDefault(); dbModel = objSOMEntities.EvaluatorAvailabilities.Where(r => r.ID == model.ID && r.Month == model.MonthFilter && r.Year == model.YearFilter).FirstOrDefault(); if (dbModel != null) { dbModel.EvaluatorID = usr.EmployeeNumber; dbModel.Month = model.MonthFilter; dbModel.Year = model.YearFilter; dbModel.IsActive = true; dbModel.ModifiedBy = _loggedInUserID; objSOMEntities.SaveChanges(); baseModel = new RepositoryResponse { success = true, message = "Panel Members Details updated Successfully" }; } else { dbModel = new EvaluatorAvailability(); dbModel.EvaluatorID = usr.EmployeeNumber; dbModel.Month = model.MonthFilter; dbModel.Year = model.YearFilter; dbModel.IsActive = true; dbModel.CreatedBy = _loggedInUserID; objSOMEntities.EvaluatorAvailabilities.Add(dbModel); objSOMEntities.SaveChanges(); baseModel = new RepositoryResponse { success = true, message = "Panel Members Details added Successfully" }; } } } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = ex.ToString() }; } return(baseModel); }
public RepositoryResponse GetAllTQCHeadDatas(string dept, string date) { baseModel = new RepositoryResponse(); try { string subMonth = string.Empty; string subYear = string.Empty; if (!string.IsNullOrEmpty(date)) { string[] sDate = date.Split('-'); subMonth = sDate[0]; subYear = sDate[1]; } List <TQCHeadModel> _lstTQCHead = new List <TQCHeadModel>(); using (objSOMEntities = new SOMEntities()) { var lstTQCHead = objSOMEntities.TQCHeads.OrderBy(r => r.IsActive).ToList(); int i = 1; foreach (var item in lstTQCHead) { TQCHeadModel _TQCHead = new TQCHeadModel(); _TQCHead.ID = item.ID; _TQCHead.SlNo = i; _TQCHead.EmployeeID = long.Parse(item.EmployeeNumber); _TQCHead.EmpNumber = item.EmployeeNumber; _TQCHead.EmpName = item.Name; _TQCHead.StartDate_Grid = Assistant.SOMDbToUIDateConversion(item.StartDate); _TQCHead.EndDate_Grid = Assistant.SOMDbToUIDateConversion(item.EndDate); _TQCHead.IsActive = (bool)item.IsActive; _lstTQCHead.Add(_TQCHead); i++; } baseModel = new RepositoryResponse { success = true, message = "Get TQC Head details Successfully", Data = _lstTQCHead }; } } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = ex.ToString() }; } return(baseModel); }
public string getPageAccessForNomination() { using (objSOMEntities = new SOMEntities()) { var objConfig = objSOMEntities.Configurations.Where(r => r.Module == "USERRole" && r.Type == "NominationUserRole" && r.IsActive == true).FirstOrDefault(); if (objConfig != null) { return(objConfig.Value); } else { return(""); } } }
public int GetEvaluationCount(string loggedInUserID, int SOMUserGrade) { int count = 0; using (objSOMEntities = new SOMEntities()) { var Codes3 = objSOMEntities.AuditLogs.Where(r => r.EvaluatorID == loggedInUserID && r.IsNewAlert == true && (r.CurrentStatus == (int)NominationStatus.TQC_Assign_Evaluator)).ToList(); if (Codes3 != null) { count = Codes3.Count; } } return(count); }
public RepositoryResponse GetPanelMembersByID(long ID) { baseModel = new RepositoryResponse(); try { PanelMembersModel model = new PanelMembersModel(); using (objSOMEntities = new SOMEntities()) using (objIPEntities = new IntranetPortalEntities()) { var data = (from a in objIPEntities.EmpMasters.AsEnumerable() join b in objSOMEntities.EvaluatorAvailabilities.AsEnumerable() on a.EmployeeNumber equals b.EvaluatorID.ToString() where b.ID == ID && b.IsActive == true select new { a, b }).FirstOrDefault(); //var data = objSOMEntities.Nominations.Where(r => r.ID == ID && r.IsActive == true).FirstOrDefault(); if (data != null) { model.MonthFilterlst = LoadListofMonth(data.b.Month); model.YearFilterlst = LoadListofFutureYears(5, data.b.Year); model.ID = data.b.ID; model.EvaluatorID = data.b.EvaluatorID; model.Name = data.a.EmployeeName; model.MonthFilter = data.b.Month; model.YearFilter = data.b.Year; baseModel = new RepositoryResponse { success = true, message = "Get Panel Members details Successfully", Data = model }; } else { baseModel = new RepositoryResponse { success = false, message = "Unable to get Panel Members details", Data = model }; } } } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = ex.ToString() }; } return(baseModel); }
public RepositoryResponse AddPanelMembers(string data, string _loggedInUserID) { baseModel = new RepositoryResponse(); try { if (!string.IsNullOrEmpty(data)) { string[] _dataStr = data.Split(','); foreach (var item in _dataStr) { if (!string.IsNullOrEmpty(item)) { string month = Assistant.GetMonthFromCurrentDate(); string year = Assistant.GetYearFromCurrentDate(); using (objSOMEntities = new SOMEntities()) { var _details = objSOMEntities.EvaluatorAvailabilities.Where(r => r.EvaluatorID == item && r.IsActive == true && r.Month == month && r.Year == year).FirstOrDefault(); if (_details == null) { EvaluatorAvailability dbModel = new EvaluatorAvailability(); dbModel.EvaluatorID = item; dbModel.CreatedBy = _loggedInUserID; dbModel.IsActive = true; dbModel.Month = month; dbModel.Year = year; objSOMEntities.EvaluatorAvailabilities.Add(dbModel); objSOMEntities.SaveChanges(); } } baseModel = new RepositoryResponse { success = true, message = "Panel Members Added Successfully" }; } } } } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = ex.ToString() }; } return(baseModel); }
public int GetAdminCount(string loggedInUserID, int SOMUserGrade) { int count = 0; using (objSOMEntities = new SOMEntities()) { var Codes1 = new[] { (int)NominationStatus.HoD_Reject }; var _Codes1 = objSOMEntities.AuditLogs.Where(r => r.IsNewAlert == true && Codes1.Contains((int)r.CurrentStatus)).ToList(); if (_Codes1 != null) { count = _Codes1.Count; } } return(count); }
public List <SelectListItem> GetDepartmentDetails(string selectedDept, string selectDetpOnly) { List <SelectListItem> lstSelect = new List <SelectListItem>(); if (string.IsNullOrEmpty(selectDetpOnly)) { lstSelect.Add(new SelectListItem { Text = "--ALL--", Value = "0", Selected = true }); } using (objSOMEntities = new SOMEntities()) using (objIPEntities = new IntranetPortalEntities()) { var emp = objIPEntities.EmpMasters.Where(r => r.IsActive == true).Select(r => r.Department).Distinct().ToList(); foreach (var item in emp) { SelectListItem objSelectListItem = new SelectListItem(); if (string.IsNullOrEmpty(selectDetpOnly)) { objSelectListItem.Text = item;//its displayed in UI objSelectListItem.Value = item; if (!string.IsNullOrEmpty(selectedDept) && selectedDept == item) { objSelectListItem.Selected = true; } lstSelect.Add(objSelectListItem); } else { if (item == selectDetpOnly) { objSelectListItem.Text = item;//its displayed in UI objSelectListItem.Value = item; if (!string.IsNullOrEmpty(selectedDept) && selectedDept == item) { objSelectListItem.Selected = true; } lstSelect.Add(objSelectListItem); } } } } return(lstSelect); }
public int GetHoDCount(string loggedInUserID, int SOMUserGrade) { int count = 0; using (objSOMEntities = new SOMEntities()) { var Codes2 = new[] { (int)NominationStatus.Employee_Assign_HOD, (int)NominationStatus.Employee_ReAssign_HoD }; var _Codes2 = objSOMEntities.AuditLogs.Where(r => r.DepartmentHeadID == loggedInUserID && r.IsNewAlert == true && Codes2.Contains((int)r.CurrentStatus)).ToList(); if (_Codes2 != null) { count = _Codes2.Count; } } return(count); }
public RepositoryResponse CheckUser(LoginModel login) { RepositoryResponse baseModel = new RepositoryResponse(); try { using (objSOMEntities = new SOMEntities()) using (objIPEntities = new IntranetPortalEntities()) { EmployeeModel model = new EmployeeModel(); var emp = objIPEntities.EmpMasters.Where(r => r.EmployeeName == login.Username && r.Password == login.Password && r.IsActive == true).FirstOrDefault(); if (emp != null && emp.EmpID > 0) { model = new EmployeeModel(); model.ID = emp.EmpID; model.Name = emp.EmployeeName; //model. //model.Role = emp.Role; model.UserName = emp.EmployeeName; model.EmailID = emp.EmployeeEmail; baseModel.Data = model; baseModel.message = "Date Retrieved Successfully"; baseModel.success = true; return(baseModel); } else { baseModel.Data = model; baseModel.message = "Unable to retrieve data"; baseModel.success = false; return(baseModel); } } } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = ex.ToString() }; } return(baseModel); }
public int GetTQCCount(string loggedInUserID, int SOMUserGrade) { int count = 0; using (objSOMEntities = new SOMEntities()) { var Codes = new[] { (int)NominationStatus.HoD_Assign_TQC, (int)NominationStatus.Evaluators_Assign_TQC }; var tqcUsrCount = objSOMEntities.AuditLogs.Where(r => r.IsNewAlert == true && Codes.Contains((int)r.CurrentStatus)).ToList(); if (tqcUsrCount != null) { count = tqcUsrCount.Count; } } return(count); }
public ConfigurationModel GetEmailDetails() { ConfigurationModel model = new ConfigurationModel(); using (objSOMEntities = new SOMEntities()) { var _data = objSOMEntities.Configurations.Where(r => r.Module == "SMTP" && r.Type == "SMTPDetails" && r.IsActive == true).FirstOrDefault(); if (!string.IsNullOrEmpty(_data.Value)) { string[] split = _data.Value.Split(';'); model.SMTP = split[0]; model.PortNo = split[1]; model.FromUserID = split[2]; model.Password = split[3]; } } return(model); }
public int GetNominationCount(string loggedInUserID, int SOMUserGrade) { int count = 0; using (objSOMEntities = new SOMEntities()) { var Codes4 = new[] { (int)NominationStatus.HoD_Reject, (int)NominationStatus.HoD_Assign_EmployeeClarification, (int)NominationStatus.AdminReopen, (int)NominationStatus.Evaluator_Reject }; var _Codes4 = objSOMEntities.AuditLogs.Where(r => r.EmployeeNumber == loggedInUserID && r.IsNewAlert == true && Codes4.Contains((int)r.CurrentStatus)).ToList(); if (_Codes4 != null) { count = _Codes4.Count; } } return(count); }
public RepositoryResponse GetTQCHeadDetailsByID(long ID) { baseModel = new RepositoryResponse(); try { TQCHeadModel model = new TQCHeadModel(); using (objSOMEntities = new SOMEntities()) { var data = objSOMEntities.TQCHeads.Where(r => r.ID == ID).FirstOrDefault(); if (data != null) { model.ID = data.ID; model.EmployeeID = long.Parse(data.EmployeeNumber); model.EmpName = data.Name; model.StartDate_Grid = Assistant.SOMDbToUIDateConversionForPopup(data.StartDate); model.EndDate_Grid = Assistant.SOMDbToUIDateConversionForPopup(data.EndDate);; //model.IsActive = (bool)data.IsActive; baseModel = new RepositoryResponse { success = true, message = "Get TQC Head details Successfully", Data = model }; } else { baseModel = new RepositoryResponse { success = false, message = "Unable to get TQC Head details", Data = model }; } } } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = ex.ToString() }; } return(baseModel); }
public RepositoryResponse LoadConfigurationGridData() { baseModel = new RepositoryResponse(); try { string subMonth = string.Empty; string subYear = string.Empty; List <ConfigurationModel> lstConfig = new List <ConfigurationModel>(); using (objSOMEntities = new SOMEntities()) { var _lstlstConfig = objSOMEntities.Configurations.Where(r => r.IsActive == true && r.IsDisplayUI == true).ToList(); int i = 1; foreach (var item in _lstlstConfig) { ConfigurationModel model = new ConfigurationModel(); model.SlNo = i; model.ID = item.ID; model.Description = item.Description; model.IsActive = (bool)item.IsActive; model.Module = item.Module; model.Type = item.Type; model.Value = item.Value.Replace(",", ", "); lstConfig.Add(model); i++; } baseModel = new RepositoryResponse { success = true, message = "Successfully Configuration retrieved for Grid", Data = lstConfig }; } } catch (Exception ex) { baseModel = new RepositoryResponse { success = false, message = ex.ToString() }; } return(baseModel); }