Exemple #1
0
        public ActionResult Index()
        {
            StaffADProfile staffADProfile = new StaffADProfile();

            // staffADProfile.user_logon_name = Environment.UserName;
            staffADProfile.user_logon_name = User.Identity.Name;

            //   staffADProfile.user_logon_name = "ijeoma.okoye";

            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            Profile profile = new Profile();

            profile = new LinqCalls().getProfile(staffADProfile.employee_number);
            bool checkICA = new IC_A_Users().ValidateCheckApproverUser(staffADProfile.employee_number);

            ViewData["ICA"] = checkICA;
            bool checkAdmin = new IC_A_Users().ValidateAdminUser(staffADProfile.employee_number);

            ViewData["Admin"] = checkAdmin;
            if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS" || checkAdmin == true)
            {
                ViewData["HopUser"] = true;
            }
            else
            {
                ViewData["HopUser"] = false;
            }
            return(View());
        }
Exemple #2
0
        public ActionResult MyEntries( )
        {
            Session["UserName"] = @User.Identity.Name;
            this._UserName      = Session["UserName"] as string ?? "";

            if (_UserName == null || _UserName.Equals(String.Empty))
            {
                ViewBag.ErrorMessage = "You must be logged in to continue.";
                return(RedirectToAction("AwaitingMyApproval", "AwaitingApproval"));
            }

            //now resolve the user profile from AD and Xceed
            StaffADProfile staffADProfile = new StaffADProfile();

            staffADProfile.user_logon_name = _UserName;

            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            if (staffADProfile == null)
            {
                ViewBag.ErrorMessage = "Your profile is not properly setup on the system. Please contact InfoTech.";
                return(RedirectToAction("AwaitingMyApproval", "AwaitingApproval"));
            }

            //Check if the initiator/branch/has an existing entry for the AppraisalPeriod from the Database
            List <EntriesModel> entryDetails = new List <EntriesModel>();

            entryDetails = LINQCalls.getMyPassportWorkflows(staffADProfile);

            return(View(entryDetails));
        }
        public ActionResult SearchPage()
        {
            StaffADProfile staffADProfile = new StaffADProfile();

            //CurrentUser currentuser = new CurrentUser();
            staffADProfile.user_logon_name = User.Identity.Name;

            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            Profile profile = new Profile();

            profile = new LinqCalls().getProfile(staffADProfile.employee_number);
            bool checkICA = new IC_A_Users().ValidateCheckApproverUser(staffADProfile.employee_number);

            ViewData["ICA"] = checkICA;
            bool checkAdmin = new IC_A_Users().ValidateAdminUser(staffADProfile.employee_number);

            ViewData["Admin"] = checkAdmin;
            if (checkICA || checkAdmin)
            {
                ViewData["HopUser"] = false;
                //ViewData["ICA"] = true;

                return(View());
            }
            else
            {
                ViewData["HopUser"] = false;
                //ViewData["ICA"] = false;
                TempData["ErrorMessage"] = "You are not Authorized to view this page";
                //TempData["Approvernames"] = string.Join("\\n", approverNames);
                return(RedirectToAction("ErrorPage"));
            }
        }
        public ActionResult Manage_Approval_List()
        {
            StaffADProfile staffADProfile = new StaffADProfile();
            CurrentUser    currentuser    = new CurrentUser();

            staffADProfile.user_logon_name = User.Identity.Name;

            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile        = activeDirectoryQuery.GetStaffProfile();
            currentuser.UserNo    = staffADProfile.employee_number;
            currentuser.UserName  = staffADProfile.in_StaffName;
            currentuser.logonName = staffADProfile.user_logon_name;
            currentuser.Email     = staffADProfile.email;

            bool checkApproverUser = new AppClass().ValidateCheckApproverUser(currentuser.UserNo);

            ViewData["checkApproverUser"] = checkApproverUser;

            if (!checkApproverUser)
            {
                TempData["ErrorMessage"] = "";
                return(RedirectToAction("AwaitingApproval"));
            }
            else
            {
                ApproverInfo approvers = new ApproverInfo();
                //approvers = new AdminClass().GetApproverList();
                ViewBag.ErrorMessage = TempData["ErrorMessage"] as string;
                return(View(approvers));
            }
            //List<ApproverInfo> approvers = new List<ApproverInfo>();
        }
        public ActionResult Edit_Approver(string StaffNumber)
        {
            try
            {
                StaffADProfile staffADProfile = new StaffADProfile();
                CurrentUser    currentuser    = new CurrentUser();
                staffADProfile.user_logon_name = User.Identity.Name;

                ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

                staffADProfile     = activeDirectoryQuery.GetStaffProfile();
                currentuser.UserNo = staffADProfile.employee_number;

                bool checkApproverUser = new AppClass().ValidateCheckApproverUser(currentuser.UserNo);
                ViewData["checkApproverUser"] = checkApproverUser;

                ApproverInfo approvers = new ApproverInfo();
                approvers            = new AdminClass().GetApproverDetails(StaffNumber).First();
                ViewBag.ErrorMessage = TempData["ErrorMessage"] as string;
                return(View(approvers));
            }catch (Exception ex)
            {
                TempData["ErrorMessage"] = ex.Message;
                return(RedirectToAction("Edit_Approver"));
            }
        }
