当前位置: 首页>>代码示例>>C#>>正文


C# Student.LoadFromDB方法代码示例

本文整理汇总了C#中Student.LoadFromDB方法的典型用法代码示例。如果您正苦于以下问题:C# Student.LoadFromDB方法的具体用法?C# Student.LoadFromDB怎么用?C# Student.LoadFromDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Student的用法示例。


在下文中一共展示了Student.LoadFromDB方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoEditStudent

        public void DoEditStudent(string studentID)
        {
            DBManager db = new MySQLDBManager(Config.DB_SERVER, Config.DB_NAME, Config.DB_USER, Config.DB_PASSWORD, Config.DB_CHAR_ENC);
            theStudent = new Student();
            if (!theStudent.LoadFromDB(db, "student_id=" + studentID)) theStudent = null;

            // List Course History
            string[,] bgclass = new string[,] { { "class=\"spec\"", "class=\"td1\"" }, { "class=\"specalt\"", "class=\"alt\"" } };

            string query = "SELECT * from course ";
            query = query + "WHERE course.course_id in (select registration.course_id from registration where registration.student_id='";
            query = query + studentID + "') order by start_date desc";
            OdbcDataReader reader = db.Query(query);
            int i = 0;
            while (reader.Read())
            {
                Course course = Course.CreateForm(reader);
                outBuf3.Append("<tr>");
                outBuf3.Append("<th scope=\"row\" abbr=\"Model\" " + bgclass[i % 2, 0] + " align=center>" + course._startdate.ToString("dd MMM yyyy", ci) + "&nbsp</th>");
                outBuf3.Append("<td " + bgclass[i % 2, 1] + " align=center>" + course._btsCourseID + "&nbsp</td>");
                outBuf3.Append("<td " + bgclass[i % 2, 1] + " align=left>" + course._courseName + "&nbsp</td>");
                outBuf3.Append("<td " + bgclass[i % 2, 1] + "  >" + course._cost + "&nbsp</td>");
                outBuf3.Append("</tr>\n");

                i++;
            }
            db.Close();
        }
开发者ID:nettatata,项目名称:btsman,代码行数:28,代码来源:StudentManage.aspx.cs

示例2: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        //        HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
        Encoding enc = Response.ContentEncoding;
        Response.Write("<br>" + enc.HeaderName + " " + enc.BodyName + " ");
        Response.Write("<br>" + Encoding.Default.HeaderName + " " + Encoding.Default.BodyName + " ");

        DBManager db = new MySQLDBManager(Config.DB_SERVER, Config.DB_NAME, Config.DB_USER, Config.DB_PASSWORD, Config.DB_CHAR_ENC);
        //db.Execute("SET NAMES 'tis620'");
        Student theStudent = new Student();
        theStudent.LoadFromDB(db, " student_id=15318");

        Response.Write("นักเรียนชื่อ  " + theStudent._firstname + "นามสกุล "+ theStudent._surname);

        EncodingInfo[] ecs = Encoding.GetEncodings();
        for (int j = 0; j < ecs.Length; j++)
        {
            Encoding ec = ecs[j].GetEncoding();
            byte[] b = ec.GetBytes(theStudent._firstname);
            Response.Write("<br>"+ec.HeaderName + " " + ec.BodyName + " ");
            for (int i = 0; i < b.Length; i++)
            {
                Response.Write(b[i] + " ");
            }
        }

        byte[] bytes = Encoding.Unicode.GetBytes(theStudent._firstname);

        string myString = Encoding.UTF8.GetString(bytes);
        Response.Write(myString);

        bytes = Encoding.GetEncoding("tis-620").GetBytes(theStudent._firstname);
        myString = Encoding.UTF8.GetString(bytes);
        Response.Write(myString);

        bytes = Encoding.GetEncoding("windows-874").GetBytes(theStudent._firstname);
        myString = Encoding.UTF8.GetString(bytes);
        Response.Write(myString);

        CultureInfo ci = CultureInfo.InstalledUICulture;

        Response.Write("Default Language Info:");
        Response.Write("* Name: "+ ci.Name);
        Response.Write("* Display Name: "+ ci.DisplayName);
        Response.Write("* English Name: "+ ci.EnglishName);
        Response.Write("* 2-letter ISO Name: "+ ci.TwoLetterISOLanguageName);
        Response.Write("* 3-letter ISO Name: "+ ci.ThreeLetterISOLanguageName);
        Response.Write("* 3-letter Win32 API Name: "+ ci.ThreeLetterWindowsLanguageName);
    }
