public ActionResult Add(long UserId = 0, bool IsActive = true)
        {
            string errorMessage = string.Empty;

            Session[ConstantTexts.UserAccessGroupSessionKey] = null;
            try
            {
                DOADM_UserMaster     objDOADM_UserMaster     = new DOADM_UserMaster();
                BLUserAdministration objBLUserAdministration = new BLUserAdministration();
                objDOADM_UserMaster.IsManager = false;//set value since it is nullable
                objDOADM_UserMaster.StartDate = DateTime.UtcNow;
                objDOADM_UserMaster.EndDate   = DateTime.UtcNow.AddYears(10);
                objDOADM_UserMaster.IsActive  = true;
                long?TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime;

                if (UserId != 0)
                {
                    List <DOADM_UserMaster> lstDOADM_UserMaster = new List <DOADM_UserMaster>();
                    objDOADM_UserMaster.ADM_UserMasterId = UserId;
                    objDOADM_UserMaster.IsActive         = IsActive;
                    objBLUserAdministration.SearchUser(TimeZone, objDOADM_UserMaster, out lstDOADM_UserMaster, out errorMessage);
                    if (lstDOADM_UserMaster.Count > 0)
                    {
                        objDOADM_UserMaster = lstDOADM_UserMaster.FirstOrDefault();
                        Session[ConstantTexts.UserAccessGroupSessionKey] = objDOADM_UserMaster.lstDOADM_AccessGroupUserCorrelation;
                    }
                }

                DOADM_UserMaster objManagerSearch = new DOADM_UserMaster()
                {
                    IsActive  = true,
                    IsManager = true
                };

                ExceptionTypes result = objBLUserAdministration.SearchUser(TimeZone, objManagerSearch, out List <DOADM_UserMaster> lstManagers, out errorMessage);

                objDOADM_UserMaster.lstManagers = lstManagers.OrderBy(x => x.FullName).ToList();
                if (UserId != 0)
                {
                    objDOADM_UserMaster.lstManagers.RemoveAll(x => x.ADM_UserMasterId == UserId);
                }

                objDOADM_UserMaster.lstLocation   = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Location);
                objDOADM_UserMaster.lstTimeZone   = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Timezone);
                objDOADM_UserMaster.lstState      = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.State);
                objDOADM_UserMaster.lstSalutation = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Salutation);
                ViewBag.AccessGroups = GetAllAccessGroups();

                return(View(objDOADM_UserMaster));
            }
            catch (Exception ex)
            {
                BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageUsers, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString());
                return(RedirectToAction("Maintenance", "Error", new { Error = MethodBase.GetCurrentMethod().Name + " Action terminated and redirected to Maintenance. Error:" + ex.ToString() }));
            }
        }
        public ActionResult CheckUserExistsUsingMSID(string MSID)
        {
            string strErrorMessage = string.Empty;
            string strMessage      = string.Empty;
            bool   MsidExists      = false;
            long?  TimeZone        = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime;

            try
            {
                BLUserAdministration objBLUserAdministration = new BLUserAdministration();
                DOADM_UserMaster     objDOADM_UserMaster     = new DOADM_UserMaster();
                objDOADM_UserMaster.MSID     = MSID;
                objDOADM_UserMaster.IsActive = true;
                List <DOADM_UserMaster> lstDOADM_UserMaster;

                ExceptionTypes result = objBLUserAdministration.SearchUser(TimeZone, objDOADM_UserMaster, out lstDOADM_UserMaster, out strErrorMessage);
                if (lstDOADM_UserMaster.Count > 0)
                {
                    MsidExists = true;
                }
                else
                {
                    objDOADM_UserMaster.IsActive = false;//search again to check for not active records
                    result = objBLUserAdministration.SearchUser(TimeZone, objDOADM_UserMaster, out lstDOADM_UserMaster, out strErrorMessage);
                    if (lstDOADM_UserMaster.Count > 0)
                    {
                        MsidExists = true;
                    }
                    else
                    {
                        MsidExists = false;
                    }
                }
            }
            catch (Exception ex)
            {
                BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageUsers, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString());
                return(RedirectToAction("Maintenance", "Error", new { Error = MethodBase.GetCurrentMethod().Name + " Action terminated and redirected to Maintenance. Error:" + ex.ToString() }));
            }
            return(Json(new { MsidExists = MsidExists, strMessage = strMessage }, JsonRequestBehavior.AllowGet));
        }
        public List <DOADM_UserMaster> GetUserSearchResult(long?TimeZone, DOADM_UserMaster objDOADM_UserMaster, out string strErrorMessage)
        {
            BLUserAdministration    objBLUserAdministration = new BLUserAdministration();
            List <DOADM_UserMaster> lstDOADM_UserMaster     = new List <DOADM_UserMaster>();

            try
            {
                ExceptionTypes result = objBLUserAdministration.SearchUser(TimeZone, objDOADM_UserMaster, out lstDOADM_UserMaster, out strErrorMessage);
                if (result != (long)ExceptionTypes.Success)
                {
                    //Log Error
                    BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageUsers, (long)ExceptionTypes.Uncategorized, string.Empty, "Error Occured while doing User Search");
                }
            }
            catch (Exception ex)
            {
                BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageUsers, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString());
                strErrorMessage = ex.ToString();
            }
            return(lstDOADM_UserMaster);
        }
        public ActionResult CreateRPRCase(string memberFName = "", string memberLName = "", string memberDOB = "", string hICN = "", string mIIMReferenceId = "")
        {
            ViewBag.PageName = ConstantTexts.MiimPageName;
            try
            {
                string requestData = "memberFName : " + memberFName + ",memberLName : " + memberLName + ",memberDOB : " + memberDOB + ",string hICN : " + hICN + ",string mIIMReferenceId : " + mIIMReferenceId;

                MIIMServiceLog(MethodBase.GetCurrentMethod().Name, requestData, ConstantTexts.MIIMNew, _currentLoginUserId, TarceMethodLkup.New.ToLong(), (long)MIIMServiceMethod.CreateRPRCase);
                #region Create Session
                ExceptionTypes result = CreateSession(WorkBasket.RPR);
                #endregion

                if (result == ExceptionTypes.Success)
                {
                    MIIMServiceLog(MethodBase.GetCurrentMethod().Name, requestData, ConstantTexts.MIIMUserAuthSucc, _currentLoginUserId, TarceMethodLkup.InProgress.ToLong(), (long)MIIMServiceMethod.CreateRPRCase);
                    DOGEN_Queue objDOGEN_Queue = new DOGEN_Queue();
                    #region Dropdowns Binding
                    List <DOADM_UserMaster> lstUsers;
                    DOADM_UserMaster        objDOADM_UserMaster = new DOADM_UserMaster();
                    objDOADM_UserMaster.IsActive = true;
                    BLUserAdministration objBLUserAdministration = new BLUserAdministration();
                    long?TimeZone = (long)DefaultTimeZone.CentralStandardTime;
                    result = objBLUserAdministration.SearchUser(TimeZone, objDOADM_UserMaster, out lstUsers, out string errorMessage);
                    objDOGEN_Queue.ComplianceStartDate  = DateTime.UtcNow;
                    objDOGEN_Queue.DiscrepancyStartDate = objDOGEN_Queue.ComplianceStartDate.Value.AddMonths(1);
                    objDOGEN_Queue.DiscrepancyStartDate = new DateTime(objDOGEN_Queue.DiscrepancyStartDate.Value.Year, objDOGEN_Queue.DiscrepancyStartDate.Value.Month, 1);
                    objDOGEN_Queue.lstUsers             = lstUsers.Where(x => x.ADM_UserMasterId > 1000 && x.IsManager).OrderBy(x => x.Email).ToList();//Filtered 1st three Users as Admin.sort list by email id
                    objDOGEN_Queue.lstLob                = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.LOB);
                    objDOGEN_Queue.lstDiscCategary       = CacheUtility.GetAllLookupMasterCorrelationFromCache((long)LookupTypesCorrelation.WorkBasketVsDiscripancyCategory, (long)WorkBasket.RPR);
                    objDOGEN_Queue.lstContractid         = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Contract);
                    objDOGEN_Queue.lstPbpid              = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.PBPID);
                    objDOGEN_Queue.lstActionRequested    = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.RPRActionRequested);
                    objDOGEN_Queue.lstTaskBeingPerformed = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Taskbeingperformedwhenthisdiscrepancywasidentified);
                    objDOGEN_Queue.lstDiscType           = CacheUtility.GetAllLookupMasterCorrelationFromCache((long)LookupTypesCorrelation.DiscripancyCategoryVsDiscripancyType, (long)DiscripancyCategory.RPR);
                    #endregion

                    objDOGEN_Queue.MemberFirstName = memberFName;
                    objDOGEN_Queue.MemberLastName  = memberLName;
                    objDOGEN_Queue.MIIMReferenceId = mIIMReferenceId;
                    bool isDobCorrect = DateTime.TryParse(memberDOB, out DateTime dtMemberDob);
                    if (isDobCorrect)
                    {
                        objDOGEN_Queue.MemberDOB = dtMemberDob.AddDays(1);
                    }
                    objDOGEN_Queue.MemberCurrentHICN = hICN;
                    MIIMServiceLog(MethodBase.GetCurrentMethod().Name, requestData, ConstantTexts.MIIMRequestCompleted, _currentLoginUserId, TarceMethodLkup.Completed.ToLong(), (long)MIIMServiceMethod.CreateRPRCase);
                    return(View("~/Views/RPR/Create.cshtml", objDOGEN_Queue));
                }
                else if (result == ExceptionTypes.UnknownError)
                {
                    MIIMServiceLog(MethodBase.GetCurrentMethod().Name, requestData, ConstantTexts.MIIMUserAuthFail, _currentLoginUserId, TarceMethodLkup.Completed.ToLong(), (long)MIIMServiceMethod.CreateRPRCase);
                    ViewBag.ErrorMessage = "\nYou are not part of ERS DB.\nPlease contact administrator";
                    return(View("~/Views/Shared/Error.cshtml"));
                }
                else
                {
                    MIIMServiceLog(MethodBase.GetCurrentMethod().Name, requestData, ConstantTexts.MIIMUserAuthFail, _currentLoginUserId, TarceMethodLkup.Completed.ToLong(), (long)MIIMServiceMethod.CreateRPRCase);
                    ViewBag.ErrorMessage = "\nYou do not have permission to access this page.\nPlease contact administrator";
                    return(View("~/Views/Shared/Error.cshtml"));
                }
            }
            catch (Exception ex)
            {
                MIIMServiceLog(MethodBase.GetCurrentMethod().Name, "", ex.ToString(), _currentLoginUserId, TarceMethodLkup.Failed.ToLong(), (long)MIIMServiceMethod.CreateRPRCase);
                BLCommon.LogError(_currentLoginUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.MIIMConnector, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.Message);
                return(View("~/Views/Shared/Error.cshtml"));
            }
        }
