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")); }
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")); }
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 NewMemo(MemoSetup memoSetup, string MemoAction, string StaffNumber) { List <SignerDetails> signerDetails = memoSetup.SignerDetailsList ?? new List <SignerDetails>(); //IEnumerable<RequestDetails> requestdetails = memoSetup.RequestDetails; //DataTable dataTable = DataHandlers.ToDataTable(requestdetails); string retVal = ""; switch (MemoAction) { case "AddSignatory": //ADD the new Staff from the list if (AddSignatory(memoSetup)) { signerDetails.Add(TempData["newSignatory"] as SignerDetails); } break; case "DeleteSignatory": //DELETE the selected Staff from the list if (DeleteSignatory(memoSetup, StaffNumber)) { signerDetails = TempData["signerDetails"] as List <SignerDetails>; } break; case "Reset": // RESET all entries memoSetup = null; signerDetails = null; break; case "Save": memoSetup.Action = SAVED_STATUS; memoSetup.UploadStatus = SAVED_STATUS; retVal = new AppDatabase().saveMemo(memoSetup, "AppraisalDbConnectionString", SAVED_STATUS); if (retVal != null) { TempData["SaveComplete"] = "false"; TempData["ErrorMessage"] = retVal; } break; /*case "Deny": * // Good. let's send this f@*ker back * requestDetails.Select( c => { c.entry_key = c.employee_number+"_"+superInputTargetModel.StaffADProfile.appperiod +"_"+superInputTargetModel.StaffADProfile.branch_code; return c; } ).ToList(); * requestDetails.Select( c => { c.workflowid = superInputTargetModel.WorkflowID; return c; } ).ToList(); * * // SAVE the value to the DATABASE * requestdetails = superInputTargetModel.RequestDetails; * dataTable = DataHandlers.ToDataTable(requestdetails); * * retVal = new AppDatabase().inputTargetEntries( dataTable , superInputTargetModel , "AppraisalDbConnectionString" , DENIED_STATUS ); * Debug.WriteLine(retVal); * * if( retVal!=null ){ * TempData["UploadComplete"] = "false"; * TempData["ErrorMessage"] = retVal; * TempData["superInputTargetModel"] = superInputTargetModel; * }else { * //String.format(SUMBMITTEDMSG)--add the approvers * var approvers = new LINQCalls().getApproverNames(superInputTargetModel.WorkflowID,-1); * TempData["PostBackMessage"] = DENIEDMSG; * TempData["Approvers"] = string.Join("\\n", approvers.ToArray()); * return RedirectToAction( "AwaitingMyApproval","AwaitingApproval",new { UserName = Session["UserName"] as string } ); * } * break;*/ case "Submit": //LET'S SUBMIT THIS SHIT //Remove the current approver from the approver list if (memoSetup.RequestStageId != 0) { memoSetup.SignerDetailsList.Remove(signerDetails.Single(s => s.ApproverStaffNumber.Equals(memoSetup.StaffADProfile.employee_number))); memoSetup.RequestStageId = 1; if (memoSetup.SignerDetailsList.Count <= 0) { memoSetup.RequestStageId = 2; } } memoSetup.Signers = getSigners(memoSetup); memoSetup.Action = SUBMIT_STATUS; memoSetup.UploadStatus = SUBMIT_STATUS; retVal = new AppDatabase().saveMemo(memoSetup, "AppraisalDbConnectionString", SUBMIT_STATUS); string[] retVals = retVal.Split('_'); if (retVals.Length > 2 && retVals[2] != null) { TempData["UploadComplete"] = "false"; TempData["ErrorMessage"] = retVal; TempData["memoSetup"] = memoSetup; } else { //Show the approvers var approvers = memoSetup.SignerDetailsList.Select(approver => approver.ApproverStaffName).ToArray(); TempData["PostBackMessage"] = SUMBMITTEDMSG; TempData["Approvers"] = string.Join("\\n", approvers); return(RedirectToAction("AwaitingMyApproval", "AwaitingApproval", new { UserName = Session["UserName"] as string })); } break; } memoSetup.SignerDetailsList = signerDetails; TempData["memoSetup"] = memoSetup; return(RedirectToAction("NewMemo", new { UserName = Session["UserName"] as string })); }