Exemplo n.º 1
0
        public List <SelectListItem> GetdeptSelectItems(int week)
        {
            Business.Sys_UserAdmin Sys_UserAdmin = new Business.Sys_UserAdmin();
            List <Model.UserAdmin> UserAdminList = new List <Model.UserAdmin>();

            if (Utility.ChangeText.GetUserName() == "admin")
            {
                UserAdminList = Sys_UserAdmin.GetAdminInfoListbyweek("Customer", week);
            }
            else if (Session["RoleCode"].ToString() == "Customer")
            {
                UserAdminList = Sys_UserAdmin.GetUserAdminUsByRoleCode("Customer", Utility.ChangeText.GetUsersId());
            }
            else
            {
                UserAdminList = Sys_UserAdmin.GetUserAdminListByWorkUsersId("Customer", Utility.ChangeText.GetUsersId(), week);
            }

            List <SelectListItem> deptSelectItems = new List <SelectListItem>();
            SelectListItem        item            = new SelectListItem();

            foreach (Model.UserAdmin d in UserAdminList)
            {
                item = new SelectListItem();

                item.Text     = d.RealName;
                item.Text     = string.IsNullOrEmpty(d.OwnedCompany) == true ? item.Text : item.Text + "(" + d.OwnedCompany + ")";
                item.Value    = d.ID.ToString();
                item.Selected = false;
                deptSelectItems.Add(item);
            }
            if (deptSelectItems.Count > 0)
            {
                deptSelectItems[0].Selected = true;
            }
            return(deptSelectItems);
        }