|  |  | 
          
            | Code (C#) 
 using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SPCU;
using SPCU.Database;
using SPCU.BaseClass;
using SPCU.SPGlobal.Database;
using eServiceBS.MTBS;
using System.Data.OracleClient;
public partial class PF_PFSR0011 : BaseClass.BaseForm, SPUI.ISPISWebForm
{
    #region Property
    string thisfromname = "รายชื่อนักศึกษาเข้าห้องเรียน";
    ASP.usercontrol_uscdialog_ascx dialog = new ASP.usercontrol_uscdialog_ascx();
    #endregion
    #region Page Event
    protected void Page_Load(object sender, EventArgs e)
    {
        this.dialog = (ASP.usercontrol_uscdialog_ascx)Master.FindControl("dialog");
        this.AddScript();
        this.SetTableStyle();
        if (!IsPostBack)
        {
            this.FirstLoad();
        }
    }
    #endregion
    #region ISPISWebForm Members
    public void AddScript()
    {
    }
    public bool Delete()
    {
        throw new Exception("The method or operation is not implemented.");
    }
    public void FirstLoad()
    {
        this.PrepareData();
    }
    public void GetInfo()
    {
        throw new Exception("The method or operation is not implemented.");
    }
    public void NewForm()
    {
        throw new Exception("The method or operation is not implemented.");
    }
    private void GetComboCourseCode()
    {
        try
        {
            //หาภาคการศึกษาปัจจุบัน
            PERIOD_ENROLL objPeriod = new PERIOD_ENROLL(this.UserID, this.OUMCode);
            string Period = objPeriod.getCurPeriod();
            //หารหัสอาจารย์
            SYSUSER objSys = new SYSUSER(this.UserID, this.OUMCode);
            string professorId = objSys.getProfId(this.UserID);
            CLASS_MASTER bsClassMaster = new CLASS_MASTER(this.UserID, this.OUMCode);
            DataTable dtClassMaster = new DataTable();
            dtClassMaster = bsClassMaster.GetProCourseNameTocombo(professorId, Period);
            if (this.UserLang == "TH")
            {
                this.cmbCourseCode.DataSource = dtClassMaster;
                this.cmbCourseCode.DataValueField = dtClassMaster.Columns[dbClassMaster.CLASS_ID].ToString();
                this.cmbCourseCode.DataTextField = dtClassMaster.Columns["courseNameThai"].ToString();
                this.cmbCourseCode.DataBind();
            }
            else
            {
                this.cmbCourseCode.DataSource = dtClassMaster;
                this.cmbCourseCode.DataValueField = dtClassMaster.Columns[dbClassMaster.CLASS_ID].ToString();
                this.cmbCourseCode.DataTextField = dtClassMaster.Columns["courseNameEng"].ToString();
                this.cmbCourseCode.DataBind();
            }
        }
        catch (Exception ex)
        {
            LogFile.writeLogFile(DateTime.Now, this.Request.Url.AbsoluteUri, ex.ToString());
        }
    }
    public void PrepareData()
    {
        this.GetComboCourseCode();
        this.Search();
    }
    public bool Save()
    {
        throw new Exception("The method or operation is not implemented.");
    }
    public void Search()
    {
        try
        {
            //หาภาคการศึกษาปัจจุบัน
            PERIOD_ENROLL objPeriod = new PERIOD_ENROLL(this.UserID, this.OUMCode);
            string Period = objPeriod.getCurPeriod();
            //เอาตำแหน่งภาคการศึกษาและปีการศึกษา
            this.lblTrem.Text = Period.Substring(3, 1);
            this.lblYear.Text = "25" + Period.Substring(5, 2);
            //หารหัสอาจารย์
            SYSUSER objSys = new SYSUSER(this.UserID, this.OUMCode);
            string professorId = objSys.getProfId(this.UserID);
        }
        catch (Exception ex)
        {
            LogFile.writeLogFile(DateTime.Now, this.Request.Url.AbsoluteUri, ex.ToString());
        }
    }
    public void SetTableStyle()
    {
    }
    public bool ValidateData()
    {
        throw new Exception("The method or operation is not implemented.");
    }
    #endregion
    #region Control Event
    #region ToolBar
    private void toolbar_New_Click(object sender, EventArgs e)
    {
        throw new Exception("The method or operation is not implemented.");
    }
    #endregion
    #region Button
    #endregion
    #region
    #endregion
    #endregion
    #region Private Function
    #endregion
    protected void btnshowData_Click(object sender, EventArgs e)
    {
        //หาภาคการศึกษาปัจจุบัน
        PERIOD_ENROLL objPeriod = new PERIOD_ENROLL(this.UserID, this.OUMCode);
        string semester = this.lblTrem.Text;
        string year = this.lblYear.Text;
        string period = "BD/" + semester + "/" + year.Substring(2, 2);
        //ค้นหารหัสวิชา
        string class_id = this.cmbCourseCode.SelectedValue;
        CLASS_MASTER bsCM = new CLASS_MASTER(this.UserID, this.OUMCode);
        DataTable ClassMaster = bsCM.GetPFSR0011_byPeriod(period,class_id);
        if (ClassMaster.Rows.Count > 0)
        {
            this.BindDataToReport();
        }
        else
        {
            dialog.fnShowMessage("ไม่พบข้อมูล");
        }
    }
    private void BindDataToReport()
    {
        //หาภาคการศึกษาปัจจุบัน
        PERIOD_ENROLL objPeriod = new PERIOD_ENROLL(this.UserID, this.OUMCode);
        string semester = this.lblTrem.Text;
        string year = this.lblYear.Text;
        string period = "BD/" + semester + "/" + year.Substring(2, 2);
        //ค้นหารหัสวิชา
        string class_id = this.cmbCourseCode.SelectedValue;
        ArrayList arrPara = new ArrayList();
        ReportPara obj;
        obj = new ReportPara("period_id ", period);
        arrPara.Add(obj);
        obj = new ReportPara("class_id", this.cmbCourseCode.SelectedValue);
        arrPara.Add(obj);
        if (this.UserLang == "TH")
        {
            Session[SPENUM.ReportName.PFSR0011] = arrPara;
            dialog.fnAddScript("PopupReportForm('../Report/ReportViewer.aspx?ReportName=" + SPENUM.ReportName.PFSR0011 + "')");
        }
        else
        {
            Session[SPENUM.ReportName.PFSR0011EN] = arrPara;
            dialog.fnAddScript("PopupReportForm('../Report/ReportViewer.aspx?ReportName=" + SPENUM.ReportName.PFSR0011EN + "')");
        }
    }
}
 
 ส่วน report อ่ะ
 
 
  
 แล้วพอกด ค้นหาข้อมูล มันก็แสดงอาจารย์อย่างนี้มาอ่ะ
 
 
  
 
 
 Tag : - - - -
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2010-03-17 15:16:14 | By :
                          ทำเล่น | View :
                          1667 | Reply :
                          3 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |