예제 #1
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 }));
        }
예제 #2
0
        public ActionResult SetupAppraisalApprovers(AppraisalApproverModel appraisalApproverModel)
        {
            appraisalApproverModel.EntryKey = getEntryKey(appraisalApproverModel);

            /*bool duplicateEntry = LINQCalls.checkDupApproverSetup( appraisalApproverModel.EntryKey.ToUpper() );
             * if (!duplicateEntry) {
             *  TempData["ErrorMessage"] = "Error : The staff : "+ appraisalApproverModel.StaffName +" has an existing setup with the same identity";
             * }*/

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

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

            //Setup the branch
            int    inputMode = 0;
            string retVal    = new AppDatabase().insertApproverSetup(appraisalApproverModel, hrprofile, inputMode, "AppraisalDbConnectionString");

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

            TempData["appraisalApproverModel"] = appraisalApproverModel;
            return(RedirectToAction("SetupAppraisalApprovers"));
        }
예제 #3
0
            public static SelectList GetDepts(string branchcode)
            {
                //branchcode  = "001";
                string deptcodes = "118,225,224,117,180,474,1473,166";

                return(LINQCalls.getHODepts(branchcode, deptcodes));
            }
예제 #4
0
        public ActionResult RoleEdit(string EntryKey, string Func)
        {
            AppraisalApproverModel appraisalApproverModel = new AppraisalApproverModel();

            if (String.IsNullOrEmpty(EntryKey) || String.IsNullOrEmpty(Func))
            {
                TempData["ErrorMessage"] = "Error : Please access the page properly.";
            }
            else
            {
                if (Func.Equals("Edit"))
                {
                    appraisalApproverModel = LINQCalls.getRoleSetupEntry(EntryKey);
                }
                else
                {
                    string retVal = new AppDatabase().deleteRoleSetup(EntryKey, "AppraisalDbConnectionString");
                    if (!String.IsNullOrEmpty(retVal) && !retVal.Split('|')[0].Equals("0"))
                    {
                        TempData["ErrorMessage"] = "Error : " + retVal.Split('|')[1];
                    }
                    else
                    {
                        return(RedirectToAction("ViewHRUsers"));
                    }
                }
            }
            TempData["appraisalApproverModel"] = appraisalApproverModel;
            return(RedirectToAction("HRRoleSetup"));
        }
예제 #5
0
        public IHttpActionResult GetSearchRequestEntry(string workflowid)
        {
            int    retCode          = 0;
            string retVal           = string.Empty;
            string connectionString = ConfigurationManager.ConnectionStrings["AppraisalDbConnectionString"].ConnectionString;
            string returnMessage    = "{{\"responseCode\":\"{0}\",\"responseMessage\":\"{1}\",\"result\":\"{2}\"}}";

            //Validate The Input Parameters
            if (workflowid.ToString().Equals(null))
            {
                return(NotFound());
                //returnMessage = await Task.FromResult(string.Format(returnMessage, "01", "Invalid workflowid", null));
                // return JsonConvert.DeserializeObject(returnMessage.ToString());
            }


            var Result = LINQCalls.getSearchRequestEntry(workflowid);

            if (Result == null)
            {
                return(NotFound());
            }
            return(Ok(Result));

            //returnMessage = await Task.FromResult(string.Format(returnMessage, retCode.ToString(), retVal, Result));
            //return JsonConvert.DeserializeObject(returnMessage.ToString());
        }
예제 #6
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));
        }
예제 #7
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());
            }
        }
예제 #8
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));
        }
예제 #9
0
        public ActionResult BHSingleSetupFormEdit(string StaffNumber, string SelectedAppraisalPeriod)
        {
            if (String.IsNullOrEmpty(StaffNumber) || String.IsNullOrEmpty(SelectedAppraisalPeriod))
            {
                return(RedirectToAction("BHSingleSetupForm"));
            }
            BHSingleSetupEditModel bHSingleSetupModel = new LINQCalls().bHSingleSetupModel(StaffNumber, SelectedAppraisalPeriod);

            return(View(bHSingleSetupModel));
        }
예제 #10
0
        public JsonResult TagSearch(string term)
        {
            CultureInfo ci = new CultureInfo("en-US");

            List <SignerDetails> signerDetails = new LINQCalls().getBankStaff();
            var staffmembers = new System.Web.Script.Serialization.JavaScriptSerializer();

            Debug.WriteLine(signerDetails);
            return(this.Json(signerDetails.Where(t => t.ApproverStaffName.ToLower().Contains(term.ToLower())), JsonRequestBehavior.AllowGet));
        }
예제 #11
0
        public ActionResult ViewStructure(ViewStructure viewStructure)
        {
            //Now let's get the Approvers for the Selected branch
            IEnumerable <IEnumerable <AppraisalApproverModel> > branchStructure = LINQCalls.getOrgStructure(viewStructure.SelectedBranch);

            branchStructure = branchStructure.OrderByDescending(c => c.First().RoleID);

            viewStructure.AppraisalApproverModel = branchStructure;
            TempData["viewStructure"]            = viewStructure;
            return(RedirectToAction("ViewStructure", "OrgStructure"));
        }
예제 #12
0
            public static SelectList GetDepts(string branchcode)
            {
                //branchcode  = "001";

                System.Configuration.Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/");
                System.Configuration.KeyValueConfigurationElement HeadOfficeDepartments = rootWebConfig.AppSettings.Settings["HeadOfficeDepartments"];

                //string deptcodes   = "118,225,224,117,180,474,1473,166,658";
                string deptcodes = HeadOfficeDepartments.Value.ToString();

                return(LINQCalls.getHODepts(branchcode, deptcodes));
            }
예제 #13
0
        public ActionResult BHBulkSetupForm(SuperBulkSetupModel superBulkSetupModel, int?i)
        {
            HRProfile hrprofile = new LINQCalls().hrprofile(superBulkSetupModel.BHSingleSetupModel.InitiatorLoginName, 1);

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

            //now get the initiator model and convert it to a datatable
            List <SetupExcelModel> setupExcelModel = GetDataTableFromSpreadsheet(superBulkSetupModel.BHBulkSetupFormModel.UploadedExcelFile.InputStream, false, superBulkSetupModel.BHSingleSetupModel, hrprofile);

            if (setupExcelModel.Count() <= 0)
            {
                TempData["ErrorMessage"]        = "Error : Please upload an excel file before continuing";
                TempData["superBulkSetupModel"] = superBulkSetupModel;
                return(RedirectToAction("BHBulkSetupForm"));
            }

            var staffinputmodel = setupExcelModel.Select(entry => new StaffInputModel()
            {
                BranchCode        = entry.StaffBranchCode
                , BranchName      = entry.StaffBranch
                , InitiatorName   = entry.StaffName
                , InitiatorNumber = entry.StaffNumber
                                    //, InitiatorGrade    = String.Empty
                , Comments        = String.Empty
                , AppraisalPeriod = entry.SelectedAppraisalPeriod
                , HODeptCode      = ""   //entry.HODeptCode
                , HODeptName      = ""   //entry.HODeptName
                , HRStaffNumber   = entry.HRProfile.employee_number
                , HRStaffName     = entry.HRProfile.name
            }).ToList();

            IEnumerable <StaffInputModel> staffInputModel = staffinputmodel;
            DataTable dataTable = ToDataTable(staffInputModel);

            //now upload the list to the db
            string retVal = new AppDatabase().insertBulkSetup(dataTable, "AppraisalDbConnectionString");

            if (retVal != null)
            {
                TempData["UploadComplete"]      = "false";
                TempData["ErrorMessage"]        = retVal;
                TempData["superBulkSetupModel"] = superBulkSetupModel;
                return(RedirectToAction("BHBulkSetupForm"));
            }

            TempData["UploadComplete"] = "true";
            return(RedirectToAction("BHBulkSetupForm", new { ActionState = 0 }));
        }
예제 #14
0
        public ActionResult ViewAppraisalApprovers(string FilterBy = "")
        {
            System.Configuration.Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/");
            System.Configuration.KeyValueConfigurationElement CurrentAppraisalPeriod = rootWebConfig.AppSettings.Settings["CurrentAppraisalPeriod"];

            List <AppraisalApproverModel> appraisalApproverModel = LINQCalls.getApproverSetupList();

            if (!String.IsNullOrEmpty(FilterBy))
            {
                appraisalApproverModel = FilterAppraisalApproverList(appraisalApproverModel, FilterBy.ToUpper());
            }
            return(View(appraisalApproverModel));
        }
예제 #15
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 }));
            }
        }
예제 #16
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 }));
        }
예제 #17
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));
        }
예제 #18
0
        public ActionResult ViewBranchInitiators(string FilterBy = "")
        {
            System.Configuration.Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/");
            System.Configuration.KeyValueConfigurationElement CurrentAppraisalPeriod = rootWebConfig.AppSettings.Settings["CurrentAppraisalPeriod"];

            List <BHSingleSetupModel> bHSingleSetupModel = new LINQCalls().getBranchInitiators(CurrentAppraisalPeriod.Value.ToString());

            if (!String.IsNullOrEmpty(FilterBy))
            {
                /*bHSingleSetupModel = bHSingleSetupModel.Where(  c => c.SetupBranch.ToUpper().Contains(FilterBy)   ||
                 *                                              c.StaffNumber.ToUpper().Contains(FilterBy)        ||
                 *                                              c.StaffName.ToUpper().Contains(FilterBy)          ||
                 *                                              c.SetupAppPeriod.ToUpper().Contains(FilterBy)     ||
                 *                                              c.SelectedAppraisalPeriod.ToUpper().Contains(FilterBy))
                 *                                     .ToList();*/
                bHSingleSetupModel = FilterBranchInitiatorList(bHSingleSetupModel, FilterBy.ToUpper());
            }
            return(View(bHSingleSetupModel));
        }
예제 #19
0
        public ActionResult GetApprovers(string WorkflowID, int RequestStageID)
        {
            string errorResult = "{{\"employee_number\":\"{0}\",\"name\":\"{1}\"}}";

            if (string.IsNullOrEmpty(WorkflowID))
            {
                errorResult = string.Format(errorResult, "Error", "Invalid entry detected");
                return(Content(errorResult, "application/json"));
            }

            string approvers = new LINQCalls().getMemoApproverNames(WorkflowID, RequestStageID);

            if (approvers == null || approvers == "")
            {
                errorResult = string.Format(errorResult, null, "No approvers found for the entry");
                return(Content(errorResult, "application/json"));
            }
            else
            {
                //20090022$ESOGBUE IKECHUKWU P$14$205$SEA|20110326$KALU NNANNA I$15$248$EA
                List <SignerDetails> signerDetails = new List <SignerDetails>();
                SignerDetails        _signerDetails;
                string[]             approvers_ = approvers.Split('|');
                foreach (string str in approvers_)
                {
                    _signerDetails = new SignerDetails();
                    string[] appr_ = str.Split('$');

                    _signerDetails.ApproverStaffNumber = appr_[0];
                    _signerDetails.ApproverStaffName   = appr_[1];
                    _signerDetails.GradeID             = Int32.Parse(appr_[2]);
                    _signerDetails.PayGroup_ID         = Int32.Parse(appr_[3]);
                    _signerDetails.ApproverGrade       = appr_[4];
                    signerDetails.Add(_signerDetails);
                }

                return(Json(signerDetails.ToArray(), JsonRequestBehavior.AllowGet));
            }
        }
예제 #20
0
        public ActionResult GetApprovers(string WorkflowID, int RequestStageID)
        {
            string errorResult = "{{\"employee_number\":\"{0}\",\"name\":\"{1}\"}}";

            if (string.IsNullOrEmpty(WorkflowID))
            {
                errorResult = string.Format(errorResult, "Error", "Invalid entry detected");
                return(Content(errorResult, "application/json"));
            }

            var profile = (RequestStageID == 20) ? LINQCalls.getHRApproverNames(WorkflowID, RequestStageID):LINQCalls.getApproverNumbersToNames(WorkflowID, RequestStageID);

            if (profile == null || profile.Count() <= 0)
            {
                errorResult = string.Format(errorResult, null, "No approvers found for the entry");
                return(Content(errorResult, "application/json"));
            }
            else
            {
                return(Json(profile, JsonRequestBehavior.AllowGet));
            }
        }
예제 #21
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"));
        }