Beispiel #5
0
        public ActionResult Add(long AlertId = 0, bool isActive = true)
        {
            DOADM_AlertDetails objDOADM_AlertDetails = new DOADM_AlertDetails();

            objDOADM_AlertDetails.IsActive = true;
            string errorMessage = string.Empty;

            try
            {
                ExceptionTypes result;

                //get list of users for Send ALert to Indiviual drop down
                List <DOADM_UserMaster> lstUsers;
                BLUserAdministration    objBLUserAdministration = new BLUserAdministration();
                DOADM_UserMaster        objDOADM_UserMaster     = new DOADM_UserMaster();
                objDOADM_UserMaster.IsActive = true;
                long?TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime;
                result = objBLUserAdministration.SearchUser(TimeZone, objDOADM_UserMaster, out lstUsers, out errorMessage);
                //check result for DB action
                if (result != (long)ExceptionTypes.Success)
                {
                    BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Alerts, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage);
                }
                //Filtered 1st three Users as Admin.sort list by email id
                lstUsers = lstUsers.Where(x => x.ADM_UserMasterId > 1000).OrderBy(x => x.Email).ToList();

                //get list of Depatments for Send ALert to Department drop down
                List <DOCMN_Department> lstCMN_Department;
                BLDepartment            objBLDepartment     = new BLDepartment();
                DOCMN_Department        objDOCMN_Department = new DOCMN_Department();
                objDOCMN_Department.IsActive = true;
                result = objBLDepartment.SearchDepartment(TimeZone, objDOCMN_Department, out lstCMN_Department, out errorMessage);
                //check result for DB action
                if (result != (long)ExceptionTypes.Success)
                {
                    BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Alerts, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage);
                }
                //sort list by Depatment name
                lstCMN_Department = lstCMN_Department.OrderBy(x => x.ERSDepartmentName).ToList();

                if (AlertId != 0)
                {
                    //temporary list to hold search alerts results
                    List <DOADM_AlertDetails> lstDOADM_AlertDetails = new List <DOADM_AlertDetails>();
                    //temporary object for search alerts function
                    DOADM_AlertDetails objDOADM_AlertDetails_Find = new DOADM_AlertDetails();
                    objDOADM_AlertDetails_Find.ADM_AlertDetailsId = AlertId;
                    objDOADM_AlertDetails_Find.IsActive           = isActive;
                    result = _objBLAlerts.SearchAlerts(TimeZone, objDOADM_AlertDetails_Find, out lstDOADM_AlertDetails, out errorMessage);
                    //check result for DB action
                    if (result != (long)ExceptionTypes.Success)
                    {
                        BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Alerts, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage);
                    }
                    if (lstDOADM_AlertDetails.Count > 0)
                    {
                        objDOADM_AlertDetails = lstDOADM_AlertDetails.FirstOrDefault();
                    }
                }

                objDOADM_AlertDetails.lstUsers          = lstUsers;
                objDOADM_AlertDetails.lstCMN_Department = lstCMN_Department;
                //Alert criticality lookup from Cache
                objDOADM_AlertDetails.lstAlertCriticalityLkup = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.AlertCriticality);
                //Send Alert To lookup from Cache
                objDOADM_AlertDetails.lstSendAlertToLkup = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.SendAlertTo);
                //Alert Time Zone lookup from Cache
                objDOADM_AlertDetails.lstTimeZone = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Timezone);
                return(View(objDOADM_AlertDetails));
            }
            catch (Exception ex)
            {
                BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Alerts, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString());
                return(RedirectToAction("Maintenance", "Error", new { Error = ex.ToString() }));
            }
        }