Ejemplo n.º 1
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        StdGroupData data = new StdGroupData();

        data.StdGroup_Code = txtGROUP_CODE.Text;
        data.StdGroup_Thai = txtGROUP_THAINAME.Text;
        data.StdGroup_Eng  = txtGROUP_ENGNAME.Text;

        string result = "";

        try
        {
            result = new StdGroup().updateSection(data);

            if (result == "OK")
            {
                Response.Redirect("list_Student_Group.aspx");
            }
            else
            {
                Response.Redirect("list_Student_Group.aspx");
            }
        }
        catch (Exception E)
        {
            //string response = E.Message.ToString();
            //HttpContext.Current.Session["response"] = "Unit Test: " + response;
            //HttpContext.Current.Response.Redirect("err_response.aspx");
        }
    }
Ejemplo n.º 2
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        string sql = "Select * From STUDENT_GROUP Where GROUP_CODE='" + txtGROUP_CODE.Text + "'";
        List <StdGroupData> chkDup = new StdGroup().getStdGroupManual(sql);

        if (chkDup.Count > 0)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('รหัสกลุ่มผู้เรียนซ้ำ!');", true);
        }
        else
        {
            StdGroupData data = new StdGroupData();

            data.StdGroup_Code = txtGROUP_CODE.Text;
            data.StdGroup_Thai = txtGROUP_THAINAME.Text;
            data.StdGroup_Eng  = txtGROUP_ENGNAME.Text;

            string result = "";

            result = new StdGroup().insertSection(data);

            if (result == "OK")
            {
                Response.Redirect("list_Student_Group.aspx");
            }
        }
    }
Ejemplo n.º 3
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_university) || autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
            {
                /*=============================*/
                code = Request.QueryString["token"];

                if (!Page.IsPostBack)
                {
                    data = obj.getStdGroup(code);

                    txtGROUP_CODE.Text     = data.StdGroup_Code;
                    txtGROUP_THAINAME.Text = data.StdGroup_Thai;
                    txtGROUP_ENGNAME.Text  = data.StdGroup_Eng;
                }
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Ejemplo n.º 4
0
    public string insertSection(StdGroupData dataInsert)
    {
        string response = "";

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

        string sql = "";

        sql = "Insert Into STUDENT_GROUP(GROUP_CODE, GROUP_THAINAME, GROUP_ENGNAME) Values('" + dataInsert.StdGroup_Code + "','" + dataInsert.StdGroup_Thai + "','" + dataInsert.StdGroup_Eng + "')";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "OK";
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString();
            HttpContext.Current.Session["response"] = "Unit Test:System Config: " + response;
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }
        return(response);
    }
Ejemplo n.º 5
0
    public StdGroupData getStdGroup(string stdcategory_code)
    {
        StdGroupData StdGroup_data = new StdGroupData();

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

        string response = "";

        try
        {
            oracleObj.SelectCommand = "Select * From STUDENT_GROUP Where GROUP_CODE='" + stdcategory_code + "'";
            DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
            foreach (DataRowView rowData in allData)
            {
                StdGroup_data.StdGroup_Code = rowData["GROUP_CODE"].ToString();
                StdGroup_data.StdGroup_Thai = rowData["GROUP_THAINAME"].ToString();
                StdGroup_data.StdGroup_Eng  = rowData["GROUP_ENGNAME"].ToString();
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString();
            HttpContext.Current.Session["response"] = "Unit Test:System Config: " + response;
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }
        return(StdGroup_data);
    }
Ejemplo n.º 6
0
    public string updateSection(StdGroupData updateData)
    {
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string sql = "Update STUDENT_GROUP Set GROUP_THAINAME = '" + updateData.StdGroup_Thai + "', GROUP_ENGNAME='" + updateData.StdGroup_Eng + "' Where GROUP_CODE='" + updateData.StdGroup_Code + "'";

        oracleObj.UpdateCommand = sql;

        try
        {
            if (oracleObj.Update() == 1)
            {
                response = "OK";
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString();
            HttpContext.Current.Session["response"] = "Unit Test:System Config: " + response;
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }

        return(response);
    }
Ejemplo n.º 7
0
    //Pongsarun 26/2/2016: use for config system
    public List <StdGroupData> getStdGroupManual(string sql)
    {
        List <StdGroupData> StdGroup_data = new List <StdGroupData>();

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

        oracleObj.SelectCommand = sql;
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            StdGroupData StdGroup = new StdGroupData();
            StdGroup.StdGroup_Code = rowData["GROUP_CODE"].ToString();
            StdGroup.StdGroup_Thai = rowData["GROUP_THAINAME"].ToString();
            StdGroup.StdGroup_Eng  = rowData["GROUP_ENGNAME"].ToString();
            StdGroup_data.Add(StdGroup);
        }

        return(StdGroup_data);
    }