예제 #22
0
        // GET: MyEntries
        public ActionResult MyEntries()
        {
            _UserName           = User.Identity.Name;
            Session["UserName"] = User.Identity.Name;

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

            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(RedirectToAction("AwaitingMyApproval", "AwaitingApproval", new { UserName = Session["UserName"] as string }));
            }

            ViewBag.AppID       = DataHandlers.APP_ID;
            ViewBag.StaffBranch = staffADProfile.branch_name; //+ ( ( staffADProfile.branch_code.Equals(HOBRCODE) ) ? " | " + staffADProfile.hodeptcode : String.Empty );

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

            entryDetails = new LINQCalls().getMyMemoWorkflows(staffADProfile);

            return(View(entryDetails));
        }
예제 #23
0
        public ActionResult AppraisalApproverBulkSetupForm(SuperApproverBulkSetupModel superApproverBulkSetupModel)
        {
            HRProfile hrprofile = LINQCalls.hrprofile(Session["UserName"] as String, 1);

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

            //string periodSelectedValue = Request.Form["BHSingleSetupModel.SelectedAppraisalPeriod"];
            HttpPostedFileBase uploadedExcelFile = superApproverBulkSetupModel.AppraisalApproverBulkModel.UploadedExcelFile;

            AppraisalApproverBulkModel sppraisalApproverBulkModel = superApproverBulkSetupModel.AppraisalApproverBulkModel;
            List <ApproverExcelModel>  approverExcelModel         = GetDataTableFromSpreadsheet(superApproverBulkSetupModel.AppraisalApproverBulkModel.UploadedExcelFile.InputStream, false, hrprofile);

            superApproverBulkSetupModel.ApproverExcelModel = approverExcelModel;
            //TempData[ "periodSelectedValue" ] = periodSelectedValue;
            TempData["superApproverBulkSetupModel"] = superApproverBulkSetupModel;
            return(RedirectToAction("AppraisalApproverBulkSetupForm"));
        }
예제 #24
0
        public ActionResult GetStaffProfile(String StaffNumber)
        {
            string errorResult = "{{\"employee_number\":\"{0}\",\"name\":\"{1}\"}}";

            if (string.IsNullOrEmpty(StaffNumber))
            {
                errorResult = string.Format(errorResult, "Error", "Invalid staff number");
                return(Content(errorResult, "application/json"));
            }

            var profile = new LINQCalls().getBranchStaffProfile(StaffNumber, 1);

            if (profile == null)
            {
                errorResult = string.Format(errorResult, "Error", "No records found for the staff number");
                return(Content(errorResult, "application/json"));
            }
            else
            {
                return(Json(profile, JsonRequestBehavior.AllowGet));
            }
        }
예제 #25
0
        public ActionResult BHSingleSetupForm(BHSingleSetupModel bHSingleSetupModel)
        {
            if (!ModelState.IsValid)
            {
                TempData["ErrorMessage"]       = "Invalid model ";
                TempData["bHSingleSetupModel"] = bHSingleSetupModel;
                return(RedirectToAction("BHSingleSetupForm"));
            }
            bool duplicateEntry = new LINQCalls().checkDuplicateEntry(
                bHSingleSetupModel.SelectedAppraisalPeriod,
                bHSingleSetupModel.StaffNumber,
                bHSingleSetupModel.SelectedBranch
                );

            if (bHSingleSetupModel.SelectedBranch != "001")
            {
                if (!duplicateEntry)
                {
                    TempData["ErrorMessage"]       = "Error : The staff number " + bHSingleSetupModel.StaffNumber + " OR branch " + bHSingleSetupModel.SetupBranch + "  has been setup for the selected appraisal period";
                    TempData["bHSingleSetupModel"] = bHSingleSetupModel;
                    return(RedirectToAction("BHSingleSetupForm"));
                }
            }
            HRProfile hrprofile = new LINQCalls().hrprofile(bHSingleSetupModel.InitiatorLoginName, 1);

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

            //Setup the branch
            int inputMode = 0;
            int retVal    = new AppDatabase().insertSingleSetup(bHSingleSetupModel, hrprofile, inputMode, "AppraisalDbConnectionString");

            return(RedirectToAction("BHSingleSetupForm"));
        }
