Esempio n. 1
0
        private List <T> GetDataSource <T>()
        {
            string scope     = CheckBoxBoard.Checked ? "Board" : "School";
            var    parameter = new
            {
                Operate     = "SecurityStaffList",
                UserID      = WorkingProfile.UserId,
                UserRole    = hfUserRole.Value,
                SchoolCode  = ddlSchool.SelectedValue,
                SearchBy    = hfSearchby.Value,
                SearchValue = hfSearchValue.Value,
                Scope       = scope
            };

            List <T> myList;

            if (WebConfig.DataSource() == "API")
            {
                string uri  = "staff/list";
                string qStr = "/" + parameter.SchoolCode + "/" + parameter.SearchBy + "/" + parameter.SearchValue + "/" + parameter.Scope;
                myList = ManagePageList <T, StaffList> .GetList("API", uri, qStr, btnSearchGoFirstName);
            }
            else
            {
                myList = ManagePageList <T, StaffList> .GetList("SQL", "ClassCall", parameter, btnSearchGoFirstName);
            }
            // var myList = ListData.GeneralList<StaffList>("SecurityManage", pageID, parameter, btnSearchGoCPNum);
            return(myList);
        }
Esempio n. 2
0
        public void GetList_StaffListbySurName_ReturnStaffListStartwithP()
        {
            // Arrange
            var para = new
            {
                Operate     = "SecurityStaffList",
                UserID      = "tester",
                UserRole    = "admin",
                SchoolCode  = "0000",
                SearchBy    = "SurName",
                SearchValue = "Pas",
                Scope       = "Board" // ddlType.SelectedValue
            };

            string expect = "Pas";

            //Act
            var list = ManagePageList <StaffList, StaffList> .GetList(_dataSource, _callMethod, para);

            var result = from s in list
                         where s.LastName.Substring(0, 3) == para.SearchValue
                         select s.LastName;


            //Assert
            Assert.AreEqual(expect, result.FirstOrDefault().Substring(0, 3), $" Geoup Member Student type  . ");
        }
Esempio n. 3
0
        public void GetList_GetStaffAppGroupInfo_ReturnStaffAppGroupInof()
        {
            // Arrange
            var para = new
            {
                Operate    = "APP",
                UserID     = "Tester",
                UserRole   = "Test",
                SchoolCode = "0354",
                SchoolYear = "20202021",
                CPNum      = "00050347"
            };

            string expect = "Grade 05 Students";

            //Act

            var list = ManagePageList <GroupList, StaffMemberOf> .GetList(_dataSource, _callMethod, para);

            var result = from s in list
                         where s.MemberID == "05"
                         select s.GroupName;

            //Assert
            Assert.AreEqual(expect, result.FirstOrDefault(), $" Geoup Member Student type  . ");
        }
        private List <T> GetDataSource <T>()
        {
            string scope     = CheckBoxBoard.Checked ? "Board" : "School";
            var    parameter = new
            {
                Operate     = "List",
                UserID      = WorkingProfile.UserId,
                UserRole    = hfUserRole.Value,
                SchoolYear  = WorkingProfile.SchoolYear,
                SchoolCode  = WorkingProfile.SchoolCode,
                GrantAction = ddlGrantAction.SelectedValue,
                Scope       = scope
            };

            List <T> myList;

            if (WebConfig.DataSource() == "API")
            {
                string uri  = "RequestPermission/list";
                string qStr = "/" + parameter.SchoolYear + "/" + parameter.SchoolCode + "/" + parameter.GrantAction + "/" + parameter.Scope;
                myList = ManagePageList <T, StaffList> .GetList("API", uri, qStr, btnSearchGo);
            }
            else
            {
                myList = ManagePageList <T, RequestPermission> .GetList("SQL", "ClassCall", parameter, btnSearchGo);
            }
            return(myList);
        }
