public int UpdateLecturerType(LecturerType lt)
        {
            string sql = @"update LecturerType set LT_NAME=@b,LT_DESC=@c where LT_ID=@a";

            SqlParameter[] par =
            {
                new  SqlParameter("@a", lt.LT_ID),
                new  SqlParameter("@b", lt.LT_NAME),
                new  SqlParameter("@c", lt.LT_DESC)
            };
            return(SQLHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text, par));
        }
        public int AddLecturerType(LecturerType lt)
        {
            string sql = "insert into LecturerType values(@a.@b.@c)";

            SqlParameter[] par =
            {
                new SqlParameter("@a", lt.LT_ID),
                new SqlParameter("@b", lt.LT_NAME),
                new SqlParameter("@c", lt.LT_DESC)
            };
            return(SQLHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text, par));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
            {
                /*=============================*/
                if (!Page.IsPostBack)
                {
                    fail.Visible       = false;
                    divSuccess.Visible = false;

                    // ประเภทอาจารย์
                    ddlLecturerType.Items.Clear();
                    List <LecturerType> lec_type = new List <LecturerType>();
                    lec_type = new LecturerType().getLecturerType2();
                    foreach (LecturerType row in lec_type)
                    {
                        ddlLecturerType.Items.Insert(ddlLecturerType.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode));
                    }
                    //===========

                    // ตำแหน่ง
                    ddlPosition.Items.Clear();
                    List <BoardPosData> position_data = new List <BoardPosData>();
                    position_data = new BoardPos().getBoardPos();
                    foreach (BoardPosData pos in position_data)
                    {
                        ddlPosition.Items.Insert(ddlPosition.Items.Count, new ListItem(pos.Position_Thai, pos.Position_Code));
                    }
                }
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Beispiel #4
0
    public LecturerType getLecturerType2(string type_code)
    {
        LecturerType data = new LecturerType();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = "Select * From LECTUERE_TYPE2 Where TYPE_CODE='" + type_code + "'";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            data.LecturerTypeCode = rowData["TYPE_CODE"].ToString();
            data.LecturerTypeName = rowData["TYPE_NAME"].ToString();
        }

        return(data);
    }
        public List <LecturerType> SeleteLecturerType()
        {
            List <LecturerType> llt = new List <LecturerType>();
            string        sql       = "select LT_NAME from LecturerType";
            SqlDataReader sdr       = SQLHelper.ExecuteReader(sql, System.Data.CommandType.Text, null);

            if (sdr.HasRows)
            {
                while (sdr.Read())
                {
                    LecturerType lt = new LecturerType();
                    lt.LT_NAME = sdr["LT_NAME"].ToString();
                    llt.Add(lt);
                }
            }
            sdr.Close();
            return(llt);
        }
Beispiel #6
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง LECTURERTYPE
    /// </summary>
    /// <returns>ข้อมูลจากตาราง LECTURERTYPE</returns>
    public List <LecturerType> getLecturerType()
    {
        List <LecturerType> data = new List <LecturerType>();

        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        oracleObj.SelectCommand = "Select * From LECTURERTYPE Order By LECTURERTYPECODE";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            LecturerType row = new LecturerType();

            row.LecturerTypeCode = rowData["LECTURERTYPECODE"].ToString();
            row.LecturerTypeName = rowData["LECTURERTYPENAME"].ToString();

            data.Add(row);
        }

        return(data);
    }
 public int UpdateLecturerType(LecturerType lt)
 {
     return(dlt.UpdateLecturerType(lt));
 }
 public int AddLectuerType(LecturerType lt)
 {
     return(dlt.AddLecturerType(lt));
 }
