Esempio n. 1
0
    public string insertOtherOffice(OtherOfficeData dataInsert)
    {
        string response = "";


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

        string sql = "";

        sql = "Insert Into OTHER_OFFICE(OTHEROFFICE_CODE, OTHEROFFICE_THAINAME, OTHEROFFICE_ENGNAME, OTHEROFFICE_SHORTNAME, OTHEROFFICE_STATUS) Values('" + dataInsert.OtherOffice_Code + "','" + dataInsert.OtherOffice_ThaiName + "','" + dataInsert.OtherOffice_EngName + "','" + dataInsert.OtherOffice_ShortName + "','" + dataInsert.OtherOffice_Status + "')";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "OK";
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString();
        }
        return(response);
    }
Esempio n. 2
0
    // Update By Amornsak
    public List <OtherOfficeData> getOtherOffice(List <string> otheroffice_code)
    {
        List <OtherOfficeData> data = new List <OtherOfficeData>();

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

        foreach (string code in otheroffice_code)
        {
            oracleObj.SelectCommand = "Select * From OTHER_OFFICE Where OTHEROFFICE_CODE='" + code + "' And OTHEROFFICE_STATUS='0001'";
            DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
            foreach (DataRowView rowData in allData)
            {
                OtherOfficeData Office = new OtherOfficeData();
                Office.OtherOffice_Code      = rowData["OTHEROFFICE_CODE"].ToString();
                Office.OtherOffice_ThaiName  = rowData["OTHEROFFICE_THAINAME"].ToString();
                Office.OtherOffice_EngName   = rowData["OTHEROFFICE_ENGNAME"].ToString();
                Office.OtherOffice_ShortName = rowData["OTHEROFFICE_SHORTNAME"].ToString();
                Office.OtherOffice_Status    = rowData["OTHEROFFICE_STATUS"].ToString();
                data.Add(Office);
            }
        }

        return(data);
    }
Esempio n. 3
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        OtherOfficeData officeSave = new OtherOfficeData();

        officeSave.OtherOffice_Code      = txtOfficeCode.Text;
        officeSave.OtherOffice_ThaiName  = txtOfficeNameThai.Text;
        officeSave.OtherOffice_EngName   = txtOfficeNameEng.Text;
        officeSave.OtherOffice_ShortName = txtOfficeShortName.Text;
        officeSave.OtherOffice_Status    = ddlOfficeStatus.SelectedValue;

        string result = new OtherOffice().updateOtherOffice(officeSave);

        Response.Redirect("list_Office.aspx");
    }
Esempio n. 4
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))
            {
                /*=============================*/
                OfficeCode = Request.QueryString["OfficeId"];

                if (!Page.IsPostBack)
                {
                    officeData = officeObj.getOtherOffice(OfficeCode);

                    List <StatusData> status = new Status().getSystemStatus();
                    foreach (StatusData data in status)
                    {
                        ddlOfficeStatus.Items.Insert(ddlOfficeStatus.Items.Count, new ListItem(data.Status_Thai, data.Status_Code));
                    }

                    txtOfficeCode.Text      = officeData.OtherOffice_Code;
                    txtOfficeNameThai.Text  = officeData.OtherOffice_ThaiName;
                    txtOfficeNameEng.Text   = officeData.OtherOffice_EngName;
                    txtOfficeShortName.Text = officeData.OtherOffice_ShortName;

                    ddlOfficeStatus.ClearSelection();
                    ddlOfficeStatus.Items.FindByValue(officeData.OtherOffice_Status).Selected = true;
                }
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Esempio n. 5
0
    public OtherOfficeData getOtherOffice(string OtherOffice_Code)
    {
        OtherOfficeData data = new OtherOfficeData();

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

        oracleObj.SelectCommand = "Select * From OTHER_OFFICE Where OTHEROFFICE_CODE='" + OtherOffice_Code + "'";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            data.OtherOffice_Code      = rowData["OTHEROFFICE_CODE"].ToString();
            data.OtherOffice_ThaiName  = rowData["OTHEROFFICE_THAINAME"].ToString();
            data.OtherOffice_EngName   = rowData["OTHEROFFICE_ENGNAME"].ToString();
            data.OtherOffice_ShortName = rowData["OTHEROFFICE_SHORTNAME"].ToString();
            data.OtherOffice_Status    = rowData["OTHEROFFICE_STATUS"].ToString();
        }

        return(data);
    }
Esempio n. 6
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        OtherOfficeData officeSave = new OtherOfficeData();

        officeSave.OtherOffice_Code      = txtOfficeCode.Text;
        officeSave.OtherOffice_ThaiName  = txtOfficeNameThai.Text;
        officeSave.OtherOffice_EngName   = txtOfficeNameEng.Text;
        officeSave.OtherOffice_ShortName = txtOfficeShortName.Text;
        officeSave.OtherOffice_Status    = ddlOfficeStatus.SelectedValue;

        int count = new OtherOffice().getCountOtherOffice(txtOfficeCode.Text.Trim());

        if (count > 0)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('รหัส ข้อมูลซ้ำ!');", true);
        }
        else
        {
            string result = new OtherOffice().insertOtherOffice(officeSave);
            Response.Redirect("list_Office.aspx");
        }
    }
Esempio n. 7
0
    public List <OtherOfficeData> getOtherOfficeManual(string sql)
    {
        List <OtherOfficeData> data = new List <OtherOfficeData>();

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

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

        foreach (DataRowView rowData in allData)
        {
            OtherOfficeData Office = new OtherOfficeData();
            Office.OtherOffice_Code      = rowData["OTHEROFFICE_CODE"].ToString();
            Office.OtherOffice_ThaiName  = rowData["OTHEROFFICE_THAINAME"].ToString();
            Office.OtherOffice_EngName   = rowData["OTHEROFFICE_ENGNAME"].ToString();
            Office.OtherOffice_ShortName = rowData["OTHEROFFICE_SHORTNAME"].ToString();
            Office.OtherOffice_Status    = rowData["OTHEROFFICE_STATUS"].ToString();
            data.Add(Office);
        }

        return(data);
    }
Esempio n. 8
0
    public string updateOtherOffice(OtherOfficeData updateData)
    {
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string sql = "UPDATE OTHER_OFFICE SET OTHEROFFICE_THAINAME = '" + updateData.OtherOffice_ThaiName + "', OTHEROFFICE_ENGNAME = '" + updateData.OtherOffice_EngName + "', OTHEROFFICE_SHORTNAME = '" + updateData.OtherOffice_ShortName + "', OTHEROFFICE_STATUS = '" + updateData.OtherOffice_Status + "' WHERE OTHEROFFICE_CODE = '" + updateData.OtherOffice_Code + "'";

        oracleObj.UpdateCommand = sql;

        try
        {
            if (oracleObj.Update() == 1)
            {
                response = "OK";
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString() + " ";
        }

        return(response);
    }