Exemple #6
0
        /*public ActionResult OpenTargetEntry( string WorkflowID , int RequestStageID) {
         *
         *  //string UserName = Request.LogonUserIdentity.Name.Substring(Request.LogonUserIdentity.Name.LastIndexOf(@"\") + 1);
         *  string UserName = @User.Identity.Name;
         *
         *  if( UserName == null || UserName.Equals(String.Empty)){
         *      ViewBag.ErrorMessage="You must be logged in to continue.";
         *      return RedirectToAction("AwaitingMyApproval","AwaitingApproval");
         *  }
         *
         *  //now resolve the user profile from AD and Xceed
         *  StaffADProfile staffADProfile = new StaffADProfile();
         *  staffADProfile.user_logon_name = UserName;
         *
         *
         *  //AD
         *  ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery( staffADProfile );
         *  staffADProfile = activeDirectoryQuery.GetStaffProfile();
         *  if( staffADProfile==null ){
         *      ViewBag.ErrorMessage="Your profile is not properly setup on the system. Please contact InfoTech.";
         *      return RedirectToAction( "AwaitingMyApproval","AwaitingApproval",new { UserName = Session["UserName"] as string } );
         *  }
         *
         *  string approvers = new LINQCalls().getApprovers( WorkflowID,RequestStageID );
         *  List<SignerDetails> realApprovers = new DataHandlers().GetApprovers( approvers );
         *  int index = realApprovers.FindIndex(f => f.ApproverStaffNumber == staffADProfile.employee_number);
         *  bool isApprover = ( index  >= 0 ) ? true : false;
         *
         *  return RedirectToAction( "EditTarget","InputTarget",new {WorkflowID=WorkflowID , editMode =isApprover  , myEntries=true } );
         * }*/
        public ActionResult OpenMemoEntry(string WorkflowID, int RequestStageID)
        {
            //string UserName = Request.LogonUserIdentity.Name.Substring(Request.LogonUserIdentity.Name.LastIndexOf(@"\") + 1);
            string UserName = @User.Identity.Name;

            if (UserName == null || UserName.Equals(String.Empty))
            {
                ViewBag.ErrorMessage = "You must be logged in to continue.";
                return(RedirectToAction("AwaitingMyApproval", "AwaitingApproval"));
            }

            //now resolve the user profile from AD and Xceed
            StaffADProfile staffADProfile = new StaffADProfile();

            staffADProfile.user_logon_name = UserName;


            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            if (staffADProfile == null)
            {
                ViewBag.ErrorMessage = "Your profile is not properly setup on the system. Please contact InfoTech.";
                return(RedirectToAction("AwaitingMyApproval", "AwaitingApproval", null));
            }

            string approvers = new LINQCalls().getApprovers(WorkflowID, RequestStageID);
            List <SignerDetails> realApprovers = new DataHandlers().GetApprovers(approvers);
            int  index      = realApprovers.FindIndex(f => f.ApproverStaffNumber == staffADProfile.employee_number);
            bool isApprover = (index >= 0) ? true : false;

            return(RedirectToAction("EditMemo", "MemoSetup", new { WorkflowID = WorkflowID, editMode = isApprover, myEntries = true }));
        }
        public ActionResult ErrorPage()
        {
            StaffADProfile staffADProfile = new StaffADProfile();

            // CurrentUser currentuser = new CurrentUser();
            staffADProfile.user_logon_name = User.Identity.Name;

            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();


            bool checkICA = new IC_A_Users().ValidateCheckApproverUser(staffADProfile.employee_number);

            ViewData["ICA"] = checkICA;
            bool checkAdmin = new IC_A_Users().ValidateAdminUser(staffADProfile.employee_number);

            ViewData["Admin"] = checkAdmin;

            Profile profile = new Profile();

            profile = new LinqCalls().getProfile(staffADProfile.employee_number);
            if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS" || checkAdmin == true)
            {
                ViewData["HopUser"] = true;
            }
            else
            {
                ViewData["HopUser"] = false;
            }
            ViewBag.ErrorMessage = TempData["ErrorMessage"] as string;
            return(View());
        }