Esempio n. 5
0
        private List <T> GetDataSource <T>(string grade)
        {
            var para = new
            {
                Operate     = "SchoolList",
                UserID      = WorkingProfile.UserId,
                UserRole    = hfUserRole.Value,
                SchoolYear  = WorkingProfile.SchoolYear,
                SchoolCode  = grade,
                StaffUserID = TextBoxUserID.Text
            };

            List <T> myList;

            if (WebConfig.DataSource() == "API")
            {
                string uri  = "staff/" + grade; // SAP";
                string qStr = "/" + para.SchoolCode + "/" + para.SchoolYear + "/" + para.StaffUserID;
                myList = ManagePageList <T, UserGroup> .GetList("API", uri, qStr);
            }
            else
            {
                // var myList = ListData.GeneralList<T>("SecurityManage", pageID, parameter);
                myList = ManagePageList <T, StaffWorkingSchools> .GetList("SQL", "ClassCall", para);
            }
            return(myList);
        }
Esempio n. 6
0
        private List <T> GetDataSource <T>()
        {
            var parameter = new
            {
                Operate    = "GroupList", // "SecurityGroupList",
                UserID     = WorkingProfile.UserId,
                UserRole   = hfUserRole.Value,
                SchoolCode = ddlSchool.SelectedValue,
                AppID      = ddlApps.SelectedValue
            };
            List <T> myList;

            if (WebConfig.DataSource() == "API")
            {
                string uri  = "common/grouplist";
                string qStr = "/" + parameter.SchoolCode + "/" + parameter.AppID;
                myList = ManagePageList <T, UserGroup> .GetList("API", uri, qStr, btnSearchGo);
            }
            else
            {
                // var gList =   ListData.GeneralList<GroupList>("SecurityManage", pageID, parameter, btnSearchGo);
                // var spClass = new ActionGet<UserGroup>(new ActionAppUserGroup())
                myList = ManagePageList <T, UserGroup> .GetList("SQL", "ClassCall", parameter, btnSearchGo);
            }
            return(myList);
        }
Esempio n. 7
0
        private List <T> GetDataSource <T>(string grade, WebControl imgButton)
        {
            var para = new
            {
                Operate    = grade,
                UserID     = WorkingProfile.UserId,
                UserRole   = hfUserRole.Value,
                SchoolCode = TextBoxUnit.Text,
                SchoolYear = WorkingProfile.SchoolYear,
                CPNum      = TextBoxCPNum.Text
            };

            List <T> myList;

            if (WebConfig.DataSource() == "API")
            {
                string uri  = "staff/" + grade; // SAP";
                string qStr = "/" + para.SchoolCode + "/" + para.SchoolYear + "/" + para.CPNum;
                myList = ManagePageList <T, UserGroup> .GetList("API", uri, qStr);
            }
            else
            {
                // var myList = ListData.GeneralList<T>("SecurityManage", pageID, parameter);
                myList = ManagePageList <T, StaffMemberOf> .GetList("SQL", "ClassCall", para, imgButton);
            }
            return(myList);
        }
Esempio n. 8
0
        public void GetList_GetStaffDefaultSAPProfile_ReturnStaffSAPProfile()
        {
            // Arrange
            var para = new
            {
                Operate    = "SAP",
                UserID     = "Tester",
                UserRole   = "Test",
                SchoolCode = "0354",
                SchoolYear = "20212022",
                CPNum      = "00051449"
            };

            string expect = "rodrigs03";

            //Act

            var list = ManagePageList <StaffList, StaffMemberOf> .GetList(_dataSource, _callMethod, para);

            var result = from s in list
                         where s.EmployeeID == para.CPNum
                         select s.UserID;
            //Assert

            //    string checkResult  = list.FirstOrDefault(a => a.CPNum == para.CPNum)?.UserID;

            var checkResult = result.FirstOrDefault();

            Assert.AreEqual(expect, checkResult, $" Geoup Member Student type  . ");
        }
Esempio n. 9
0
        public void GetList_GetStaffSISInformation_ReturnStaffSISClassInfo()
        {
            // Arrange
            var para = new
            {
                Operate    = "SIS",
                UserID     = "Tester",
                UserRole   = "Test",
                SchoolCode = "0354",
                SchoolYear = "20212022",
                CPNum      = "00051449"
            };

            string expect = "04-05/1";

            //Act

            var list = ManagePageList <ClassesList, StaffMemberOf> .GetList(_dataSource, _callMethod, para);

            var result = from s in list
                         where s.ClassCode == "04-05/1"
                         select s.ClassName;

            //Assert
            Assert.AreEqual(expect, result.FirstOrDefault(), $" Geoup Member Student type  . ");
        }
