Ejemplo n.º 1
0
    // Delegate
    public static List <WCFStaffModel> GetStaffNameByDepartmentId(string depId, string staffId)
    {
        ManageAuthorityDelegationController manageAuthorityDelegationController = new ManageAuthorityDelegationController();
        List <Staff>         staffList    = manageAuthorityDelegationController.GetStaffNameByDepartmentId(depId, staffId);
        List <WCFStaffModel> wcfStaffList = new List <WCFStaffModel>();

        foreach (Staff s in staffList)
        {
            WCFStaffModel w = new WCFStaffModel();
            w.StaffId          = s.StaffId;
            w.Password         = s.Password;
            w.StaffName        = s.StaffName;
            w.RoleId           = s.RoleId;
            w.RoleName         = s.Role.RoleName;
            w.DepartmentId     = s.DepartmentId;
            w.DepartmentName   = s.Department.DepartmentName;
            w.Email            = s.Email;
            w.PhoneNumber      = s.PhoneNumber;
            w.Address          = s.Address;
            w.EmailPassword    = s.EmailPassword;
            w.DepartmentHeadId = s.Department.DepartmentHead_ID;
            wcfStaffList.Add(w);
        }
        return(wcfStaffList);
    }
Ejemplo n.º 2
0
        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();
                }
            }
        }