Exemple #8
0
        public ActionResult AwaitingMyApproval()
        {
            /**First let's check if the PostBackMessage has something
             * Very important---DO NOT DELETE!!!!!!!!!!!!!!!!!!!!!**/

            Session["UserName"] = @User.Identity.Name;
            this.UserName       = Session["UserName"] as string ?? "";

            string PostBackMessage = TempData["PostBackMessage"] as string;
            string Approvers       = TempData["Approvers"] as string;

            this.UserName = Session["UserName"] as String ?? "";

            this.logWriter = new LogWriter();

            try {
                logWriter.WriteErrorLog(string.Format("about to PostBackMessage : Exception!!! / {0}", "Posted back"));

                if (!String.IsNullOrEmpty(PostBackMessage))
                {
                    logWriter.WriteErrorLog(string.Format("PostBackMessage Status : Exception!!! / {0}", "Posted back"));

                    ViewBag.PostBackMessage = string.Format("<script type='text/javascript'>alert(\"" + PostBackMessage + "\\n\\n{0}\");</script>", Approvers);
                }
                logWriter.WriteErrorLog(string.Format("After post back : Exception!!! / {0}", "Posted back"));

                //now get the pending items
                if (UserName == null || UserName.Equals(String.Empty))
                {
                    ViewBag.ErrorMessage = "You must be logged in to continue.";
                    return(View());
                }

                //now resolve the user profile from AD and Xceed
                StaffADProfile staffADProfile = new StaffADProfile();
                staffADProfile.user_logon_name = UserName;

                //AD
                ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);
                staffADProfile = activeDirectoryQuery.GetStaffProfile();
                if (staffADProfile == null)
                {
                    ViewBag.ErrorMessage = "Your profile is not properly setup on the system. Please contact InfoTech.";
                    return(View());
                }

                //Check if the approver has an existing entry in the Database
                logWriter.WriteErrorLog(string.Format("get Awaiting : about firing getMyPendingPassportWorkflows!!! / {0}", ""));

                List <EntriesModel> entryDetails = new List <EntriesModel>();
                entryDetails = LINQCalls.getMyPendingPassportWorkflows(staffADProfile);
                logWriter.WriteErrorLog(string.Format("Entry List : Staff Name!!! / {0}", entryDetails.First().StaffName));

                return(View(entryDetails));
            } catch (Exception ex) {
                logWriter.WriteErrorLog(string.Format("AwaitingMyApproval : Exception!!! / {0}", ex.Message));
                return(View());
            }
        }
        public ActionResult AwaitingApproval()
        {
            try
            {
                StaffADProfile staffADProfile = new StaffADProfile();

                // staffADProfile.user_logon_name = User.Identity.Name;
                CurrentUser currentuser = new CurrentUser();
                staffADProfile.user_logon_name = User.Identity.Name;

                ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

                staffADProfile        = activeDirectoryQuery.GetStaffProfile();
                currentuser.UserNo    = staffADProfile.employee_number;
                currentuser.UserName  = staffADProfile.in_StaffName;
                currentuser.logonName = staffADProfile.user_logon_name;
                currentuser.Email     = staffADProfile.email;
                List <TravelRequest> requestList = new List <TravelRequest>();
                bool checkApprover     = new AppClass().ValidateCurrentUser(currentuser);
                bool checkApproverUser = new AppClass().ValidateCheckApproverUser(currentuser.UserNo);
                ViewData["checkApproverUser"] = checkApproverUser;
                // bool checkAdmin = new AppClass().ValidateAdminUser(staffADProfile.employee_number);

                string Key = TempData["key"] as string;

                if (Key != "Approval")
                {
                    ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                                     "" : "<script type='text/javascript'>alert(\"" + TempData["ErrorMessage"] + "\\n\\n" + TempData["Approvernames"] + "\");</script>";
                }
                else
                {
                    ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                                     "" : "<script type='text/javascript'>alert('" + TempData["ErrorMessage"] + "');</script>";
                }

                //ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                //    "" : "<script type='text/javascript'>alert(\"" + TempData["ErrorMessage"] + "\\n\\n" + TempData["Approvernames"] + "\");</script>";

                // ViewBag.PostBackMessage = "<script type='text/javascript'>alert(\"" + PostBackMessage + "\\n\\n" + Approvers + "\");</script>";


                if (checkApprover != false)
                {
                    requestList = new AppClass().AwaitingApprovals();

                    return(View(requestList));
                }
                else
                {
                    return(View(requestList));
                }
            }
            catch (Exception ex)
            {
                return(View(ex.Message));
            }
        }
        public ActionResult UpdateApprover(ApproverInfo approver)
        {
            try
            {
                StaffADProfile staffADProfile = new StaffADProfile();
                CurrentUser    currentuser    = new CurrentUser();
                staffADProfile.user_logon_name = User.Identity.Name;

                ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

                staffADProfile     = activeDirectoryQuery.GetStaffProfile();
                currentuser.UserNo = staffADProfile.employee_number;

                bool checkApproverUser = new AppClass().ValidateCheckApproverUser(currentuser.UserNo);
                ViewData["checkApproverUser"] = checkApproverUser;

                bool checkAdmin = new AppClass().ValidateAdminUser(currentuser.UserNo);
                //ViewData["checkAdmin"] = checkAdmin;

                if (!checkAdmin)
                {
                    TempData["ErrorMessage"]  = "You are not authorized to Perform these operation";
                    TempData["TravelRequest"] = approver;
                    return(RedirectToAction("Manage_Approval_List"));
                }
                else
                {
                    var      Update = new AdminClass().UpdateApprover(approver);
                    string[] result = Update.ToString().Split('|');

                    if (result[0] != "0")
                    {
                        if (result[0] == "2627")
                        {
                            TempData["ErrorMessage"] = "User Already Existed on Approver list";
                            // TempData["TravelRequest"] = approver;
                            return(RedirectToAction("EditApprover"));
                        }
                        else
                        {
                            TempData["ErrorMessage"] = result[1];
                            //TempData["TravelRequest"] = approver;
                            return(RedirectToAction("EditApprover"));
                        }
                    }
                    else
                    {
                        TempData["ErrorMessage"] = "You have successfully Updated ApproverName";
                        //  TempData["Approvernames"] = string.Join("\\n", approverNames);
                        return(RedirectToAction("ApproverList"));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }
Exemple #11
0
        public ActionResult Reports(string UserName, string ReportMode)
        {
            string PostBackMessage = TempData["PostBackMessage"] as string;
            string Approvers       = TempData["Approvers"] as string;

            if (!String.IsNullOrEmpty(PostBackMessage))
            {
                ViewBag.PostBackMessage = "<script type='text/javascript'>alert(\"" + PostBackMessage + "\\n\\n" + Approvers + "\");</script>";
            }

            //now get the pending items
            if (UserName == null || UserName.Equals(String.Empty))
            {
                ViewBag.ErrorMessage = "You must be logged in to continue.";
                return(View());
            }
            this._UserName      = UserName;
            Session["UserName"] = UserName;

            //now resolve the user profile from AD and Xceed
            StaffADProfile staffADProfile = new StaffADProfile();

            staffADProfile.user_logon_name = _UserName;

            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            if (staffADProfile == null)
            {
                ViewBag.ErrorMessage = "Your profile is not properly setup on the system. Please contact InfoTech.";
                return(View());
            }

            //ReportMode = (String.IsNullOrEmpty(TempData["ReportMode"] as string) ) ? ReportMode : TempData["ReportMode"] as string ;

            //Now let's get all entries in the workflow, depending on what was passed in to ReportMode//
            List <EntriesModel> entryDetails = new List <EntriesModel>();
            //entryDetails = new LINQCalls().getWorkflowReport( ReportMode );

            ReportModel reportModel = new ReportModel();

            if (TempData["reportModel"] != null)
            {
                reportModel  = TempData["reportModel"] as ReportModel;
                entryDetails = new LINQCalls().getWorkflowQueryReport(reportModel);
            }
            else
            {
                entryDetails           = new LINQCalls().getWorkflowReport(ReportMode);
                reportModel.ReportMode = ReportMode;
            }

            reportModel.QueryField   = SelectListItemHelper.GetQueryFields();
            reportModel.EntriesModel = entryDetails;

            return(View(reportModel));
        }
        public ActionResult NewIncident()
        {
            long ticks = DateTime.Now.Ticks;

            byte[] bytes = BitConverter.GetBytes(ticks);
            string id    = Convert.ToBase64String(bytes)
                           .Replace('+', '_')
                           .Replace('/', '-')
                           .TrimEnd('=');

            StaffADProfile staffADProfile = new StaffADProfile();

            // staffADProfile.user_logon_name = Environment.UserName;
            staffADProfile.user_logon_name = User.Identity.Name;

            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            Profile profile = new Profile();

            profile = new LinqCalls().getProfile(staffADProfile.employee_number);

            bool checkICA = new IC_A_Users().ValidateCheckApproverUser(staffADProfile.employee_number);

            ViewData["ICA"] = checkICA;
            bool checkAdmin = new IC_A_Users().ValidateAdminUser(staffADProfile.employee_number);

            ViewData["Admin"] = checkAdmin;

            if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS" || checkAdmin == true)
            {
                ViewData["HopUser"] = true;


                InputClass input   = new InputClass();
                Account    account = new Account();
                input.RequesterDetails              = profile;
                input.RequesterDetails.JobTitle     = profile.JobTitle;
                input.RequesterDetails.Job_Category = profile.JobTitle;
                input.AccountDetials         = account;
                input.RequesterDetails.Email = staffADProfile.email;
                input.DocumentID             = profile.StaffNo + "BVNINCIDENT" + id;

                return(View(input));
            }
            else
            {
                ViewData["HopUser"] = false;

                TempData["ErrorMessage"] = "You are not Authorized to view this page";
                return(RedirectToAction("ErrorPage"));
            }


            //AD
        }
        public ActionResult ApproverList()
        {
            try
            {
                StaffADProfile staffADProfile = new StaffADProfile();

                staffADProfile.user_logon_name = User.Identity.Name;

                ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

                staffADProfile = activeDirectoryQuery.GetStaffProfile();

                List <ApproverInfo> approverList = new List <ApproverInfo>();
                // bool checkApprover = new AppClass().ValidateCurrentUser(currentuser);

                //bool checkApproverUser = new IC_A_Users().ValidateCheckApproverUser(staffADProfile.employee_number);
                //ViewData["checkApproverUser"] = checkApproverUser;

                bool checkICA = new IC_A_Users().ValidateCheckApproverUser(staffADProfile.employee_number);
                ViewData["ICA"] = checkICA;
                bool checkAdmin = new IC_A_Users().ValidateAdminUser(staffADProfile.employee_number);
                ViewData["Admin"] = checkAdmin;

                if (staffADProfile.jobtitle == "HEAD OF OPERATIONS" || staffADProfile.jobtitle == "ACTING HEAD OF OPERATIONS")
                {
                    ViewData["HopUser"] = true;
                }
                else
                {
                    ViewData["HopUser"] = false;
                }

                if (checkAdmin != false)
                {
                    approverList   = new IC_A_Users().GetApproverList();
                    ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                                     "" : "<script type='text/javascript'>alert('" + TempData["ErrorMessage"] + "');</script>";
                    return(View(approverList));
                }
                else
                {
                    ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                                     "" : "<script type='text/javascript'>alert('" + TempData["ErrorMessage"] + "');</script>";
                    return(View(approverList));
                }
            }
            catch (Exception ex)
            {
                ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                                 "" : "<script type='text/javascript'>alert('" + TempData["ErrorMessage"] + "');</script>";
                return(View(ex.Message));
            }


            return(View());
        }
Exemple #14
0
        internal static zib_workflow_xceed_definitions getXceedDefinition(StaffADProfile staffADProfile)
        {
            AppraisalDbEntities conn = new AppraisalDbEntities();
            var entry = (from d in conn.zib_workflow_xceed_definitions
                         where (d.ad_org_id.Equals(staffADProfile.org_id))
                         select d
                         ).First();

            return(entry);
        }
        public ActionResult Edit_Approver(string StaffNumber)
        {
            try
            {
                StaffADProfile staffADProfile = new StaffADProfile();
                //   CurrentUser currentuser = new CurrentUser();
                staffADProfile.user_logon_name = User.Identity.Name;

                ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

                staffADProfile = activeDirectoryQuery.GetStaffProfile();
                //currentuser.UserNo = staffADProfile.employee_number;

                //bool checkApproverUser = new IC_A_Users().ValidateCheckApproverUser(staffADProfile.employee_number);
                //ViewData["checkApproverUser"] = checkApproverUser;


                bool checkICA = new IC_A_Users().ValidateCheckApproverUser(staffADProfile.employee_number);
                ViewData["ICA"] = checkICA;
                bool checkAdmin = new IC_A_Users().ValidateAdminUser(staffADProfile.employee_number);
                ViewData["Admin"] = checkAdmin;

                Profile profile = new Profile();
                profile = new LinqCalls().getProfile(staffADProfile.employee_number);
                if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS")
                {
                    ViewData["HopUser"] = true;
                }
                else
                {
                    ViewData["HopUser"] = false;
                }

                if (!checkAdmin)
                {
                    TempData["ErrorMessage"] = "You are not authorized to Perform these operation";
                    //TempData["TravelRequest"] = approver;
                    return(RedirectToAction("Manage_Approval_List"));
                }
                else
                {
                    ApproverInfo approvers = new ApproverInfo();
                    approvers            = new IC_A_Users().GetApproverDetails(StaffNumber).First();
                    ViewBag.ErrorMessage = TempData["ErrorMessage"] as string;
                    return(View(approvers));
                }
            }
            catch (Exception ex)
            {
                TempData["ErrorMessage"] = ex.Message;
                return(RedirectToAction("Edit_Approver"));
            }
        }
Exemple #16
0
        internal string inputTargetEntriesHRUpload(string workflowid, StaffADProfile staffADProfile, string ConnString, string Status)
        {
            string retVal     = null;
            string connString = getConnectionString(ConnString);

            SqlConnection conn = new SqlConnection(connString);
            SqlCommand    cmnd = new SqlCommand();

            cmnd.Connection  = conn;
            cmnd.CommandType = CommandType.StoredProcedure;
            cmnd.CommandText = "zsp_insert_target_entries_hrupload";

            cmnd.Parameters.Add("@workflowids", SqlDbType.VarChar).Value      = workflowid;
            cmnd.Parameters.Add("@deptname", SqlDbType.VarChar).Value         = staffADProfile.branch_name;
            cmnd.Parameters.Add("@deptcode", SqlDbType.VarChar).Value         = staffADProfile.branch_code;
            cmnd.Parameters.Add("@target_status", SqlDbType.VarChar).Value    = Status;
            cmnd.Parameters.Add("@hr_uploader_name", SqlDbType.VarChar).Value = staffADProfile.user_logon_name;
            cmnd.Parameters.Add("@hr_uploader_id", SqlDbType.VarChar).Value   = staffADProfile.employee_number;
            cmnd.Parameters.Add("@appperiod", SqlDbType.VarChar).Value        = staffADProfile.appperiod;
            cmnd.Parameters.Add("@appid", SqlDbType.VarChar).Value            = DataHandlers.APP_ID;

            cmnd.Parameters.Add("@rErrorCode", SqlDbType.Int, 2).Direction      = ParameterDirection.Output;
            cmnd.Parameters.Add("@rErrorMsg", SqlDbType.VarChar, 255).Direction = ParameterDirection.Output;

            SqlDataReader dr;

            try {
                // Open the data connection
                cmnd.Connection = conn;
                conn.Open();

                dr = cmnd.ExecuteReader();

                int retCode = int.Parse(cmnd.Parameters["@rErrorCode"].Value.ToString());
                if (retCode != 0)
                {
                    retVal = retCode + "|" + cmnd.Parameters["@rErrorMsg"].Value.ToString();
                }
            } catch (SqlException ex) {
                if (ex.Number != 0)
                {
                    retVal = ex.Number + "|" + ex.Message;
                    logWriter.WriteErrorLog(string.Format("inpuTargetEntries : Exception!!! / {0}", retVal));
                }
            } finally {
                conn.Close();
                cmnd.Dispose();
                dr = null;
            }
            return(retVal);
        }
Exemple #17
0
        internal string routeTargetEntries(RerouteModel rerouteModel, StaffADProfile staffADProfile, string ConnString)
        {
            string retVal     = null;
            string connString = getConnectionString(ConnString);

            SqlConnection conn = new SqlConnection(connString);
            SqlCommand    cmnd = new SqlCommand();

            cmnd.Connection  = conn;
            cmnd.CommandType = CommandType.StoredProcedure;
            cmnd.CommandText = "zsp_reroute_target_entries";

            cmnd.Parameters.Add("@workflowid", SqlDbType.VarChar).Value       = rerouteModel.WorkflowID;
            cmnd.Parameters.Add("@newrequeststageid", SqlDbType.Int).Value    = Int32.Parse(rerouteModel.NewRequestStageCode);
            cmnd.Parameters.Add("@comments", SqlDbType.VarChar).Value         = rerouteModel.Comments;
            cmnd.Parameters.Add("@target_status", SqlDbType.VarChar).Value    = "Rerouted";
            cmnd.Parameters.Add("@hr_uploader_name", SqlDbType.VarChar).Value = staffADProfile.user_logon_name;
            cmnd.Parameters.Add("@hr_uploader_id", SqlDbType.VarChar).Value   = staffADProfile.employee_number;
            cmnd.Parameters.Add("@appperiod", SqlDbType.VarChar).Value        = staffADProfile.appperiod;
            cmnd.Parameters.Add("@appid", SqlDbType.VarChar).Value            = DataHandlers.APP_ID;

            cmnd.Parameters.Add("@rErrorCode", SqlDbType.Int, 2).Direction      = ParameterDirection.Output;
            cmnd.Parameters.Add("@rErrorMsg", SqlDbType.VarChar, 255).Direction = ParameterDirection.Output;

            SqlDataReader dr;

            try {
                // Open the data connection
                cmnd.Connection = conn;
                conn.Open();

                dr = cmnd.ExecuteReader();

                int retCode = int.Parse(cmnd.Parameters["@rErrorCode"].Value.ToString());
                if (retCode != 0)
                {
                    retVal = retCode + "|" + cmnd.Parameters["@rErrorMsg"].Value.ToString();
                }
            } catch (SqlException ex) {
                if (ex.Number != 0)
                {
                    retVal = ex.Number + "|" + ex.Message;
                    logWriter.WriteErrorLog(string.Format("routeTargetEntries : Exception!!! / {0}", retVal));
                }
            } finally {
                conn.Close();
                cmnd.Dispose();
                dr = null;
            }
            return(retVal);
        }
Exemple #18
0
        public ActionResult OpenPassportEntry(string WorkflowID, int RequestStageID)
        {
            Session["UserName"] = @User.Identity.Name;
            this._UserName      = Session["UserName"] as string ?? "";

            if (_UserName == null || _UserName.Equals(String.Empty))
            {
                ViewBag.ErrorMessage = "You must be logged in to continue.";
                return(RedirectToAction("AwaitingMyApproval", "AwaitingApproval"));
            }

            //now resolve the user profile from AD and Xceed
            StaffADProfile staffADProfile = new StaffADProfile();

            staffADProfile.user_logon_name = _UserName;

            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            if (staffADProfile == null)
            {
                ViewBag.ErrorMessage = "Your profile is not properly setup on the system. Please contact InfoTech.";
                return(RedirectToAction("AwaitingMyApproval", "AwaitingApproval"));
            }

            List <string> approvers  = LINQCalls.getApproverIDs(WorkflowID, RequestStageID);
            bool          isApprover = approvers.Contains(staffADProfile.employee_number);

            //get the request and setup the superPassportModel object

            string routeController = "PassportReviewForm";

            TempData["superPassportModel"] = null;

            if (isApprover)
            {
                routeController = "PassportReviewForm";
            }

            if (!RequestStageID.Equals(-1))
            {
                return(RedirectToAction(routeController, "PassportReview", new { WorkflowID = WorkflowID, editMode = isApprover, myEntries = false }));
            }
            else
            {
                return(RedirectToAction("EditPassport", "PassportInput", new { WorkflowID = WorkflowID, editMode = isApprover, myEntries = true }));
            }
        }
Exemple #19
0
        internal static Tuple <int, string, int> getXceedConnector(StaffADProfile staffADProfile)
        {
            AppraisalDbEntities conn = new AppraisalDbEntities();
            var entry = (from d in conn.zib_workflow_xceed_definitions
                         where (d.ad_org_id.Equals(staffADProfile.org_id))
                         select new
            {
                conn_name = d.conn_name,
                org_id = d.org_id,
                ad_org_id = d.ad_org_id
            }).First();
            string connString = System.Configuration.ConfigurationManager.ConnectionStrings[entry.conn_name].ConnectionString;

            return(Tuple.Create(entry.org_id, connString, entry.ad_org_id));
        }
        public ActionResult Index()
        {
            StaffADProfile staffADProfile = new StaffADProfile();

            staffADProfile.user_logon_name = User.Identity.Name;

            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile      = activeDirectoryQuery.GetStaffProfile();
            ViewBag.StaffNumber = staffADProfile.employee_number;
            bool checkApproverUser = new AppClass().ValidateCheckApproverUser(staffADProfile.employee_number);

            ViewData["checkApproverUser"] = checkApproverUser;
            return(View());
        }
Exemple #21
0
        public ActionResult AdminPage()
        {
            StaffADProfile staffADProfile = new StaffADProfile();
            CurrentUser    currentuser    = new CurrentUser();

            staffADProfile.user_logon_name = User.Identity.Name;

            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile     = activeDirectoryQuery.GetStaffProfile();
            currentuser.UserNo = staffADProfile.employee_number;
            bool checkApproverUser = new AppClass().ValidateCheckApproverUser(currentuser.UserNo);

            ViewData["checkApproverUser"] = checkApproverUser;
            return(View());
        }
Exemple #22
0
        public static StaffADProfile getStaffADProfile(string staff_id, int chk = 0)
        {
            //Get the staff profile
            StaffADProfile staffADProfile = new StaffADProfile();

            staffADProfile.employee_number = staff_id;
            //AD
            //ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile, staff_number);
            // = activeDirectoryQuery.GetStaffProfileByNumber();
            //if (staffADProfile == null)
            //{
            //    return null;
            //}

            return(LINQCalls.getXceedProfile(staffADProfile));
        }
Exemple #23
0
        private StaffADProfile GetStaffInformation(string username, string password, string domain)
        {
            SearchResult rs = null;

            try {
                Debug.WriteLine(username);
                Debug.WriteLine(password);
                Debug.WriteLine(domain);

                rs = SearchUserByUserName(GetDirectorySearcher(username, password, domain));

                if (rs != null)
                {
                    DirectoryEntry de = rs.GetDirectoryEntry();

                    staffADProfile.employee_number = object.ReferenceEquals(de.Properties["description"].Value as string, null)    ? String.Empty : de.Properties["description"].Value.ToString();
                    staffADProfile.branch_name     = object.ReferenceEquals(de.Properties["physicalDeliveryOfficeName"].Value as string, null)
                                                                                            ? String.Empty : de.Properties["physicalDeliveryOfficeName"].Value.ToString();
                    staffADProfile.branch_address  = object.ReferenceEquals(de.Properties["streetAddress"].Value as string, null)  ? String.Empty : de.Properties["streetAddress"].Value.ToString();
                    staffADProfile.mobile_phone    = object.ReferenceEquals(de.Properties["mobile"].Value as string, null)         ? String.Empty : de.Properties["mobile"].Value.ToString();
                    staffADProfile.gsm             = object.ReferenceEquals(de.Properties["telephoneNumber"].Value as string, null)? String.Empty : de.Properties["telephoneNumber"].Value.ToString();
                    staffADProfile.jobtitle        = object.ReferenceEquals(de.Properties["title"].Value as string, null)          ? String.Empty : de.Properties["title"].Value.ToString();
                    staffADProfile.office_ext      = object.ReferenceEquals(de.Properties["pager"].Value as string, null)         ? String.Empty : de.Properties["pager"].Value.ToString();
                    staffADProfile.department      = object.ReferenceEquals(de.Properties["department"].Value as string, null)     ? String.Empty : de.Properties["department"].Value.ToString();
                    staffADProfile.user_logon_name = object.ReferenceEquals(de.Properties["sAMAccountName"].Value as string, null) ? String.Empty : de.Properties["sAMAccountName"].Value.ToString();
                    staffADProfile.email           = object.ReferenceEquals(de.Properties["mail"].Value as string, null)          ? String.Empty : de.Properties["mail"].Value.ToString();
                    staffADProfile.membership      = GetMemberships(de);

                    staffADProfile.branch_code = GetBranchCode(de);

                    logWriter.WriteErrorLog(string.Format("GetStaffInformation : User found!!! / {0}", staffADProfile.user_logon_name));
                }
                else
                {
                    staffADProfile = null;
                    logWriter.WriteErrorLog(string.Format("GetStaffInformation : User not found!!! / {0}", staffADProfile.user_logon_name));
                }
            } catch (Exception ex) {
                logWriter.WriteErrorLog(string.Format("GetStaffInformation : Exception!!! / {0}", ex.Message));
                staffADProfile = null;
            } finally {
                Dispose();
                rs = null;
            }

            return(staffADProfile);
        }
Exemple #24
0
        public ActionResult Reroute(string RerouteAction, RerouteModel rerouteModel)
        {
            //now resolve the user profile from AD and Xceed
            StaffADProfile staffADProfile = new StaffADProfile();

            staffADProfile.user_logon_name = Session["UserName"] as string;

            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            if (staffADProfile == null)
            {
                ViewBag.ErrorMessage = "Your profile is not properly setup on the system. Please contact InfoTech.";
                return(View());
            }

            // staffADProfile = new LINQCalls().setInitiatorFields( staffADProfile );

            /*
             * if( staffADProfile.branch_code==null ){
             *   ViewBag.ErrorMessage="Your profile is not properly setup for Target. Please contact Human Resources.";
             *   return View();
             * }
             */
            staffADProfile.appperiod = "20150712";
            string _retVal = new AppDatabase().routeTargetEntries(rerouteModel, staffADProfile, "AppraisalDbConnectionString");

            Debug.WriteLine(_retVal);

            if (_retVal != null)
            {
                TempData["UploadComplete"] = "false";
                ViewBag.ErrorMessage       = _retVal;
                TempData["rerouteModel"]   = rerouteModel;
            }
            else
            {
                int newstageid = Int32.Parse(rerouteModel.NewRequestStageCode);
                var approvers  = new LINQCalls().getApproverNames(rerouteModel.WorkflowID, newstageid);
                TempData["PostBackMessage"] = REROUTEDMSG;
                TempData["Approvers"]       = string.Join("\\n", approvers.ToArray());
                return(RedirectToAction("Reports", "Reports", new { UserName = Session["UserName"] as string, ReportMode = Session["ReportMode"] as string }));
            }

            return(RedirectToAction("Reroute", "Reroute", new { UserName = Session["UserName"] as string, ReportMode = Session["ReportMode"] as string }));
        }
        public ActionResult Manage_Approval_List()
        {
            StaffADProfile staffADProfile = new StaffADProfile();

            //CurrentUser currentuser = new CurrentUser();
            staffADProfile.user_logon_name = User.Identity.Name;

            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();


            bool checkICA = new IC_A_Users().ValidateCheckApproverUser(staffADProfile.employee_number);

            ViewData["ICA"] = checkICA;
            bool checkAdmin = new IC_A_Users().ValidateAdminUser(staffADProfile.employee_number);

            ViewData["Admin"] = checkAdmin;
            Profile profile = new Profile();

            profile = new LinqCalls().getProfile(staffADProfile.employee_number);
            if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS")
            {
                ViewData["HopUser"] = true;
            }
            else
            {
                ViewData["HopUser"] = false;
            }


            if (!checkAdmin)
            {
                TempData["ErrorMessage"] = "";
                return(RedirectToAction("ErrorPage"));
            }
            else
            {
                ApproverInfo approvers = new ApproverInfo();
                //approvers = new AdminClass().GetApproverList();
                ViewBag.ErrorMessage = TempData["ErrorMessage"] as string;
                return(View(approvers));
            }
            //List<ApproverInfo> approvers = new List<ApproverInfo>();
        }
        public ActionResult ApproverList()
        {
            try
            {
                StaffADProfile staffADProfile = new StaffADProfile();
                CurrentUser    currentuser    = new CurrentUser();
                staffADProfile.user_logon_name = User.Identity.Name;

                ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

                staffADProfile        = activeDirectoryQuery.GetStaffProfile();
                currentuser.UserNo    = staffADProfile.employee_number;
                currentuser.UserName  = staffADProfile.in_StaffName;
                currentuser.logonName = staffADProfile.user_logon_name;
                currentuser.Email     = staffADProfile.email;
                List <ApproverInfo> approverList = new List <ApproverInfo>();
                // bool checkApprover = new AppClass().ValidateCurrentUser(currentuser);

                bool checkApproverUser = new AppClass().ValidateCheckApproverUser(currentuser.UserNo);
                ViewData["checkApproverUser"] = checkApproverUser;

                if (checkApproverUser != false)
                {
                    approverList   = new AdminClass().GetApproverList();
                    ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                                     "" : "<script type='text/javascript'>alert('" + TempData["ErrorMessage"] + "');</script>";
                    return(View(approverList));
                }
                else
                {
                    ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                                     "" : "<script type='text/javascript'>alert('" + TempData["ErrorMessage"] + "');</script>";
                    return(View(approverList));
                }
            }
            catch (Exception ex)
            {
                ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                                 "" : "<script type='text/javascript'>alert('" + TempData["ErrorMessage"] + "');</script>";
                return(View(ex.Message));
            }


            return(View());
        }
        public ActionResult NewRequest()
        {
            StaffADProfile staffADProfile = new StaffADProfile();

            // staffADProfile.user_logon_name = Environment.UserName;
            staffADProfile.user_logon_name = User.Identity.Name;

            long ticks = DateTime.Now.Ticks;

            byte[] bytes = BitConverter.GetBytes(ticks);
            string id    = Convert.ToBase64String(bytes)
                           .Replace('+', '_')
                           .Replace('/', '-')
                           .TrimEnd('=');
            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            TravelRequest newrequest = new TravelRequest();
            Profile       profile    = new Profile();
            Country       countries  = new Country();
            Account       acc        = new Account();

            acc.description = "no card";

            countries.countryList = new AppClass().getCountry();

            profile.StaffNo = staffADProfile.employee_number;
            bool checkApproverUser = new AppClass().ValidateCheckApproverUser(profile.StaffNo);

            ViewData["checkApproverUser"] = checkApproverUser;

            // bool checkAdmin = new AppClass().ValidateAdminUser(profile.StaffNo);


            profile                   = new AppClass().getProfile(profile.StaffNo);
            profile.Email             = staffADProfile.email;
            newrequest.StaffProfile   = profile;
            newrequest.id             = "TRA" + profile.StaffNo + id;
            newrequest.country        = countries;
            newrequest.Accountdetails = acc;
            ViewBag.ErrorMessage      = TempData["ErrorMessage"] as string;
            //ViewBag.coInit = "<script type='text/javascript'>alert('"+ TempData["ErrorMessage"] +"');</script>";
            return(View(newrequest));
        }
Exemple #28
0
        public ActionResult FilterHRUpload(string FilterBy, FormCollection form, string[] WorkflowID, string TargetAction)
        {
            switch (TargetAction)
            {
            case "Search":
                TempData["FilterBy"] = FilterBy;
                return(RedirectToAction("HRUpload", new { UserName = Session["UserName"] as string }));

            case "Upload":

                StaffADProfile staffADProfile = new StaffADProfile();
                staffADProfile = Session["staffADProfile"] as StaffADProfile;


                string _retVal = string.Empty;
                foreach (string workflowid in WorkflowID)
                {
                    if (workflowid.Length > 0)
                    {
                        staffADProfile.user_logon_name = User.Identity.Name;
                        ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);
                        staffADProfile = activeDirectoryQuery.GetStaffProfile();

                        staffADProfile.branch_code = new LINQCalls().getEntryProfile(workflowid).branch_code;
                        staffADProfile.branch_name = new LINQCalls().getEntryProfile(workflowid).branch_name;
                        staffADProfile.appperiod   = "20150712";
                        _retVal = new AppDatabase().inputTargetEntriesHRUpload(workflowid, staffADProfile, "AppraisalDbConnectionString", "Submitted");
                        if (_retVal != null)
                        {
                            TempData["UploadComplete"]  = "false";
                            TempData["PostBackMessage"] = _retVal;
                        }
                        else
                        {
                            TempData["PostBackMessage"] = UPLOADEDMSG;
                            TempData["Approvers"]       = "";
                        }
                    }
                }
                Debug.WriteLine(_retVal);
                break;
                //return RedirectToAction( "AwaitingMyApproval","AwaitingApproval",new { UserName = Session["UserName"] as string } );
            }
            return(RedirectToAction("AwaitingMyApproval", "AwaitingApproval", new { UserName = Session["UserName"] as string }));
        }
Exemple #29
0
        internal static bool IsBranchHead(StaffADProfile staffADProfile)
        {
            XceedEntities ctx    = new XceedEntities();
            var           result = new List <LinqResponseModel>();

            switch (staffADProfile.branch_code)
            {
            case "001":
                result = (from w in ctx.vw_headoffice_workflow
                          where w.depthead_number == staffADProfile.employee_number
                          select new LinqResponseModel
                {
                    value = w.depthead_name
                }).ToList();
                break;

            case "013":
                result = (from w in ctx.vw_abuja_workflow
                          where w.branch_head_number == staffADProfile.employee_number
                          select new LinqResponseModel
                {
                    value = w.branchhead_name
                }).ToList();
                break;

            default:
                result = (from w in ctx.vw_branches_workflow
                          where w.branch_head_number == staffADProfile.employee_number
                          select new LinqResponseModel
                {
                    value = w.branchhead_name
                }).ToList();
                break;
            }

            if (result.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public ActionResult OpenIncident(string DocumentID)
        {
            StaffADProfile staffADProfile = new StaffADProfile();

            // staffADProfile.user_logon_name = Environment.UserName;
            staffADProfile.user_logon_name = User.Identity.Name;

            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            Profile profile = new Profile();

            profile = new LinqCalls().getProfile(staffADProfile.employee_number);
            bool checkICA = new IC_A_Users().ValidateCheckApproverUser(staffADProfile.employee_number);

            ViewData["ICA"] = checkICA;
            bool checkAdmin = new IC_A_Users().ValidateAdminUser(staffADProfile.employee_number);

            ViewData["Admin"] = checkAdmin;

            if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS" || checkAdmin == true || checkICA == true)
            {
                if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS" || checkAdmin == true)
                {
                    ViewData["HopUser"] = true;
                }
                else
                {
                    ViewData["HopUser"] = false;
                }
                InputClass Entry = new InputClass();
                Entry        = new ProcessEntry().GetEntry(DocumentID).First();
                ViewBag.date = Entry.DateSubmitted;
                return(View(Entry));
            }
            else
            {
                ViewData["HopUser"] = false;

                TempData["ErrorMessage"] = "You are not Authorized to view this page";
                return(RedirectToAction("ErrorPage"));
            }
        }