Esempio n. 10
0
        public void GetList_GetUserGroupMemberStudentbyPara_returnMemberofStudent()
        {
            //Arrange
            int expect = 3;
            var para   = new { Operate = "GroupListStudent", UserID = "tester", UserRole = "Admin", SchoolCode = "0000", AppID = "SIC", GroupID = "Primary Student Work group" };
            //Act
            var list = ManagePageList <GroupList, UserGroupMemberStudent> .GetList(_dataSource, _callMethod, para);

            var result = list.Count;

            //Assert
            Assert.AreEqual(expect, result, $" Geoup Member Student type  . ");
        }
Esempio n. 11
0
        public void GetList_GetUserGroupMemberTeacherbyIDPassMapClass_returnMemberofTeacher()
        {
            //Arrange
            int expect = 3;
            var para   = new { Operate = "GroupListTeacher", UserID = "tester", UserRole = "Admin", SchoolCode = "0354", AppID = "SIC", GroupID = "Primary Student Work group" };
            //Act
            //  var actionClass = new ActionApp<UserGroupMemberTeacher>(new ActionAppUserGroupMemberT());
            var list = ManagePageList <GroupList, UserGroupMemberTeacher> .GetList(_dataSource, _callMethod, para);

            var result = list.Count;

            //Assert
            Assert.AreEqual(expect, result, $" User work Group   . ");
        }
Esempio n. 12
0
        private List <T> GetDataSource <T, T2>(string listType)
        {
            var parameter = new
            {
                Operate    = listType, // "GroupListStudent",//"SecurityGroupListStudents",
                UserID     = WorkingProfile.UserId,
                UserRole   = hfUserRole.Value,
                SchoolCode = hfSchoolCode.Value,
                AppID      = hfAppID.Value,
                GroupID    = TextBoxGroupID.Text
            };

            return(ManagePageList <T, T2> .GetList("SQL", "ClassCall", parameter, ImageUGP));
        }
Esempio n. 13
0
        public void GetList_GetUserGroupListbyNewAppID_returnZeroRecord()
        {
            //Arrange
            int expect = 0;
            var para   = new { Operate = "GroupList", UserID = "tester", UserRole = "Admin", SchoolCode = "0000", AppID = "ZZZ" };
            //Act
            var list = ManagePageList <GroupList, UserGroup> .GetList(_dataSource, _callMethod, para);


            var result = list.Count;

            //Assert
            Assert.AreEqual(expect, result, $" User work Group   . ");
        }
Esempio n. 14
0
        private List <T> GetDataSource <T>()
        {
            var parameter = new
            {
                Operate  = "GetList",
                UserID   = WorkingProfile.UserId,
                IDs      = "0",
                UserRole = hfUserRole.Value
            };

            //   var myList = ListData.GeneralList<T>("SecurityManage", pageID, parameter);
            var myList = ManagePageList <T, Apps> .GetList("SQL", "ClassCall", parameter);

            return(myList);
        }
Esempio n. 15
0
        public void GetList_GetUserGroupListAppIDandSchoolCode_returnAllGroupList()
        {
            //Arrange
            var expect = "All School Students Group";
            var para   = new { Operate = "GroupList", UserID = "tester", UserRole = "Admin", SchoolCode = "0000", AppID = "SIC" };
            //Act
            var list = ManagePageList <GroupList, UserGroup> .GetList(_dataSource, _callMethod, para);


            var result = from s in list
                         where s.GroupID == "All Students Work Group"
                         select s.GroupName;

            //Assert
            Assert.AreEqual(expect, result.FirstOrDefault(), $" User work Group   . ");
        }
Esempio n. 16
0
        private List <T> GetDataSource <T>()
        {
            var parameter = new
            {
                Operate   = "Get", //"RoleInformation",
                UserID    = WorkingProfile.UserId,
                UserRole  = hfUserRole.Value,
                RoleID    = hfMatchRole.Value,
                RoleType  = LabelMatchType.Text,
                MatchDesc = LabelMatchDesc.Text
            };

            //  var myList = ListData.GeneralList<AppRoleMatchList>("SecurityManage", pageID, parameter);
            var myList = ManagePageList <T, AppRoleMatch> .GetList("SQL", "ClassCall", parameter);

            return(myList);
        }
Esempio n. 17
0
        private List <T> GetDataSource <T>()
        {
            var parameter = new
            {
                Operate  = "GetList",
                UserID   = WorkingProfile.UserId,
                UserRole = hfUserRole.Value,
                //  AppID = ddlApps.SelectedValue,
                RoleID   = "", // GroupID match Role Type
                RoleType = ddlRoleType.SelectedValue,
            };

            //   var myList = ListData.GeneralList<T>("SecurityManage", pageID, parameter);
            var myList = ManagePageList <T, AppRolePermission> .GetList("SQL", "ClassCall", parameter);

            return(myList);
        }
Esempio n. 18
0
        private List <T> GetDataSource <T, T2>(string operate)
        {
            var parameter = new
            {
                Operate  = operate,
                UserID   = hfUserID.Value,
                UserRole = hfUserRole.Value,
                RoleID   = LabelPositionRole.Text,
                RoleType = hfSelectedTab.Value
            };


            //  var myList = ListData.GeneralList<AppRoleMatchList>("SecurityManage", pageID, parameter);
            var myList = ManagePageList <T, T2> .GetList("SQL", "ClassCall", parameter, ImgSAP);

            return(myList);
        }
Esempio n. 19
0
        private List <T> GetDataSource <T>()
        {
            var parameter = new
            {
                Operate    = "ClassStudents",
                UserID     = WorkingProfile.UserId,
                UserRole   = Page.Request.QueryString["UserRole"].ToString(),
                SchoolYear = Page.Request.QueryString["SchoolYear"].ToString(),
                SchoolCode = Page.Request.QueryString["SchoolCode"].ToString(),
                AppID      = Page.Request.QueryString["AppID"].ToString(),
                GroupID    = Page.Request.QueryString["ObjID"].ToString(),
            };

            // var myList = ListData.SearchGeneralList<StudentList>(pageID, parameter);
            var myList = ManagePageList <T, ClassStudentList> .GetList("SQL", "ClassCall", parameter);

            return(myList);
        }
Esempio n. 20
0
        public void GetList_GetStaffAppInfoStaffAPPAPI_ReturnUserGroupList()
        {
            // Arrange
            string uri  = "staff/App";
            var    para = new { SchoolCode = "0354", SchoolYear = "20202021", CPNum = "00050347" };
            string qStr = "/" + para.SchoolCode + "/" + para.SchoolYear + "/" + para.CPNum;

            string expect = "Grade 05 Students";

            //Act
            var list = ManagePageList <GroupList, StaffMemberOf> .GetList("API", uri, qStr);

            var result = from s in list
                         where s.MemberID == "05"
                         select s.GroupName;

            //Assert
            StringAssert.Contains(result.FirstOrDefault(), expect, $" staff Member contain {result} ");
        }
Esempio n. 21
0
        public void GetList_GetStaffSISInfoStaffSISAPI_ReturnUserGroupList()
        {
            // Arrange
            string uri  = "staff/SIS";
            var    para = new { SchoolCode = "0354", SchoolYear = "20212022", CPNum = "00051449" };
            string qStr = "/" + para.SchoolCode + "/" + para.SchoolYear + "/" + para.CPNum;

            string expect = "W04-05/1";

            //Act

            var list = ManagePageList <ClassesList, StaffMemberOf> .GetList("API", uri, qStr);

            var result = from s in list
                         where s.ClassCode == expect
                         select s.ClassCode;

            //Assert
            StringAssert.Contains(result.FirstOrDefault(), expect, $" staff Member contain {result} ");
        }