Beispiel #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
            {
                /*=============================*/
                if (!Page.IsPostBack)
                {
                    fail.Visible       = false;
                    divSuccess.Visible = false;

                    // ประเภทอาจารย์
                    ddlLecturerType.Items.Clear();
                    List <LecturerType> lec_type = new List <LecturerType>();
                    lec_type = new LecturerType().getLecturerType2();
                    foreach (LecturerType row in lec_type)
                    {
                        ddlLecturerType.Items.Insert(ddlLecturerType.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode));
                    }
                    //===========

                    // ตำแหน่ง
                    ddlPosition.Items.Clear();
                    List <BoardPosData> position_data = new List <BoardPosData>();
                    position_data = new BoardPos().getBoardPos();
                    foreach (BoardPosData pos in position_data)
                    {
                        ddlPosition.Items.Insert(ddlPosition.Items.Count, new ListItem(pos.Position_Thai, pos.Position_Code));
                    }

                    try
                    {
                        string lecturer_type     = Request.QueryString["type"];
                        string lecturer_position = Request.QueryString["position"];

                        WorkLoadConfigData workload_data = new WorkLoadConfigData();
                        workload_data = new WorkLoadConfig().getWorkLoadConfig(lecturer_type, lecturer_position);

                        ddlLecturerType.Items.FindByValue(lecturer_type).Selected = true;
                        ddlPosition.Items.FindByValue(lecturer_position).Selected = true;
                        txtWorkloadValue.Text    = workload_data.HourReference.ToString();
                        txtMaxWorkloadValue.Text = workload_data.TotalCredit.ToString();

                        ddlLecturerType.Enabled = false;
                        ddlPosition.Enabled     = false;
                    }
                    catch (Exception err)
                    {
                        Session["response"] = err.ToString();
                        Response.Redirect("err_response.aspx");
                    }
                }
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Beispiel #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                // ======== Process ===========
                if (!Page.IsPostBack)
                {
                    prefix = new Prefix().getPrefix();
                    foreach (PrefixData row in prefix)
                    {
                        ddlTITLE_THAINAME.Items.Insert(ddlTITLE_THAINAME.Items.Count, new ListItem(row.Prefix_Thai, row.Prefix_Code));
                        ddlTITLE_ENGNAME.Items.Insert(ddlTITLE_ENGNAME.Items.Count, new ListItem(row.Prefix_Eng, row.Prefix_Code));
                    }

                    academicPosition = new AcademicPosition().getAcademicPosition();
                    foreach (AcademicPosition row in academicPosition)
                    {
                        ddlACADEMIC_POSITION.Items.Insert(ddlACADEMIC_POSITION.Items.Count, new ListItem(row.AcademicPositionThName, row.AcademicPositionCode));
                    }


                    province = new TQF.Province().getProvince();
                    foreach (TQF.Province row in province)
                    {
                        ddlBirthProvince.Items.Insert(ddlBirthProvince.Items.Count, new ListItem(row.ProvinceThai, row.ProvinceCode));
                        ddlHomeProvince.Items.Insert(ddlHomeProvince.Items.Count, new ListItem(row.ProvinceThai, row.ProvinceCode));
                        ddlOfficeProvince.Items.Insert(ddlOfficeProvince.Items.Count, new ListItem(row.ProvinceThai, row.ProvinceCode));
                    }

                    lecturerType = new LecturerType().getLecturerType();
                    foreach (LecturerType row in lecturerType)
                    {
                        ddlLECTURER_CAT.Items.Insert(ddlLECTURER_CAT.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode));
                    }

                    List <LecturerType> lectuere_type_Data = new List <LecturerType>();
                    lectuere_type_Data = new LecturerType().getLecturerType2();
                    foreach (LecturerType row in lectuere_type_Data)
                    {
                        ddlLectuereType.Items.Insert(ddlLectuereType.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode));
                    }

                    List <BoardPosData> position_Data = new List <BoardPosData>();
                    position_Data = new BoardPos().getBoardPos();
                    foreach (BoardPosData row in position_Data)
                    {
                        ddlLectuerePosition.Items.Insert(ddlLectuerePosition.Items.Count, new ListItem(row.Position_Thai, row.Position_Code));
                    }

                    country = new Country().getCountry();
                    foreach (CountryData row in country)
                    {
                        ddlCountry.Items.Insert(ddlCountry.Items.Count, new ListItem(row.Country_ThaiName, row.Country_Code));
                        ddlEthnicity.Items.Insert(ddlEthnicity.Items.Count, new ListItem(row.Country_ThaiName, row.Country_Code));
                        ddlNationality.Items.Insert(ddlNationality.Items.Count, new ListItem(row.Country_ThaiName, row.Country_Code));
                    }
                    ddlCountry.Items.FindByValue("066").Selected     = true;
                    ddlEthnicity.Items.FindByValue("066").Selected   = true;
                    ddlNationality.Items.FindByValue("066").Selected = true;

                    occupation = new Occupation().getOccupation();
                    foreach (OccupationData row in occupation)
                    {
                        ddlOccupation.Items.Insert(ddlOccupation.Items.Count, new ListItem(row.Occupation_Thai, row.Occupation_Code));
                    }

                    marital = new Marital().getMarital();
                    foreach (MaritalData row in marital)
                    {
                        ddlMarital.Items.Insert(ddlMarital.Items.Count, new ListItem(row.Marital_Thai, row.Marital_Code));
                    }

                    religion = new Religion().getReligion();
                    foreach (ReligionData row in religion)
                    {
                        ddlReligion.Items.Insert(ddlReligion.Items.Count, new ListItem(row.Religion_ThaiName, row.Religion_Code));
                    }

                    bank = new BankCode().getBankCode();
                    foreach (BankCodeData row in bank)
                    {
                        ddlBank.Items.Insert(ddlBank.Items.Count, new ListItem(row.Bank_ThaiName, row.Bank_Code));
                    }
                    try
                    {
                        ddlBank.Items.FindByValue("002").Selected = true;
                    }
                    catch
                    { }

                    //วิชาการคณะ
                    if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                    {
                        List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                        // คณะ
                        facultyData = new Faculty().getFaculty(faculty_authorized);
                        foreach (FacultyData data in facultyData)
                        {
                            ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code));
                        }

                        departmentData = new Department().getDepartmentWithFaculty(ddlFACULTY.SelectedValue);
                        ddlDEPARTMENT.Items.Clear();
                        ddlDEPARTMENT.Items.Insert(ddlDEPARTMENT.Items.Count, new ListItem("-- เลือก --", "0000"));
                        foreach (DepartmentData data in departmentData)
                        {
                            ddlDEPARTMENT.Items.Insert(ddlDEPARTMENT.Items.Count, new ListItem(data.Department_Thai, data.Department_Code));
                        }
                    }
                    //วิชาการภาค
                    else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                    {
                        ddlFACULTY.Enabled   = false;
                        ddlFACULTY.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
                        List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                        // ภาควิชา
                        departmentData = new Department().getDepartment(department_authorized);
                        ddlDEPARTMENT.Items.Clear();
                        ddlDEPARTMENT.Items.Insert(ddlDEPARTMENT.Items.Count, new ListItem("-- เลือก --", "0000"));
                        foreach (DepartmentData data in departmentData)
                        {
                            ddlDEPARTMENT.Items.Insert(ddlDEPARTMENT.Items.Count, new ListItem(data.Department_Thai, data.Department_Code));
                        }

                        // คณะ
                        faculty_data = new Faculty().getFaculty(ddlDEPARTMENT.SelectedValue.Substring(0, 2));
                        ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code));
                    }
                } // End if (!Page.IsPostBack)
                  //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("../err_response.aspx");
            }
        }
    }