protected void Page_Load(object sender, EventArgs e) { user = (Staff)Session["User"]; if (user != null) { userName = user.StaffName; userRole = user.Role.RoleName; CheckDelegatePerson(); LogicUniversityDataModel.Delegate delegateStaff = authorityDelegationController.CheckStatusByStaffId(user.StaffId); delegateStatus = CheckDelegate(delegateStaff); if (!IsPostBack) { if (HttpContext.Current.User.Identity.IsAuthenticated) { lblUserName.Text = userName; lblUserRole.Text = userRole; LoadMenu(); } else { lblUserName.Text = "No User Name"; } } } else { Response.Redirect("~/Login.aspx"); } }
public void CheckDelegatePerson() { LogicUniversityDataModel.Delegate checkAuthority = authorityDelegationController.CheckStatus(user.DepartmentId); if (checkAuthority != null) { if (checkAuthority.EndDate.Value.Date < (DateTime.Now.Date)) { authorityDelegationController.TermiateEmployee(user.DepartmentId); } } }
public static WCFStaffDelegationModel CheckDelegationStatus(string depId) { ManageAuthorityDelegationController manageAuthorityDelegationController = new ManageAuthorityDelegationController(); LogicUniversityDataModel.Delegate delegation = manageAuthorityDelegationController.CheckStatus(depId); WCFStaffDelegationModel staffDelegation = new WCFStaffDelegationModel(); if (delegation != null) { // if (DateTime.Now.Date <= delegation.StartDate.Value.Date) // { staffDelegation.DelegateId = delegation.DelegateId; staffDelegation.DepartmentHeadId = delegation.DepartmentHeadId; staffDelegation.StaffId = delegation.StaffId; staffDelegation.StaffName = delegation.Staff.StaffName; staffDelegation.RoleName = delegation.Staff.Role.RoleName; staffDelegation.StartDate = ((DateTime)delegation.StartDate).ToString(format); staffDelegation.EndDate = ((DateTime)delegation.EndDate).ToString(format); if ((Boolean)delegation.Status) { staffDelegation.Status = "TRUE"; } else { staffDelegation.Status = "FALSE"; } // } //if(DateTime.Now.Date > delegation.EndDate.Value.Date) //{ // staffDelegation.DelegateId = delegation.DelegateId; // staffDelegation.DepartmentHeadId = delegation.DepartmentHeadId; // staffDelegation.StaffId = delegation.StaffId; // staffDelegation.StaffName = delegation.Staff.StaffName; // staffDelegation.RoleName = delegation.Staff.Role.RoleName; // staffDelegation.StartDate = ((DateTime)delegation.StartDate).ToString(format); // staffDelegation.EndDate = ((DateTime)delegation.EndDate).ToString(format); // if ((Boolean)delegation.Status) // { // staffDelegation.Status = "TRUE"; // } // else // { // staffDelegation.Status = "FALSE"; // } //} //(DateTime.Now.Date > delegation.EndDate.Value.Date) } return(staffDelegation); }
private bool CheckDelegate(LogicUniversityDataModel.Delegate delegateInfo) { if (delegateInfo != null) { if (delegateInfo.Status == true && delegateInfo.EndDate.Value.Date >= (DateTime.Now.Date)) { return(true); } else { return(false); } } else { return(false); } }
protected void Page_Load(object sender, EventArgs e) { var sdate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day); CalendarExtender1.StartDate = sdate; CalendarExtender2.StartDate = sdate; user = (Staff)Session["User"]; if (!IsPostBack) { lblDepartmentName.Text = user.Department.DepartmentName; List <Staff> staffList = delegateController.GetStaffNameByDepartmentId(user.DepartmentId, user.StaffId); ddlEmpList.DataSource = staffList; ddlEmpList.DataValueField = "StaffId"; ddlEmpList.DataTextField = "StaffName"; ddlEmpList.DataBind(); ddlEmpList.Items.Insert(0, "Select Employee Name"); LogicUniversityDataModel.Delegate deleInfoStatus = delegateController.CheckStatus(user.DepartmentId); if (deleInfoStatus == null) { btnDeletegate.Enabled = true; } else { btnDeletegate.Enabled = false; btnDeletegate.Text = "Delegated"; btnDeletegate.CssClass = "btn btn-danger"; List <DelegateEmployee> delegateEmployee = new List <DelegateEmployee>(); DelegateEmployee emp = new DelegateEmployee(); emp.StaffId = deleInfoStatus.StaffId; emp.StaffName = deleInfoStatus.Staff.StaffName; emp.StartDate = deleInfoStatus.StartDate; emp.EndDate = deleInfoStatus.EndDate; delegateEmployee.Add(emp); grv_delegate.DataSource = delegateEmployee; grv_delegate.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { user = (Staff)Session["User"]; deleInfoStatus = delegateController.CheckStatusByStaffId(user.StaffId); BindGridView(); }
protected void Page_Load(object sender, EventArgs e) { user = (Staff)Session["User"]; bool? status = viewStationeryRequisitionController.CheckDelegateStatus(user.StaffId); delegatedPerson = delegateController.CheckStatus(user.DepartmentId); if (user.RoleId == 1) { if (delegatedPerson != null) { btnApprove.Visible = false; btnReject.Visible = false; txtRemark.Visible = false; lblRemark.Visible = false; if(DateTime.Now.Date < delegatedPerson.StartDate.Value.Date ) { btnApprove.Visible = true; btnReject.Visible = true; txtRemark.Visible = true; lblRemark.Visible = true; } if(DateTime.Now.Date > delegatedPerson.EndDate.Value.Date) { btnApprove.Visible = true; btnReject.Visible = true; txtRemark.Visible = true; lblRemark.Visible = true; } } else if (delegatedPerson == null) { btnApprove.Visible = true; btnReject.Visible = true; txtRemark.Visible = true; lblRemark.Visible = true; } } else if (user.RoleId != 1) { if (status == true && delegatedPerson.StartDate.Value.Date >= DateTime.Now.Date) { btnApprove.Visible = true; btnReject.Visible = true; txtRemark.Visible = true; lblRemark.Visible = true; } if(status == true && delegatedPerson.EndDate.Value.Date <= DateTime.Now.Date) { btnApprove.Visible = true; btnReject.Visible = true; txtRemark.Visible = true; lblRemark.Visible = true; } } string requisitionId = Request["requisitionId"]; lblRequisitionIDValue.Text = requisitionId; string Date = Request["Date"]; lblDateValue.Text = Date; string Status = Request["Status"]; lblStatusValue.Text = Status; DataTable dt = new DataTable(); requisitionDetails = viewStationeryRequisitionController.GetRequisitionDetails(requisitionId); if (!IsPostBack) { BindGridViewList(); } if (lblStatusValue.Text.ToLower() == "pending") { lblStatusValue.CssClass = "label label-success"; } }