Esempio n. 22
0
        public void GetList_GetStaffListfromStaffListAPI_ReturnUserGroupList()
        {
            // Arrange
            string uri       = "staff/list";
            var    parameter = new { SchoolCode = "0354", SearchBy = "SurName", SearchValue = "Pa", Scope = "Board" };
            string qStr      = "/" + parameter.SchoolCode + "/" + parameter.SearchBy + "/" + parameter.SearchValue + "/" + parameter.Scope;

            string expect = "Pa";

            //Act

            var list = ManagePageList <StaffList, StaffList> .GetList("API", uri, qStr);

            var result = from s in list
                         where s.LastName.Substring(0, 2) == expect
                         select s.LastName;

            //Assert
            StringAssert.Contains(result.FirstOrDefault(), expect, $" staff Member contain {result} ");
        }
Esempio n. 23
0
        public void GetList_GetUserGroupListfromCommonGroupListAPI_ReturnUserGroupList()
        {
            // Arrange
            string uri = "common/grouplist";
            // string uri = "usergroup/list";
            string qStr = "/0354/SIC";

            string expect = "Grade 05 Work Group";
            //  var expect = "Grade 05 Work Group";

            //Act

            var list = ManagePageList <GroupList, UserGroup> .GetList("API", uri, qStr);

            var result = from s in list
                         where s.GroupID == "Grade 05 Work Group"
                         select s.GroupID;

            //Assert
            Assert.AreEqual(expect, result.FirstOrDefault(), $" Geoup Member Student type  . ");
        }
Esempio n. 24
0
        private void SetPageAttribution()
        {
            hfCategory.Value      = "Home";
            hfPageID.Value        = pageID;
            hfUserID.Value        = WorkingProfile.UserId;
            hfUserLoginRole.Value = WorkingProfile.UserRoleLogin;
            hfUserRole.Value      = WorkingProfile.UserRole;
            hfRunningModel.Value  = WebConfig.RunningModel();

            var para = new
            {
                Operate    = "SchoolYearDate",
                UserID     = WorkingProfile.UserId,
                SchoolCode = WorkingProfile.SchoolCode,
                SchoolYear = WorkingProfile.SchoolYear,
            };
            var myDate = ManagePageList <SchoolDateStr, SchoolDateStr> .GetList(DataSource, "ClassCall", para);

            hfSchoolyearStartDate.Value = myDate[0].StartDate.ToString();
            hfSchoolyearEndDate.Value   = myDate[0].EndDate.ToString();
            dateStart.Value             = myDate[0].TodayDate.ToString();
            dateEnd.Value = myDate[0].EndDate.ToString();
        }
Esempio n. 25
0
        private static List <AppWorkingProfile> GetWorkingProfile(object parameter)
        {
            try
            {
                List <AppWorkingProfile> myList;

                if (WebConfig.DataSource() == "API")
                {
                    string uri  = "WorkingProfile/list";
                    string qStr = ""; // "/" + UserID + "/" + AppID + "/" + ModelID;
                    myList = ManagePageList <AppWorkingProfile, AppWorkingProfile> .GetList("API", uri, qStr);
                }
                else
                {
                    myList = ManagePageList <AppWorkingProfile, AppWorkingProfile> .GetList("SQL", "ClassCall", parameter);
                }
                return(myList);
            }
            catch (System.Exception ex)
            {
                var em = ex.Message;
                return(null);
            }
        }
Esempio n. 26
0
        private List <T> GetDataSource <T>()
        {
            var parameter = new
            {
                Operate  = "GetListbyRoleID", //"RoleInformation",
                UserID   = WorkingProfile.UserId,
                IDs      = "0",
                UserRole = hfUserRole.Value,
                RoleType = hfRoleType.Value,
                RoleID   = TextBoxRoleID.Text,
                AppID    = hfAppID.Value
            };

            //  foreach (var prop in parameter.GetType().GetProperties(System.Reflection.BindingFlags.Instance))
            //foreach ( KeyValuePair<string,object> kvp in parameter)
            //{

            //}

            // var myList = ListData.GeneralList<AppRoleList>("SecurityManage", pageID, parameter);
            var myList = ManagePageList <T, AppRole> .GetList("SQL", "ClassCall", parameter);

            return(myList);
        }