Esempio n. 1
0
        public ActionResult Profile()
        {
            if (ses.isLogin() != 0)
            {
                ses.gotoPage("/admin/login", "Chưa đăng nhập");
                return(null);
            }
            STUDENT_BUS bus = new STUDENT_BUS();
            STUDENT_OBJ obj = bus.GetByID(new STUDENT_OBJ.BusinessObjectID(ses.loginCode));

            bus.CloseConnection();
            if (obj == null)
            {
                ses.gotoPage("/admin/login", "Chưa đăng nhập");
                return(null);
            }
            DataSet ds  = new DataSet();
            int     ret = bus.GetAllCourse(ref ds, "COURSESTUDIED", obj);

            bus.CloseConnection();
            List <dynamic> liMark = new List <dynamic>();

            if (ret >= 0)
            {
                foreach (DataRow r in ds.Tables["COURSESTUDIED"].Rows)
                {
                    dynamic objtemp = new ExpandoObject();
                    objtemp.MARKCODE       = com.string4Row(r, "code", "");
                    objtemp.SUBJECTCODE    = com.string4Row(r, "subjectcode", "");
                    objtemp.NAME           = com.string4Row(r, "name", "");
                    objtemp.COUNT          = com.int4Row(r, "sobai", 0);
                    objtemp.COUNTLEARNT    = com.int4Row(r, "sobaidahoc", 0);
                    objtemp.COUNTLEARNTYET = com.int4Row(r, "sobaichuahoc", 0);
                    objtemp.COURSECODE     = com.string4Row(r, "coursecode", "");

                    liMark.Add(objtemp);
                }
            }

            ret = bus.GetAllMark(ref ds, "MARKED", obj);
            bus.CloseConnection();
            List <dynamic> liMark2 = new List <dynamic>();

            if (ret >= 0)
            {
                foreach (DataRow r in ds.Tables["MARKED"].Rows)
                {
                    dynamic objtemp = new ExpandoObject();
                    objtemp.EXAMTIMECODE = com.string4Row(r, "examtimecode", "");
                    objtemp.NAME         = com.string4Row(r, "name", "");
                    objtemp.MARKMAX      = com.int4Row(r, "sodiem", 0);
                    objtemp.MARK10       = com.int4Row(r, "mark10", 0);
                    objtemp.MARKCODE     = com.string4Row(r, "code", "");
                    liMark2.Add(objtemp);
                }
            }
            //MARK_BUS busMark = new MARK_BUS();
            //List<MARK_OBJ> liMark = busMark.getAllBy2("subjectcode", new fieldpara("STUDENTCODE", ses.loginCode));

            //busMark.CloseConnection();
            //if (liMark == null)
            //{

            //    ses.gotoPage("/admin/login", "Chưa đăng nhập");
            //    return null;
            //}

            dynamic defaultobject = new ExpandoObject();

            defaultobject.thetype   = ses.loginType;
            defaultobject.name      = ses.loginFullName;
            defaultobject.code      = ses.loginCode;
            defaultobject.birthday  = com.date2String(obj.BIRTHDAY);
            defaultobject.address   = obj.ADDRESS;
            defaultobject.email     = obj.EMAIL;
            defaultobject.tel       = obj.TEL;
            defaultobject.limark    = liMark;
            defaultobject.codeview  = obj.CODEVIEW;
            defaultobject.khoa      = obj.LOCK;
            defaultobject.note      = obj.NOTE;
            defaultobject.sex       = obj.SEX;
            defaultobject.classcode = obj.CLASSCODE;
            defaultobject.limark2   = liMark2;
            //defaultobject.defaulttab = "subject";

            ViewBag.defaultvalue = JsonConvert.SerializeObject(defaultobject);

            string[] jsx =
            {
                "/jsx/Core/Student/StudentPriorityAdd.jsx"
                , "/jsx/Core/Student/Studentpopup.jsx"
                , "/jsx/Admin/Changepass/Changepass.jsx"
                , "/jsx/Core/Student/Studentprofile.jsx"
            };

            //string[] jsx = {
            //    "/Jsx/_Shared/ButtonList.jsx"
            //    ,"/Jsx/_Shared/PopupSearch.jsx"
            //    ,"/Scripts/Ag-grid/ag-grid.js"
            //    ,"/Jsx/_Shared/AgGrid.jsx"
            //    ,"/Jsx/_Shared/TabHeader.jsx"//Phụ trách hiển thị các tab
            //    ,"/jsx/Profile/List1.jsx"
            //    ,"/jsx/subject/subject/Subjectpopup.jsx"
            //    ,"/jsx/subject/course/CourseList.jsx"
            //    ,"/jsx/subject/course/Coursepopup.jsx"
            //    ,"/jsx/Profile/ProfileApp.jsx"//Tạo khai báo tab
            //};

            ViewBag.jsx = jsx;
            return(View("Adminindex"));
        }