开发者ID:nettatata,项目名称:btsman,代码行数:49,代码来源:Test.aspx.cs

示例3: DoViewStudent

        protected void DoViewStudent(string studentID)
        {
            outBuf = new StringBuilder();

            DBManager db = new MySQLDBManager(Config.DB_SERVER, Config.DB_NAME, Config.DB_USER, Config.DB_PASSWORD, Config.DB_CHAR_ENC);
            theStudent = new Student();
            theStudent.LoadFromDB(db, " student_id=" + studentID);

            // quiz
            StringBuilder quizInfo = new StringBuilder();

            if (theStudent.isQuizNoSelected(1)) { quizInfo.AppendLine("&nbsp&nbsp  - โบรชัวร์ของทางโรงเรียน" + "<br>"); }
            if (theStudent.isQuizNoSelected(2)) { quizInfo.AppendLine("&nbsp&nbsp  - พี่/น้อง/เพื่อน/ครู บอกต่อกันมา" + "<br>"); }
            if (theStudent.isQuizNoSelected(3)) { quizInfo.AppendLine("&nbsp&nbsp  - เดินผ่านมาเจอ" + "<br>"); }
            if (theStudent.isQuizNoSelected(4)) { quizInfo.AppendLine("&nbsp&nbsp  - เว็บไซต์โรงเรียน (www.bts.ac.th)" + "<br>"); }
            if (theStudent.isQuizNoSelected(5)) { quizInfo.AppendLine("&nbsp&nbsp  - โครงการติวต่าง ๆ (" + theStudent.getQuizNoText(5) + ")<br>"); }
            if (theStudent.isQuizNoSelected(6)) { quizInfo.AppendLine("&nbsp&nbsp  - อื่น (" + theStudent.getQuizNoText(6) + ")<br>"); }

            // Query registration history
            Registration[] reghis = Registration.LoadListFromDBCustom(db, "SELECT rg.*,c.bts_course_id as bts_course_id, c.course_name as course_name FROM registration rg, course c WHERE "
                        + " student_id=" + theStudent._studentID + " AND rg.course_id=c.course_id ORDER BY rg.regis_id ");
            db.Close();

            StringBuilder regHisTxt = new StringBuilder();
            if (reghis.Length > 0)
            {
                for (int i = 0; i < reghis.Length; i++)
                {
                    string statusTxt = Registration.GetStatusText(reghis[i]._status);
                    if (reghis[i]._status == Registration.STATUS_CANCELLED)
                    {
                        statusTxt = "<font color=red>" + statusTxt + "</font>";
                    }

                    regHisTxt.AppendLine("<tr>");
                    regHisTxt.AppendLine("<td>&nbsp" + reghis[i]._regisdate.ToString("dd/MM/yyyy HH:mm", ci) + "</td>");
                    regHisTxt.AppendLine("<td>&nbsp" + "<a href=\"CourseManage.aspx?actPage=view&targetID=" + reghis[i]._courseID + "\" >" + reghis[i]._btsCourseID + " " + reghis[i]._courseName + "</a>" + "</td>");
                    regHisTxt.AppendLine("<td align=center>" + StringUtil.Int2StrComma(reghis[i]._fullCost) + "</td>");
                    regHisTxt.AppendLine("<td align=center>" + StringUtil.Int2StrComma(reghis[i]._discountedCost) + "</td>");
                    regHisTxt.AppendLine("<td align=center>" + statusTxt + "</td>");
                    regHisTxt.AppendLine("<td align=center>" + reghis[i]._note + "</td>");
                    regHisTxt.AppendLine("</tr>");
                }
            }
            else
            {
                regHisTxt.AppendLine("<tr><td colspan=3 align=center>ไม่พบข้อมูลการลงทะเบียน</td></tr>");
            }

            TextReader reader = new StreamReader(Config.PATH_APP_ROOT + "\\template\\student_view.htm");
            String templateContent = reader.ReadToEnd();
            reader.Close();

            String htmlContent =
                String.Format(templateContent
                    , Config.URL_PIC_STUDENT + "/" + theStudent._img
                    , Student.GetStudentID(theStudent._studentID)
                    , theStudent._firstname + " " + theStudent._surname + " (" + theStudent._nickname + ")"
                    , Config.URL_PIC_SYS + (theStudent._sex.Equals("Male") ? "/boy.gif" : "/girl.gif")
                    , theStudent._citizenID
                    , StringUtil.ConvertEducateLevel(theStudent._level)
                    , theStudent._school
                    , theStudent._birthday.ToString("dd/MM/yyyy", ci)
                    , theStudent._addr
                    , theStudent.GetTel()
                    , theStudent._email
                    , theStudent._create_date.ToString("dd/MM/yyyy", ci)
                    , quizInfo.ToString()
                    , regHisTxt.ToString());

            outBuf.Append(htmlContent);
        }
