public ActionResult SearchPage() { StaffADProfile staffADProfile = new StaffADProfile(); //CurrentUser currentuser = new CurrentUser(); staffADProfile.user_logon_name = User.Identity.Name; ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); Profile profile = new Profile(); profile = new LinqCalls().getProfile(staffADProfile.employee_number); 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; if (checkICA || checkAdmin) { ViewData["HopUser"] = false; //ViewData["ICA"] = true; return(View()); } else { ViewData["HopUser"] = false; //ViewData["ICA"] = false; TempData["ErrorMessage"] = "You are not Authorized to view this page"; //TempData["Approvernames"] = string.Join("\\n", approverNames); return(RedirectToAction("ErrorPage")); } }
public ActionResult Index() { StaffADProfile staffADProfile = new StaffADProfile(); // staffADProfile.user_logon_name = Environment.UserName; staffADProfile.user_logon_name = User.Identity.Name; // staffADProfile.user_logon_name = "ijeoma.okoye"; //AD ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); Profile profile = new Profile(); profile = new LinqCalls().getProfile(staffADProfile.employee_number); 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; if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS" || checkAdmin == true) { ViewData["HopUser"] = true; } else { ViewData["HopUser"] = false; } return(View()); }
public ActionResult ErrorPage() { StaffADProfile staffADProfile = new StaffADProfile(); // CurrentUser currentuser = new CurrentUser(); staffADProfile.user_logon_name = User.Identity.Name; ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); 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; } ViewBag.ErrorMessage = TempData["ErrorMessage"] as string; return(View()); }
public ActionResult NewIncident() { long ticks = DateTime.Now.Ticks; byte[] bytes = BitConverter.GetBytes(ticks); string id = Convert.ToBase64String(bytes) .Replace('+', '_') .Replace('/', '-') .TrimEnd('='); StaffADProfile staffADProfile = new StaffADProfile(); // staffADProfile.user_logon_name = Environment.UserName; staffADProfile.user_logon_name = User.Identity.Name; //AD ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); Profile profile = new Profile(); profile = new LinqCalls().getProfile(staffADProfile.employee_number); 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; if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS" || checkAdmin == true) { ViewData["HopUser"] = true; InputClass input = new InputClass(); Account account = new Account(); input.RequesterDetails = profile; input.RequesterDetails.JobTitle = profile.JobTitle; input.RequesterDetails.Job_Category = profile.JobTitle; input.AccountDetials = account; input.RequesterDetails.Email = staffADProfile.email; input.DocumentID = profile.StaffNo + "BVNINCIDENT" + id; return(View(input)); } else { ViewData["HopUser"] = false; TempData["ErrorMessage"] = "You are not Authorized to view this page"; return(RedirectToAction("ErrorPage")); } //AD }
public ActionResult Edit_Approver(string StaffNumber) { try { 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 IC_A_Users().ValidateCheckApproverUser(staffADProfile.employee_number); //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") { ViewData["HopUser"] = true; } else { ViewData["HopUser"] = false; } if (!checkAdmin) { TempData["ErrorMessage"] = "You are not authorized to Perform these operation"; //TempData["TravelRequest"] = approver; return(RedirectToAction("Manage_Approval_List")); } else { ApproverInfo approvers = new ApproverInfo(); approvers = new IC_A_Users().GetApproverDetails(StaffNumber).First(); ViewBag.ErrorMessage = TempData["ErrorMessage"] as string; return(View(approvers)); } } catch (Exception ex) { TempData["ErrorMessage"] = ex.Message; return(RedirectToAction("Edit_Approver")); } }
public ActionResult Manage_Approval_List() { StaffADProfile staffADProfile = new StaffADProfile(); //CurrentUser currentuser = new CurrentUser(); staffADProfile.user_logon_name = User.Identity.Name; ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); 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") { ViewData["HopUser"] = true; } else { ViewData["HopUser"] = false; } if (!checkAdmin) { TempData["ErrorMessage"] = ""; return(RedirectToAction("ErrorPage")); } else { ApproverInfo approvers = new ApproverInfo(); //approvers = new AdminClass().GetApproverList(); ViewBag.ErrorMessage = TempData["ErrorMessage"] as string; return(View(approvers)); } //List<ApproverInfo> approvers = new List<ApproverInfo>(); }
public ActionResult OpenIncident(string DocumentID) { StaffADProfile staffADProfile = new StaffADProfile(); // staffADProfile.user_logon_name = Environment.UserName; staffADProfile.user_logon_name = User.Identity.Name; //AD ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); Profile profile = new Profile(); profile = new LinqCalls().getProfile(staffADProfile.employee_number); 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; if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS" || checkAdmin == true || checkICA == true) { if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS" || checkAdmin == true) { ViewData["HopUser"] = true; } else { ViewData["HopUser"] = false; } InputClass Entry = new InputClass(); Entry = new ProcessEntry().GetEntry(DocumentID).First(); ViewBag.date = Entry.DateSubmitted; return(View(Entry)); } else { ViewData["HopUser"] = false; TempData["ErrorMessage"] = "You are not Authorized to view this page"; return(RedirectToAction("ErrorPage")); } }
public ActionResult MyInicidentEntry() { StaffADProfile staffADProfile = new StaffADProfile(); // staffADProfile.user_logon_name = Environment.UserName; staffADProfile.user_logon_name = User.Identity.Name; //AD ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); Profile profile = new Profile(); profile = new LinqCalls().getProfile(staffADProfile.employee_number); 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; if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS" || checkAdmin == true) { // ViewData["Admin"] = false; ViewData["HopUser"] = true; // ViewData["ICA"] = false; var EntryList = new ProcessEntry().GetMyIncidentEntry(staffADProfile); ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ? "" : "<script type='text/javascript'>alert('" + TempData["ErrorMessage"] + "');</script>"; return(View(EntryList)); } else { // ViewData["Admin"] = false; ViewData["HopUser"] = false; //ViewData["ICA"] = false; TempData["ErrorMessage"] = "You are not Authorized to view this page"; //TempData["Approvernames"] = string.Join("\\n", approverNames); return(RedirectToAction("ErrorPage")); } }
public ActionResult GetAccountInfo(string BVN) { StaffADProfile staffADProfile = new StaffADProfile(); // staffADProfile.user_logon_name = Environment.UserName; staffADProfile.user_logon_name = User.Identity.Name; //AD ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); Profile profile = new Profile(); profile = new LinqCalls().getProfile(staffADProfile.employee_number); if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS") { ViewData["HopUser"] = true; ViewData["ICA"] = false; List <Account> details = new List <Account>(); details = new PheonixQuery().getAccounts(BVN); if (details == null) { errorResult = string.Format(errorResult, "Error", "No Account"); return(Content(errorResult, "application/json")); } else { return(PartialView("GetAccountInfo", details)); } } else { ViewData["HopUser"] = false; ViewData["ICA"] = false; TempData["ErrorMessage"] = "You are not Authorized to view this page"; //TempData["Approvernames"] = string.Join("\\n", approverNames); return(RedirectToAction("ErrorPage")); } }
public ActionResult MyBranchEntry() { StaffADProfile staffADProfile = new StaffADProfile(); // staffADProfile.user_logon_name = Environment.UserName; staffADProfile.user_logon_name = User.Identity.Name; //AD ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); Profile profile = new Profile(); profile = new LinqCalls().getProfile(staffADProfile.employee_number); 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; if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS" || checkAdmin == true) { ViewData["HopUser"] = true; var EntryList = new ProcessEntry().SearchBranchRequest(profile.BranchCode.ToString()); return(View(EntryList)); } else { ViewData["HopUser"] = false; TempData["ErrorMessage"] = "You are not Authorized to view this page"; //TempData["Approvernames"] = string.Join("\\n", approverNames); return(RedirectToAction("ErrorPage")); } }
public ActionResult DeleteApprover(string Approver_ID) { try { 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 checkAdmin = new IC_A_Users().ValidateAdminUser(staffADProfile.employee_number); ////ViewData["checkAdmin"] = checkAdmin; //bool checkApproverUser = new IC_A_Users().ValidateCheckApproverUser(staffADProfile.employee_number); //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") { ViewData["HopUser"] = true; } else { ViewData["HopUser"] = false; } if (!checkAdmin) { TempData["ErrorMessage"] = "You are not authorized to Perform these operation"; //TempData["TravelRequest"] = approver; return(RedirectToAction("Manage_Approval_List")); } else { var delete = new IC_A_Users().DeleteApprover(Approver_ID); string[] result = delete.ToString().Split('|'); if (result[0] != "0") { if (result[0] == "2627") { TempData["ErrorMessage"] = result[1]; // TempData["TravelRequest"] = approver; return(RedirectToAction("ApproverList")); } else { TempData["ErrorMessage"] = result[1]; // TempData["TravelRequest"] = approver; return(RedirectToAction("ApproverList")); } } else { TempData["ErrorMessage"] = "You have successfully Updated ApproverName"; // TempData["Approvernames"] = string.Join("\\n", approverNames); return(RedirectToAction("ApproverList")); } } } catch (Exception ex) { return(Content(ex.Message)); } }
public ActionResult SaveBVNIncident(InputClass incidentInput) { StaffADProfile staffADProfile = new StaffADProfile(); // staffADProfile.user_logon_name = Environment.UserName; staffADProfile.user_logon_name = User.Identity.Name; //AD ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile); staffADProfile = activeDirectoryQuery.GetStaffProfile(); Profile profile = new Profile(); profile = new LinqCalls().getProfile(staffADProfile.employee_number); 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; if (incidentInput.Comment == "" || incidentInput.Comment == null) { incidentInput.Comment = "none"; } if (profile.JobTitle == "HEAD OF OPERATIONS" || profile.JobTitle == "ACTING HEAD OF OPERATIONS" || checkAdmin == true) { ViewData["HopUser"] = true; //string[] Irregularityarray = incidentInput.Irregularity.Split(':'); //incidentInput.Irregularity = Irregularityarray[0]; if (incidentInput.IrregularityDetails == null) { incidentInput.IrregularityDetails = ""; } var initiateIncidental = new ProcessSubmit().initiateIncident(incidentInput, "AppraisalDbConnectionString"); string[] result = initiateIncidental.ToString().Split('|'); if (result[0] != "0") { ViewData["HopUser"] = true; TempData["ErrorMessage"] = result[1]; //TempData["TravelRequest"] = incidentInput; return(RedirectToAction("ErrorPage")); } else { // List<ApproverInfo> approversnames = new List<ApproverInfo>(); List <ApproverInfo> approvers = new List <ApproverInfo>(); approvers = new IC_A_Users().getApproverInfo(); var approverNames = new IC_A_Users().getApprovernames(); foreach (var approver in approvers) { SendEmail newmail = new SendEmail(); newmail.sendEmail(approver.Email, incidentInput.AccountDetials.Firstname, incidentInput.AccountDetials.LastName, incidentInput.AccountDetials.AccountName, incidentInput.AccountDetials.BVN, incidentInput.Irregularity, incidentInput.Comment, incidentInput.RequesterDetails.Branch, incidentInput.RequesterDetails.StaffName); } TempData["Key"] = "Insert"; TempData["ErrorMessage"] = "You have successfully submitted your Entry"; TempData["TravelRequest"] = incidentInput; return(RedirectToAction("MyInicidentEntry")); } } else { ViewData["HopUser"] = false; TempData["ErrorMessage"] = "You are not Authorized to view this page"; //TempData["Approvernames"] = string.Join("\\n", approverNames); return(RedirectToAction("ErrorPage")); } }
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)); }