//[ValidateInput(false)] public ActionResult NewMemo() { _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")); } MemoSetup memoSetup; if (TempData["memoSetup"] != null) { memoSetup = TempData["memoSetup"] as MemoSetup; } else { //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 })); } staffADProfile.grade = new LINQCalls().getStaffGrade(staffADProfile.employee_number); memoSetup = new MemoSetup(); memoSetup.OriginatorName = staffADProfile.user_logon_name; memoSetup.OriginatorNumber = staffADProfile.employee_number; memoSetup.WorkflowID = Guid.NewGuid().ToString().ToUpper(); memoSetup.EntryKey = staffADProfile.employee_number + "_" + DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond + "_" + staffADProfile.branch_code; memoSetup.RequestStageId = 0; memoSetup.RequestStage = INIT_STAGE; memoSetup.StaffADProfile = staffADProfile; memoSetup.SignerDetailsList = new List <SignerDetails>(); memoSetup.SignerDetails = new SignerDetails(); memoSetup.Branch = staffADProfile.branch_name; memoSetup.BranchCode = staffADProfile.branch_code; memoSetup.Signers = String.Empty; memoSetup.CCFields = String.Empty; memoSetup.DeptName = staffADProfile.branch_name; memoSetup.DeptCode = staffADProfile.branch_code; memoSetup.StaffADProfile = staffADProfile; DateTime dt = DateTime.Today; memoSetup.DateOfMemo = dt.ToString("dddd MMMM d, yyyy", CultureInfo.CreateSpecificCulture("en-US")); } memoSetup.SignerDetailsList = memoSetup.SignerDetailsList.OrderBy(x => x.PayGroup_ID).ToList() ?? memoSetup.SignerDetailsList; /** * //sort the list * if ( memoSetup.SignerDetailsList!=null ) { * var d = from x in memoSetup.SignerDetailsList orderby x.PayGroup_ID select x; * memoSetup.SignerDetailsList = d.ToList(); * }**/ Session["signerDetailsList"] = memoSetup.SignerDetailsList; ViewBag.editMode = TempData["editMode"] ?? true; if (TempData["ErrorMessage"] != null) { ViewBag.ErrorMessage = TempData["ErrorMessage"] as string; } return(View(memoSetup)); }
//[AcceptVerbs(HttpVerbs.Post)] //[AcceptParameter(Name = "Checkout")] //public ActionResult MultipleApproval(string[] selectedRows, string button) //{ // return View(); //} // [HttpPost] //[AcceptVerbs(HttpVerbs.Post)] //[AcceptParameter(Name = "Delete")] //public ActionResult MultipleDenial(string[] selectedRows, string UserID, string partnerid, string productid) //{ // return View(); //} public ActionResult MultipleApproval(FormCollection form) { try { StaffADProfile staffADProfile = new StaffADProfile(); // staffADProfile.user_logon_name = User.Identity.Name; CurrentUser currentuser = new CurrentUser(); currentuser.logonName = User.Identity.Name; staffADProfile.user_logon_name = User.Identity.Name; ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); currentuser.UserNo = staffADProfile.employee_number; currentuser.UserName = new AppClass().getProfile(currentuser.UserNo).StaffName; bool checkApproverUser = new AppClass().ValidateCheckApproverUser(staffADProfile.employee_number); ViewData["checkApproverUser"] = checkApproverUser; var ch = form.GetValues("assignChkBx"); var comment = form.GetValue("Comment").AttemptedValue; var Action = form.GetValue("Action").AttemptedValue; bool checkApprover = new AppClass().ValidateCurrentUser(currentuser); currentuser.IsApprover = checkApprover; if (checkApprover == false) { } else { foreach (var id in ch) { TravelCards updatetravel = new TravelCards(); updatetravel = new AppClass().ExplodeRequest(id).First(); updatetravel.travel_request.Action = Action.ToString(); updatetravel.travel_request.Comment = comment.ToString(); var MyTravelApproval = new AppClass().updateDBRequest(updatetravel, currentuser, "TravelConnection"); string[] result = MyTravelApproval.ToString().Split('|'); if (result[0] != "0") { if (result[0] == "2627") { // return Content("Unable to Submit \n Duplicate record"); TempData["ErrorMessage"] = "Unable to Submit \n Duplicate record"; TempData["TravelRequest"] = updatetravel; // return RedirectToAction("AwaitingApproval"); } else { TempData["ErrorMessage"] = result[1]; TempData["TravelRequest"] = updatetravel; // return RedirectToAction("AwaitingApproval"); // return Content(result[1]); } } else { TempData["ErrorMessage"] = "Your Request as been Submitted Successfully "; TempData["TravelRequest"] = updatetravel; SendEmail newmail = new SendEmail(); newmail.sendEmail(updatetravel.travel_request.Accountdetails.Account_Name, updatetravel.travel_request.Accountdetails.AccountNo, updatetravel.travel_request.StaffProfile.StaffNo, updatetravel.travel_request.StaffProfile.StaffName, updatetravel.travel_request.StaffProfile.jobtitle, updatetravel.travel_request.Action, updatetravel.travel_request.Comment, updatetravel.travel_request.ApprovalStage, updatetravel.travel_request.Date_Submitted.ToString(), updatetravel.travel_request.StaffProfile.Email, updatetravel.travel_request.StaffProfile.StaffNo, updatetravel.travel_request.StaffProfile.StaffName); //return RedirectToAction("ExplodeTravelrequest"); if (updatetravel.travel_request.Action != "Deny") { TempData["ErrorMessage"] = "You have Successfully Approved the request"; } else { TempData["ErrorMessage"] = "You have Successfully Denied the request"; } TempData["Key"] = "Approval"; //return RedirectToAction("AwaitingApproval"); } } //return View(); //TempData["Key"] = "Approval"; //return RedirectToAction("AwaitingApproval"); } } catch (Exception ex) { TempData["ErrorMessage"] = ex.Message; TempData["Key"] = "Approval"; return(RedirectToAction("AwaitingApproval")); } return(RedirectToAction("AwaitingApproval")); }
public ActionResult EditMemo(string WorkflowID, bool editMode, bool?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")); } //now resolve the user profile from AD and Xceed StaffADProfile staffADProfile = new StaffADProfile(); staffADProfile.user_logon_name = _UserName; //staffADProfile.user_logon_name = "adebisi.olumoto"; //AD ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); staffADProfile.grade = new LINQCalls().getStaffGrade(staffADProfile.employee_number); 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 })); } //Get the request identified by the Workflow ID MemoSetup memoSetup = new MemoSetup(); memoSetup = new LINQCalls().getWorkflowEntry(WorkflowID); ViewBag.StaffBranch = memoSetup.Branch; int requeststageid = memoSetup.RequestStageId; string requeststage = memoSetup.RequestStage; DateTime requestdate = memoSetup.DateSubmitted; string initiatornumber = new LINQCalls().getInitiatorNumber(WorkflowID) ?? staffADProfile.employee_number; string cansave = (requeststage.Equals(INIT_STAGE) || requeststage.Equals(DENIED)) && initiatornumber.Equals(staffADProfile.employee_number) ? this.CANSAVE : "false"; XElement ApprovalHistory = new LINQCalls().getApprovalHistory(WorkflowID); XDocument xDocument = DataHandlers.ToXDocument(ApprovalHistory); List <ApprovalDetails> approvalHistory = xDocument.Descendants("Approvals") .Select(det => new ApprovalDetails { ApproverNames = det.Element("ApproverName").Value, ApproverStaffNumbers = det.Element("ApproverStaffNumber").Value, ApprovedStages = det.Element("ApprovedStage").Value, ApproverAction = det.Element("ApproverAction").Value, ApprovalDateTime = det.Element("ApprovalDateTime").Value, ApproverComments = det.Element("ApproverComment").Value }).ToList(); memoSetup.SignerDetailsList = GetApprovers(memoSetup); editMode = editMode && memoSetup.RequestStageId.Equals(1); TempData["editMode"] = editMode; //( editMode==true ) ? null : "false"; ViewBag.editMode = editMode; if (TempData["ErrorMessage"] != null) { ViewBag.ErrorMessage = TempData["ErrorMessage"] as string; } TempData["memoSetup"] = memoSetup; return(RedirectToAction("NewMemo", new { UserName = Session["UserName"] as string })); }
public ActionResult SearchResult(SearchViewModel Search) { if (Search.IsAccountClosed == 9) { Search.IsAccountClosed = null; } 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 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; } if (checkICA || checkAdmin) { if (Search.Branch != null) { string[] BranchArray = Search.Branch.Split(':'); Search.Branch = BranchArray[0]; Search.BranchCode = int.Parse(BranchArray[1]); } if (Search.Irregularity != null) { string[] Irregularity = Search.Irregularity.Split(':'); Search.Irregularity = Irregularity[0]; // Search.DomicileBranchCode = Irregularity[1]; } if (Search.ExportToExport != true) { Search.inputlist = new SearchAppClass().SearchTravelRequest(Search); } else { List <ExcelView> excelresult = new List <ExcelView>(); excelresult = new SearchAppClass().SearchTravelRequestExcel(Search); GridView gv = new GridView(); gv.DataSource = excelresult; gv.DataBind(); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=BVN_Incident_Report_Excel_'" + DateTime.Now + "'.xls "); Response.AddHeader("Pragma", "public"); Response.AddHeader("Cache-Control", "max-age=0"); Response.ContentType = "text/html"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.ContentEncoding = System.Text.Encoding.Default; Response.Charset = ""; StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); hw.AddAttribute("xmlns:x", "urn:schemas-microsoft-com:office:excel"); hw.RenderBeginTag(HtmlTextWriterTag.Html); hw.RenderBeginTag(HtmlTextWriterTag.Head); hw.RenderBeginTag(HtmlTextWriterTag.Style); //hw.Write("br {mso-data-placement:same-cell;}"); //hw.RenderEndTag() ; //hw.RenderEndTag(); hw.RenderBeginTag(HtmlTextWriterTag.Body); gv.RenderControl(hw); //hw.RenderEndTag(); //hw.RenderEndTag(); Response.Write(HttpUtility.HtmlDecode(sw.ToString())); Response.Flush(); Response.End(); return(RedirectToAction("SearchPage")); } } else { } //Search.Requests = new SearchAppClass().SearchTravelRequest(Search); return(View("SearchPage", Search)); }
public ActionResult Update(TravelCards updatetravel) { 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 = new AppClass().getProfile(currentuser.UserNo).StaffName; currentuser.logonName = staffADProfile.user_logon_name; currentuser.Email = staffADProfile.email; bool checkApprover = new AppClass().ValidateCurrentUser(currentuser); if (!checkApprover) { TempData["ErrorMessage"] = "You are not authorize to Perform these operation"; TempData["TravelRequest"] = updatetravel; return(RedirectToAction("ExplodeTravelrequest")); } else { var MyTravelApproval = new AppClass().updateDBRequest(updatetravel, currentuser, "TravelConnection"); string[] result = MyTravelApproval.ToString().Split('|'); if (result[0] != "0") { if (result[0] == "2627") { // return Content("Unable to Submit \n Duplicate record"); TempData["ErrorMessage"] = "Unable to Submit \n Duplicate record"; TempData["TravelRequest"] = updatetravel; return(RedirectToAction("ExplodeTravelrequest")); } else { TempData["ErrorMessage"] = result[1]; TempData["TravelRequest"] = updatetravel; return(RedirectToAction("ExplodeTravelrequest")); // return Content(result[1]); } } else { TempData["ErrorMessage"] = "Your Request as been Submitted Successfully "; TempData["TravelRequest"] = updatetravel; SendEmail newmail = new SendEmail(); newmail.sendEmail(updatetravel.travel_request.Accountdetails.Account_Name, updatetravel.travel_request.Accountdetails.AccountNo, updatetravel.travel_request.StaffProfile.StaffNo, updatetravel.travel_request.StaffProfile.StaffName, updatetravel.travel_request.StaffProfile.jobtitle, updatetravel.travel_request.Action, updatetravel.travel_request.Comment, updatetravel.travel_request.ApprovalStage, updatetravel.travel_request.Date_Submitted.ToString(), updatetravel.travel_request.StaffProfile.Email, updatetravel.travel_request.StaffProfile.StaffNo, updatetravel.travel_request.StaffProfile.StaffName); //return RedirectToAction("ExplodeTravelrequest"); if (updatetravel.travel_request.Action != "Deny") { TempData["ErrorMessage"] = "You have Successfully Approved the request"; } else { TempData["ErrorMessage"] = "You have Successfully Denied the request"; } TempData["Key"] = "Approval"; return(RedirectToAction("AwaitingApproval")); } } } catch (Exception ex) { return(Content(ex.Message)); } }
public ActionResult TargetInputForm(string UserName) { if (UserName == null || UserName.Equals(String.Empty)) { ViewBag.ErrorMessage = "You must be logged in to continue."; return(RedirectToAction("AwaitingMyApproval", "AwaitingApproval")); } SuperInputTargetModel superInputTargetModel = new SuperInputTargetModel(); if (TempData["superInputTargetModel"] != null) { superInputTargetModel = TempData["superInputTargetModel"] as SuperInputTargetModel; } else { //now resolve the user profile from AD and Xceed StaffADProfile staffADProfile = new StaffADProfile(); staffADProfile.user_logon_name = UserName; // staffADProfile.user_logon_name = "ADAMU.LAWANI"; //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 })); } //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(RedirectToAction("AwaitingMyApproval", "AwaitingApproval", new { UserName = Session["UserName"] as string })); } ViewBag.StaffBranch = staffADProfile.branch_name + ((staffADProfile.branch_code.Equals(HOBRCODE)) ? " | " + staffADProfile.hodeptcode : String.Empty); ViewBag.StaffNumber = staffADProfile.employee_number; //Check if the initiator/branch/has an existing entry for the AppraisalPeriod List <RequestDetails> requestDetails = new List <RequestDetails>(); if (staffADProfile.branch_code != "001") { requestDetails = new LINQCalls().getExistingTargetEntry(staffADProfile); } else { ////staffprofile ho_staff_pro = new staffprofile(); //// ho_staff_pro = new LINQCalls().getProfile(staffADProfile.employee_number); requestDetails = new LINQCalls().getExistingHOTargetEntry(staffADProfile); } //Great. Everything looks okay." //Now let's get the staff reporting to you--using branchcode and deptcode(HO only) //see if the requestdetails entry has anything if (requestDetails.Count <= 0) { requestDetails = (staffADProfile.branch_code.Equals(HOBRCODE)) ? new LINQCalls().getMarketingStaff_HO(staffADProfile): new LINQCalls().getMarketingStaff_Branch(staffADProfile); } else { //OH dear:-) You go some shit keyed in before now---we're gonna blast u to My Entries view--hold tight //return RedirectToAction("MyEntries",new { UserName=UserName } ); return(RedirectToAction("MyEntries", "MyEntries", new { UserName = UserName })); } Debug.WriteLine(requestDetails); /**Now lets see if the list contains the others entry***/ //if others is not found, add //if others exists, then send it to the bottom of the stack if (!requestDetails.Exists(x => x.name.ToUpper().Contains(OTHERS))) { RequestDetails os = new RequestDetails(); os.employee_number = NA; os.name = OTHERS; os.grade = NA; requestDetails.Add(os); } Debug.WriteLine(Session.SessionID.ToString().ToUpper()); string workflowid = (requestDetails.ElementAt(0).workflowid.Equals(String.Empty)) ? Guid.NewGuid().ToString().ToUpper() : requestDetails.ElementAt(0).workflowid; //string workflowid = ( requestDetails.ElementAt(0).workflowid.Equals(String.Empty) ) ? Session.SessionID.ToString().ToUpper() : requestDetails.ElementAt(0).workflowid; int requeststageid = requestDetails.ElementAt(0).requeststageid; string requeststage = requestDetails.ElementAt(0).requeststage ?? String.Empty; DateTime requestdate = requestDetails.ElementAt(0).requestdate; string initiatornumber = new LINQCalls().getInitiatorNumber(workflowid) ?? staffADProfile.employee_number; string cansave = (requeststage.Equals(INIT_STAGE) || requeststage.Equals(DENIED)) && initiatornumber.Equals(staffADProfile.employee_number) ? this.CANSAVE : "false"; superInputTargetModel = new SuperInputTargetModel { WorkflowID = workflowid, RequestStageID = requeststageid, RequestStage = requeststage, RequestDate = requestdate, CanSave = cansave, StaffADProfile = staffADProfile, RequestDetails = requestDetails, EntryModel = null, RequestBranch = staffADProfile.branch_name, RequestBranchCode = staffADProfile.branch_code }; /*if( TempData["superInputTargetModel"]!=null ){ * superInputTargetModel = TempData["superInputTargetModel"] as SuperInputTargetModel; * } else { * superInputTargetModel = new SuperInputTargetModel{ * WorkflowID = workflowid, * RequestStageID = requeststageid, * RequestStage = requeststage, * RequestDate = requestdate, * StaffADProfile = staffADProfile, * RequestDetails = requestDetails, * EntriesModel = null * }; * }*/ } //sort the list var d = from x in superInputTargetModel.RequestDetails orderby x.name == OTHERS, x.name select x; superInputTargetModel.RequestDetails = d.ToList(); Session["requestDetails"] = superInputTargetModel.RequestDetails; Session["UserName"] = UserName; if (TempData["ErrorMessage"] != null) { ViewBag.ErrorMessage = TempData["ErrorMessage"] as string; } superInputTargetModel.StaffADProfile.in_StaffName = ""; superInputTargetModel.StaffADProfile.in_StaffNumber = ""; superInputTargetModel.StaffADProfile.in_StaffGrade = ""; return(View(superInputTargetModel)); }
public ActionResult EditTarget(string UserName, string WorkflowID, bool editMode, bool?myEntries) { // editMode = true; 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; //staffADProfile.user_logon_name = "adebisi.olumoto"; //AD ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); //GET ENTERY BRANC CODE staffADProfile.branch_code = new LINQCalls().getEntryProfile(WorkflowID).branch_code; staffADProfile.branch_name = new LINQCalls().getEntryProfile(WorkflowID).branch_name; 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 })); } //GET THE APPROVERS DETAILS FROM EXCEED //Approver Setup //Resolve the --branchname --branchcode --department --deptcode /* * staffADProfile = new LINQCalls().setInitiatorFields( staffADProfile ); * if( staffADProfile.branch_code==null ){ * ViewBag.ErrorMessage="Your profile is not properly setup on Exceed. Please contact Human Resources."; * return RedirectToAction( "AwaitingMyApproval","AwaitingApproval",new { UserName = Session["UserName"] as string } ); * } * */ //Get the request identified by the workflow id List <RequestDetails> requestDetails = new List <RequestDetails>(); if (myEntries != null && myEntries == true) { string entrykey = staffADProfile.employee_number + "_" + staffADProfile.appperiod + "_" + staffADProfile.branch_code; requestDetails = new LINQCalls().getExistingTargetEntry(WorkflowID, staffADProfile.employee_number, entrykey); } else { requestDetails = new LINQCalls().getExistingTargetEntry(WorkflowID, staffADProfile.employee_number); } EntryModel entryModel = new EntryModel(); entryModel = new LINQCalls().getWorkflowEntry(WorkflowID); ViewBag.StaffBranch = entryModel.Branch; int requeststageid = entryModel.RequestStageId; string requeststage = entryModel.RequestStage; DateTime requestdate = entryModel.DateSubmitted; string initiatornumber = new LINQCalls().getInitiatorNumber(WorkflowID) ?? staffADProfile.employee_number; //staffADProfile.branch_code = new LINQCalls().getProfile(staffADProfile.employee_number).branch_code; //if (requeststage.Equals(INIT_STAGE)) //{ // staffADProfile.branch_code = new LINQCalls().setInitiatorFields(staffADProfile).branch_code; //} string cansave = (requeststage.Equals(INIT_STAGE) || requeststage.Equals(DENIED)) && initiatornumber.Equals(staffADProfile.employee_number) ? this.CANSAVE : "false"; staffADProfile.appperiod = entryModel.AppraisalPeriod; XElement ApprovalHistory = new LINQCalls().getApprovalHistory(WorkflowID); XDocument xDocument = DataHandlers.ToXDocument(ApprovalHistory); List <ApprovalDetails> approvalHistory = xDocument.Descendants("Approvals") .Select(det => new ApprovalDetails { ApproverNames = det.Element("ApproverName").Value, ApproverStaffNumbers = det.Element("ApproverStaffNumber").Value, ApprovedStages = det.Element("ApprovedStage").Value, ApproverAction = det.Element("ApproverAction").Value, ApprovalDateTime = det.Element("ApprovalDateTime").Value }) .ToList(); SuperInputTargetModel superInputTargetModel = new SuperInputTargetModel(); if (TempData["superInputTargetModel"] != null) { superInputTargetModel = TempData["superInputTargetModel"] as SuperInputTargetModel; } else { superInputTargetModel = new SuperInputTargetModel { WorkflowID = WorkflowID, RequestStageID = entryModel.RequestStageId, RequestStage = entryModel.RequestStage, RequestDate = entryModel.DateSubmitted, StaffADProfile = staffADProfile, RequestDetails = requestDetails, CanSave = cansave, ApprovalDetails = approvalHistory, EntryModel = entryModel, RequestBranch = entryModel.Branch, RequestBranchCode = entryModel.BranchCode }; } //sort the list var d = from x in superInputTargetModel.RequestDetails orderby x.name == OTHERS, x.name select x; superInputTargetModel.RequestDetails = d.ToList(); Session["requestDetails"] = superInputTargetModel.RequestDetails; Session["UserName"] = UserName; TempData["editMode"] = (editMode == true) ? null : "false"; if (TempData["ErrorMessage"] != null) { ViewBag.ErrorMessage = TempData["ErrorMessage"] as string; } TempData["superInputTargetModel"] = superInputTargetModel; return(RedirectToAction("TargetInputForm", new { UserName = Session["UserName"] as string })); }
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)); }
public ActionResult ViewPassport(string WorkflowID, bool editMode, bool?myEntries, bool?viewMode) { 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(); staffADProfile.branch_code = LINQCalls.getEntryProfile(WorkflowID).branch_code; staffADProfile.branch_name = LINQCalls.getEntryProfile(WorkflowID).branch_name; if (staffADProfile == null) { ViewBag.ErrorMessage = "Your profile is not properly setup on the system. Please contact InfoTech."; return(RedirectToAction("AwaitingMyApproval", "AwaitingApproval")); } //Get the request identified by the workflow id List <RequestDetails> requestDetails = new List <RequestDetails>(); if (myEntries != null && myEntries == true) { string entrykey = staffADProfile.employee_number + "_" + staffADProfile.branch_code; requestDetails = LINQCalls.getExistingPassportEntry(WorkflowID, staffADProfile.employee_number, entrykey); } else { requestDetails = LINQCalls.getExistingPassportEntry(WorkflowID, staffADProfile.employee_number); } EntryModel entryModel = new EntryModel(); entryModel = LINQCalls.getWorkflowEntry(WorkflowID); ViewBag.StaffBranch = entryModel.Branch; int requeststageid = entryModel.RequestStageId; string requeststage = entryModel.RequestStage; DateTime requestdate = entryModel.DateSubmitted; string initiatornumber = LINQCalls.getInitiatorNumber(WorkflowID) ?? staffADProfile.employee_number; string cansave = (requeststage.Equals(INIT_STAGE) || requeststage.Equals(DENIED)) && initiatornumber.Equals(staffADProfile.employee_number) ? "true" : "false"; staffADProfile.appperiod = entryModel.AppraisalPeriod; XElement ApprovalHistory = LINQCalls.getApprovalHistory(WorkflowID); XDocument xDocument = DataHandlers.ToXDocument(ApprovalHistory); List <ApprovalDetails> approvalHistory = xDocument.Descendants("Approvals").Select(det => new ApprovalDetails { ApproverNames = det.Element("ApproverName").Value, ApproverStaffNumbers = det.Element("ApproverStaffNumber").Value, ApprovedStages = det.Element("ApprovedStage").Value, ApproverAction = det.Element("ApproverAction").Value, ApprovalDateTime = det.Element("ApprovalDateTime").Value }) .ToList(); SuperPassportModel superPassportModel = new SuperPassportModel(); if (TempData["superPassportModel"] != null) { superPassportModel = TempData["superPassportModel"] as SuperPassportModel; } else { superPassportModel = new SuperPassportModel { WorkflowID = WorkflowID, RequestStageID = entryModel.RequestStageId, RequestStage = entryModel.RequestStage, RequestDate = entryModel.DateSubmitted, StaffADProfile = staffADProfile, RequestDetails = requestDetails, CanSave = cansave, ApprovalDetails = approvalHistory, EntryModel = entryModel, RequestBranch = entryModel.Branch, RequestBranchCode = entryModel.BranchCode }; } Session["requestDetails"] = superPassportModel.RequestDetails; TempData["editMode"] = (editMode == true) ? null : "false"; if (TempData["ErrorMessage"] != null) { ViewBag.ErrorMessage = TempData["ErrorMessage"] as string; } TempData["superPassportModel"] = superPassportModel; return(RedirectToAction("PassportInputForm")); }
public ActionResult PassportInputForm() { 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")); } SuperPassportModel superPassportModel = new SuperPassportModel(); StaffADProfile staffADProfile = new StaffADProfile(); if (TempData["superPassportModel"] != null) { superPassportModel = TempData["superPassportModel"] as SuperPassportModel; staffADProfile = superPassportModel.StaffADProfile; ViewBag.hasdata = "true"; //superPassportModel.PassportDetails.First().Nationality = SelectListItemHelper.GetCountries(); } else { //now resolve the user profile from AD and Xceed 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")); } //EXCEED staffADProfile = LINQCalls.getXceedProfile(staffADProfile.employee_number); staffADProfile.doe = staffADProfile.doe; staffADProfile.dob = staffADProfile.dob; string sex = (staffADProfile.gender.Equals(1)) ? SEX_FEMALE: SEX_MALE; List <RequestDetails> requestDetails = new List <RequestDetails>(); List <PassportDetails> passportDetails = new List <PassportDetails>(); requestDetails = LINQCalls.getExistingPassportEntry(staffADProfile); string workflowid = Guid.NewGuid().ToString().ToUpper(); int requeststageid = 0; string requeststage = INIT_STAGE; DateTime requestdate = new DateTime(); string cansave = this.CANSAVE; superPassportModel = new SuperPassportModel { WorkflowID = workflowid, RequestStageID = requeststageid, RequestStage = requeststage, RequestDate = requestdate, CanSave = cansave, StaffADProfile = staffADProfile, RequestDetails = requestDetails, EntryModel = null, RequestBranch = staffADProfile.branch_name, RequestBranchCode = staffADProfile.branch_code, PassportDetails = passportDetails }; } staffADProfile.NumberOfCountries = SelectListItemHelper.GetNumberCountries(); superPassportModel.StaffADProfile = staffADProfile; if (TempData["ErrorMessage"] != null) { ViewBag.ErrorMessage = TempData["ErrorMessage"] as string; } return(View(superPassportModel)); }