开发者ID:nettatata,项目名称:btsman,代码行数:72,代码来源:StudentManage.aspx.cs

示例4: LoadListFromDB

        /*
        public static RegisTransaction[] LoadListFromDB(DBManager db, string sqlCriteria)
        {
            return LoadListFromDBCustom(db,"SELECT * FROM registration " + sqlCriteria);
        }

        public static RegisTransaction[] LoadListFromDBCustom(DBManager db, string sqlAll)
        {
            OdbcDataReader reader = db.Query(sqlAll);
            LinkedList<RegisTransaction> list = new LinkedList<RegisTransaction>();
            while (reader.Read())
            {
                list.AddLast(RegisTransaction.CreateForm(reader));
            }

            RegisTransaction[] entities = new RegisTransaction[list.Count];
            int i = 0;
            foreach (RegisTransaction t in list)
            {
                entities[i++] = t;
            }
            return entities;
        }
        */
        public bool LoadStudent(DBManager db)
        {
            if (_studentID <= 0) return false;

            _student = new Student();
            return _student.LoadFromDB(db, " student_id=" + _studentID);
        }
开发者ID:nettatata,项目名称:btsman,代码行数:31,代码来源:RegisTransaction.cs

示例5: ProcessWizQueryStudentDetail

        protected void ProcessWizQueryStudentDetail(string studentID)
        {
            DBManager db = new MySQLDBManager(Config.DB_SERVER, Config.DB_NAME, Config.DB_USER, Config.DB_PASSWORD, Config.DB_CHAR_ENC);
            Student s = new Student();
            s.LoadFromDB(db, " student_id=" + studentID);
            db.Close();

            TextReader reader = new StreamReader(Config.PATH_APP_ROOT + "\\template\\" + AjaxSvc.WIZ_Q_STUDENT_DETAIL + ".htm");
            String templateContent = reader.ReadToEnd();
            reader.Close();

            String htmlContent =
                String.Format(templateContent
                    , Config.URL_PIC_STUDENT + "/" + s._img
                    , Student.GetStudentID(s._studentID)
                    , s._firstname + " " + s._surname + " (" + s._nickname + ")"
                    , s._citizenID
                    , Config.URL_PIC_SYS + (s._sex.Equals("Male") ? "/boy.gif" : "/girl.gif")
                    , s._school
                    , s._birthday.ToString("dd/MM/yyyy", ci)
                    , s._addr
                    , s.GetTel()
                    , s._email
                    );

            outBuf.Append(htmlContent);
        }
开发者ID:nettatata,项目名称:btsman,代码行数:27,代码来源:AjaxService.aspx.cs

示例6: ProcessWizAddSelectedStudent

        protected void ProcessWizAddSelectedStudent(string student_id)
        {
            // get data from session
            RegisTransaction reg = (RegisTransaction)Session[SessionVar.CURRENT_REGIS];
            if (reg == null) { reg = new RegisTransaction(); }

            DBManager db = new MySQLDBManager(Config.DB_SERVER, Config.DB_NAME, Config.DB_USER, Config.DB_PASSWORD, Config.DB_CHAR_ENC);
            Student student = new Student();
            student.LoadFromDB(db, " student_id=" + student_id);
            db.Close();

            if (student != null)
            {
                reg._student = student;
                reg._studentID = student._studentID;
            }

            // save back to session
            Session[SessionVar.CURRENT_REGIS] = reg;
        }
开发者ID:nettatata,项目名称:btsman,代码行数:20,代码来源:AjaxService.aspx.cs


注:本文中的Student.LoadFromDB方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。