示例#1
0
        public ActionResult AwaitingMyApproval()
        {
            /**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;

            _UserName           = User.Identity.Name;
            Session["UserName"] = _UserName;

            _UserName = "******";


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

                //**Appraisal**Initiaor**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
                logWriter.WriteErrorLog(string.Format("get Awaiting : about firing getMyPendingTargetWorkflows!!! / {0}", ""));

                List <MyMemoEntriesModel> entryDetails = new List <MyMemoEntriesModel>();
                entryDetails = new LINQCalls().getMyPendingMemoWorkflows(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());
            }
        }