示例#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());
        }
示例#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 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"));
            }
        }
示例#5
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 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 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());
        }
示例#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 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));
            }
        }
        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));
            }
        }
示例#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());
        }
        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"));
            }
        }
示例#15
0
        private void GetUserStaffNumber()
        {
            //now resolve the user profile from AD and Xceed
            StaffADProfile staffADProfile = new StaffADProfile();

            staffADProfile.user_logon_name = this.Username;

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

            staffADProfile       = activeDirectoryQuery.GetStaffProfile();
            this.employee_number = staffADProfile.employee_number;
        }
示例#16
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 }));
            }
        }
        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());
        }
示例#18
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());
        }
示例#19
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 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));
        }
        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());
        }
示例#23
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 }));
        }
        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"));
            }
        }
示例#25
0
        public static StaffADProfile getStaffADProfile(string user_name = "")
        {
            user_name = string.IsNullOrEmpty(user_name) ? System.Web.HttpContext.Current.User.Identity.Name : user_name.Trim();

            //Get the staff profile
            StaffADProfile staffADProfile = new StaffADProfile();

            staffADProfile.user_logon_name = user_name;
            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            if (staffADProfile == null)
            {
                return(null);
            }

            return(LINQCalls.getXceedProfile(staffADProfile));
        }
        public ActionResult getActDetails(string AccNo)
        {
            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;
            ApproverInfo approver = new ApproverInfo();

            // approver.StaffNumber = StaffNumber;
            approver = new AppClass().getApproverProfile(currentuser.UserNo);
            string         errorResult = null;
            List <Account> details     = new List <Account>();

            for (int i = 1; i < 3; i++)
            {
                var Accdetails = new AppClass().getAllCards(i, AccNo);
                foreach (Account newAccdetails in Accdetails)
                {
                    Account Acc = new Account();
                    Acc.Account_Name       = newAccdetails.Account_Name;
                    Acc.description        = newAccdetails.description;
                    Acc.AccountNo          = newAccdetails.AccountNo;
                    Acc.DomicileBranch     = newAccdetails.DomicileBranch;
                    Acc.DomicileBranchCode = newAccdetails.DomicileBranchCode;
                    details.Add(Acc);
                }
            }

            if (details == null)
            {
                errorResult = string.Format(errorResult, "Error", "No records found for the Account number");
                return(Content(errorResult, "application/json"));
            }
            else
            {
                return(Json(details, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult GetAccountInfo(string BVN)
        {
            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);
            if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS")
            {
                ViewData["HopUser"] = true;
                ViewData["ICA"]     = false;

                List <Account> details = new List <Account>();

                details = new PheonixQuery().getAccounts(BVN);

                if (details == null)
                {
                    errorResult = string.Format(errorResult, "Error", "No Account");
                    return(Content(errorResult, "application/json"));
                }
                else
                {
                    return(PartialView("GetAccountInfo", details));
                }
            }
            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 MyInicidentEntry()
        {
            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["Admin"] = false;
                ViewData["HopUser"] = true;
                // ViewData["ICA"] = false;
                var EntryList = new ProcessEntry().GetMyIncidentEntry(staffADProfile);
                ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                                 "" : "<script type='text/javascript'>alert('" + TempData["ErrorMessage"] + "');</script>";
                return(View(EntryList));
            }
            else
            {
                //  ViewData["Admin"] = false;
                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"));
            }
        }
示例#29
0
        public ActionResult HRRoleSetup(AppraisalApproverModel appraisalApproverModel)
        {
            appraisalApproverModel.EntryKey = (String.IsNullOrEmpty(appraisalApproverModel.EntryKey)) ? getHREntryKey(appraisalApproverModel) : appraisalApproverModel.EntryKey;

            HRProfile hrprofile = LINQCalls.hrprofile(appraisalApproverModel.HRStaffName, 1);

            if (hrprofile == null)
            {
                TempData["ErrorMessage"] = "Error : You staff profile is not properly setup";
            }

            //Get the staff's username from the staff number
            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(appraisalApproverModel.StaffNumber);
            string _username = activeDirectoryQuery.GetUserName();

            if (_username == null)
            {
                ViewBag.ErrorMessage = "The user's profile is not properly setup on the system. Please contact InfoTech.";
                return(View());
            }

            appraisalApproverModel.UserName = _username;

            //Setup the staff
            string retVal = new AppDatabase().insertRoleSetup(appraisalApproverModel, hrprofile, "AppraisalDbConnectionString");

            if (!String.IsNullOrEmpty(retVal) && !retVal.Split('|')[0].Equals("0"))
            {
                TempData["ErrorMessage"] = "Error :" + retVal.Split('|')[1];
            }
            else
            {
                appraisalApproverModel = null;
            }

            TempData["appraisalApproverModel"] = appraisalApproverModel;
            return(RedirectToAction("HRRoleSetup"));
        }
        public ActionResult ApprovedRequest()
        {
            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 <TravelRequest> requestList = new List <TravelRequest>();
                //  bool checkApprover = new AppClass().ValidateCurrentUser(currentuser);


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


                if (checkApproverUser != false)
                {
                    requestList = new AdminClass().GetApprovedRequest();

                    return(View(requestList));
                }
                else
                {
                    return(View(requestList));
                }
            }
            catch (Exception ex)
            {
                return(View(ex.Message));
            }
        }