예제 #26
0
        public ActionResult BHSingleSetupFormEdit(BHSingleSetupEditModel bHSingleSetupEditModel)
        {
            if (!ModelState.IsValid)
            {
                TempData["ErrorMessage"]           = "Invalid model ";
                TempData["bHSingleSetupEditModel"] = bHSingleSetupEditModel;
                return(RedirectToAction("BHSingleSetupFormEdit"));
            }

            HRProfile hrprofile = new LINQCalls().hrprofile(bHSingleSetupEditModel.InitiatorLoginName, 1);

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

            int inputMode = 1;
            int retVal    = new AppDatabase().insertSingleSetup(bHSingleSetupEditModel, hrprofile, inputMode, "AppraisalDbConnectionString");

            return(RedirectToAction("ViewBranchInitiators"));
        }
예제 #27
0
        public IHttpActionResult PostLeaveAllowanceToAccount(string initiator_employee_number,
                                                             string amount,
                                                             string transaction_ref,
                                                             string approver_employee_number)
        {
            logwriter.WriteTolog("In get leave Allowance");
            StaffADProfile initiatorADProfile = new StaffADProfile();

            initiatorADProfile.employee_number = initiator_employee_number;
            initiatorADProfile = LINQCalls.getXceedProfile(initiatorADProfile);
            string                leave_gl_code  = "01-" + initiatorADProfile.branch_code + "-1-53055";
            string                connString     = ConfigurationManager.ConnectionStrings["PhoenixConn"].ConnectionString;
            FTPostingProfille     postingProfile = new FTPostingProfille();
            List <PostingEntries> plist          = new List <PostingEntries>();


            postingProfile = new FTPostingProfille(initiatorADProfile.employee_number,
                                                   initiatorADProfile.branch_code,
                                                   amount, transaction_ref, approver_employee_number);

            //force debit outstanding amount
            plist = new List <PostingEntries>();
            plist.Add(new PostingEntries(leave_gl_code, amount, "DR", "LEAVE ALLOWANCE " + postingProfile.getLeaveFinancialYear() + " /" + initiatorADProfile.name + "/" + initiatorADProfile.account_no));
            plist.Add(new PostingEntries(initiatorADProfile.account_no, amount, "CR", "LEAVE ALLOWANCE " + postingProfile.getLeaveFinancialYear() + " /" + initiatorADProfile.name + "/" + initiatorADProfile.account_no));
            postingProfile.PostingEntries = plist;
            Tuple <int, string> postResult = postingProfile.insertTransaction();

            if (!postResult.Item1.Equals(0))
            {
                return(Ok(postResult.Item1 + " : " + postResult.Item2));
            }
            else
            {
                return(Ok("00: Post Success"));
            }
        }
예제 #28
0
        public ActionResult BHBulkSetupForm(SuperBulkSetupModel superBulkSetupModel)
        {
            HRProfile hrprofile = new LINQCalls().hrprofile(superBulkSetupModel.BHSingleSetupModel.InitiatorLoginName, 1);

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

            string             periodSelectedValue = Request.Form["BHSingleSetupModel.SelectedAppraisalPeriod"];
            HttpPostedFileBase uploadedExcelFile   = superBulkSetupModel.BHBulkSetupFormModel.UploadedExcelFile;

            superBulkSetupModel.BHSingleSetupModel.Comments = "";

            BHBulkSetupFormModel   bHBulkSetupFormModel = superBulkSetupModel.BHBulkSetupFormModel;
            List <SetupExcelModel> setupExcelModel      = GetDataTableFromSpreadsheet(bHBulkSetupFormModel.UploadedExcelFile.InputStream, false, superBulkSetupModel.BHSingleSetupModel, hrprofile);

            superBulkSetupModel.SetupExcelModel = setupExcelModel;
            TempData["periodSelectedValue"]     = periodSelectedValue;
            TempData["superBulkSetupModel"]     = superBulkSetupModel;
            return(RedirectToAction("BHBulkSetupForm"));
        }
예제 #29
0
 public static SelectList GetBranches()
 {
     return(LINQCalls.getBranches());
 }
예제 #30
0
            /*public static SelectList GetUnits( string deptcode ) {
             *  return LINQCalls.getUnits( deptcode );
             * }
             * public static SelectList GetDepts() {
             *  return LINQCalls.getDepts();
             * }*/

            internal static SelectList GetHRRoles()
            {
                return(LINQCalls.getHRRoles());
            }