Exemple #1
0
        public ActionResult HRUpload()
        {
            /**First let's check if the PostBackMessage has something
             * Very important---DO NOT DELETE!!!!!!!!!!!!!!!!!!!!!**/
            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>";
            }

            this._UserName = Session["UserName"] as string ?? "";

            //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());
            }

            //**Appraisal**Initiator**Setup**\\
            //Resolve the --branchname --branchcode --department --deptcode --appperiod from Tb_TargetInitiators table

            /*
             * 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();
             * }*/
            ViewBag.AppID = DataHandlers.APP_ID;
            //   ViewBag.StaffBranch = staffADProfile.branch_name + ( ( staffADProfile.branch_code.Equals(HOBRCODE) ) ? " | " + staffADProfile.hodeptcode : String.Empty );

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

            entryDetails = LINQCalls.getPendingHRUpload(staffADProfile);

            string filter = TempData["FilterBy"] as string;

            if (!String.IsNullOrEmpty(filter))
            {
                entryDetails = FilterHRUploadList(entryDetails, filter);
            }
            Session["staffADProfile"] = staffADProfile;
            return(View(entryDetails));
        }