Esempio n. 1
0
    protected void btn_Dangky_Click(object sender, EventArgs e)
    {
        string    id    = "select Max(IDThanhvien) from THANHVIEN";
        DataTable tb_id = ketnoi.getData(id);

        int mathanhvien;

        if (tb_id.Rows.Count == 0)
        {
            mathanhvien = 1;
        }
        else
        {
            mathanhvien = Int32.Parse(tb_id.Rows[0][0].ToString());
        }

        string    tendangnhap    = "select Tendangnhap from TENDANGNHAP where Tendangnhap='" + Session["Tendangnhap"].ToString() + "'";
        DataTable tb_tendangnhap = ketnoi.getData(tendangnhap);

        if (txt_hoten.Text == "")
        {
            Response.Write("<script>alert('Họ tên không được bỏ trống!')</script>");
        }
        else if (txt_tendangnhap.Text == "")
        {
            Response.Write("<script>alert('Tên đăng nhập không được bỏ trống')</script>");
        }
        else if (tb_tendangnhap.Rows.Count > 0)
        {
            Response.Write("<script>alert('Tên đăng nhập đã tồn tại')</script>");
        }
        else if (txt_matkhau.Text == "")
        {
            Response.Write("<script>alert('Mật khẩu không được bỏ trống')</script>");
        }
        else if (txt_matkhau.Text.Trim() != txt_nhaplaimatkhau.Text.Trim())
        {
            Response.Write("<script>alert('Mật khẩu nhập lại không trùng khớp')</script>");
        }
        else
        {
            string gioitinh;
            if (rd_nam.Checked)
            {
                gioitinh = "Nam";
            }
            else
            {
                gioitinh = "Nữ";
            }
            string dangky = "insert into THANHVIEN values('" + (mathanhvien + 1) + "',N'" + txt_hoten.Text + "','" + txt_tendangnhap.Text + "','" +
                            txt_matkhau.Text + "',2,'" + txt_ngaysinh.Text + "','" + gioitinh + "',N'" + txt_noisinh.Text + "',N'" + txt_diachi.Text + "','" + txt_sodienthoai.Text + "', '" + txt_email.Text + "',N'" + dr_nghenghiep.Text + "')";
            try
            {
                ketnoi.executeQuery(dangky);
                Response.Write("<script> alert('Đăng ký thành công!'); </script>");
            }
            catch { Response.Write("<script> alert('Đăng ký không thành công!'); </script>"); }
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string    id  = Request.QueryString["chude"].ToString();
        string    sql = "select  * from CHUDE_NGUPHAP where IDChude=N'" + id.Trim() + "'";
        DataTable tb  = ketnoi.getData(sql);

        txt_tieude.Text  = tb.Rows[0]["Tenchude"].ToString().ToUpper();
        txt_tieude2.Text = tb.Rows[0]["Tenchude"].ToString().ToUpper();
        string nguphap = "select * from NGUPHAP where IDChude='" + tb.Rows[0]["IDChude"].ToString() + "'";

        Repeater1.DataSource = ketnoi.getData(nguphap);
        Repeater1.DataBind();
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string chude = Request.QueryString["chude"].ToString();

        string sql = "select * from TUVUNG a, CHUDE_TUVUNG b where a.IDChude = b.IDChude and b.Tenchude=N'" + chude + "'";

        rpt_tuvung.DataSource = ketnoi.getData(sql);
        rpt_tuvung.DataBind();

        string    sql_chude = "select * from CHUDE_TUVUNG where Tenchude=N'" + chude + "'";
        DataTable tb        = ketnoi.getData(sql_chude);

        txt_tuvung.Text = tb.Rows[0]["Tenchude"].ToString().ToUpper();
        txt_tieude.Text = tb.Rows[0]["Tenchude"].ToString().ToUpper();
    }
    protected void btn_capnhat_Click(object sender, EventArgs e)
    {
        int       id;
        string    sql   = "select Max(IDTinmoi) from TINMOI";
        DataTable tb_id = ketnoi.getData(sql);

        try
        {
            id = Int32.Parse(tb_id.Rows[0][0].ToString());
        }
        catch {
            id = 0;
        }

        HttpFileCollection fileCollection = Request.Files;

        for (int i = 0; i < fileCollection.Count; i++)
        {
            HttpPostedFile uploadfile = fileCollection[i];
            string         fileName   = Path.GetFileName(uploadfile.FileName);
            if (uploadfile.ContentLength > 0)
            {
                uploadfile.SaveAs(Server.MapPath("~/images/") + fileName);
                string sql_tinmoi = "insert into TINMOI values('0" + (id + 1) + "',N'" + txt_tieude.Text + "','" + txt_ngaydang.Text + "',N'" + txt_rutgon.Text + "',N'" + txt_doanvan.Text + "','" + fileName + "')";
                ketnoi.executeQuery(sql_tinmoi);
                Response.Write("<script> alert('Thêm mới thành công!'); window.location.href='Admin_tintuc.aspx';</script>");
            }
            else
            {
                Response.Write("<script> alert('Thêm mới không thành công!'); window.location.href='Admin_tintuc.aspx';</script>");
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string    dangky    = "select * from THANHVIEN where Tendangnhap='" + Session["Tendangnhap"].ToString() + "'";
         DataTable tb_dangky = ketnoi.getData(dangky);
         txt_hoten.Text = tb_dangky.Rows[0]["Hoten"].ToString().Trim();
         string gioitinh = tb_dangky.Rows[0]["Gioitinh"].ToString().Trim();
         if (gioitinh == "Nam")
         {
             rd_nam.Checked = true;
         }
         else
         {
             rd_nu.Checked = true;
         }
         DateTime dt = DateTime.Parse(tb_dangky.Rows[0]["Ngaysinh"].ToString().Trim());
         txt_ngaysinh.Text    = dt.ToString("yyyy-MM-dd");
         txt_noisinh.Text     = tb_dangky.Rows[0]["Noisinh"].ToString().Trim();
         txt_diachi.Text      = tb_dangky.Rows[0]["Diachi"].ToString().Trim();
         txt_sodienthoai.Text = tb_dangky.Rows[0]["Sodienthoai"].ToString().Trim();
         txt_email.Text       = tb_dangky.Rows[0]["Email"].ToString().Trim();
         dr_nghenghiep.Text   = tb_dangky.Rows[0]["Nghenghiep"].ToString().Trim();
     }
 }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string bangdiem = "select Convert(nchar(10), a.Ngaykiemtra,103) as Ngaykiemtra, * from BANGDIEM a, THANHVIEN b where a.IDThanhvien=b.IDThanhvien and b.Tendangnhap='" + Session["tendangnhap"].ToString() + "'";

        Repeater1.DataSource = ketnoi.getData(bangdiem);
        Repeater1.DataBind();
    }
Esempio n. 7
0
    protected void btn_Dangky_Click(object sender, EventArgs e)
    {
        string    kiemtra    = "select * from THANHVIEN where Tendangnhap='" + Session["tendangnhap"] + "' and Matkhau='" + txt_matkhaucu.Text + "'";
        DataTable tb_kiemtra = ketnoi.getData(kiemtra);

        if (tb_kiemtra.Rows.Count > 0)
        {
            if (txt_matkhaumoi.Text.Trim() != txt_nhaplaimatkhaumoi.Text.Trim())
            {
                Response.Write("<script> alert('Mật khẩu không trùng khớp!')</script>");
            }
            else
            {
                string sql = "update THANHVIEN set Matkhau='" + txt_matkhaumoi.Text + "' where Tendangnhap='" + Session["tendangnhap"].ToString() + "'";
                try
                {
                    ketnoi.executeQuery(sql);
                    Response.Write("<script> alert('Mật khẩu đã được thay đổi!'), window.location.href='Default.aspx'; </script>");
                }
                catch
                {
                    Response.Write("<script> alert('Mật khẩu thay đổi không thành công!')</script>");
                }
            }
        }
        else
        {
            Response.Write("<script> alert('Mật khẩu không chính xác!')</script>");
        }
    }
Esempio n. 8
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        double    id;
        string    sql   = "select MAX(IDNguphap) from NGUPHAP";
        DataTable tb_id = ketnoi.getData(sql);

        if (tb_id.Rows[0][0].ToString() == "")
        {
            id = 1;
        }
        else
        {
            id = Int32.Parse(tb_id.Rows[0][0].ToString()) + 1;
        }
        string insert = "insert into NGUPHAP values('" + id + "',N'" + txt_noidung.Text + "','','','" + dr_tennguphap.Text + "','Grammar')";

        try
        {
            ketnoi.executeQuery(insert);
            Response.Write("<script>alert('Thêm mới thành công'); window.location.href='Admin-Nguphap.aspx' </script>");
        }
        catch {
            Response.Write("<script>alert('Thêm mới không thành công'); </script>");
        }
    }
Esempio n. 9
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string    maxid  = "select MAX(IDlienhe) from LIENHE";
        DataTable tb_max = ketnoi.getData(maxid);
        int       id;

        if (tb_max.Rows[0][0].ToString() == "")
        {
            id = 1;
        }
        else
        {
            id = Int32.Parse(tb_max.Rows[0][0].ToString()) + 1;
        }
        string lienhe = "insert into LIENHE values('" + id + "',N'" + txt_hoten.Text + "','" + txt_email.Text + "',N'" + txt_nghenghiep.Text + "','" + txt_sodienthoai.Text + "',N'" + txt_noidung.Text + "')";

        try
        {
            ketnoi.executeQuery(lienhe);
            Response.Write("<script> alert('Gửi thành công!');</script>");
        }
        catch {
            Response.Write("<script> alert('Gửi không thành công!');</script>");
        }
    }
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string id             = Request.QueryString["id"];
        string sql_kinhnghiem = "select Convert(nchar(10),Ngaydang,103) as Ngaydang, * from KINHNGHIEM where IDKinhnghiem='" + id + "'";

        rpt_noidung.DataSource = ketnoi.getData(sql_kinhnghiem);
        rpt_noidung.DataBind();
    }
Esempio n. 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string nguphap = "select * from NGUPHAP";
         Repeater1.DataSource = ketnoi.getData(nguphap);
         Repeater1.DataBind();
     }
 }
Esempio n. 12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string sql = "select * from LIENHE";
         Repeater1.DataSource = ketnoi.getData(sql);
         Repeater1.DataBind();
     }
 }
Esempio n. 13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string sql_cauhoi = "select convert(nchar(10),Ngaydang,103) as Ngaydang,* from TINMOI";
         Repeater1.DataSource = ketnoi.getData(sql_cauhoi);
         Repeater1.DataBind();
     }
 }
Esempio n. 14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string sql = "select * from TUVUNG a, CHUDE_TUVUNG b where a.IDChude = b.IDChude";
         rpt_tuvung.DataSource = ketnoi.getData(sql);
         rpt_tuvung.DataBind();
     }
 }
Esempio n. 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            dangnhapthanhcong.Visible = false;


            if (Session["tendangnhap"] == null)
            {
                dangnhap.Visible          = true;
                dangnhapthanhcong.Visible = false;
                dangky.Visible            = true;
                dangxuat.Visible          = false;
                thanhvien.Visible         = false;
            }
            else
            {
                string    hoten    = "select Hoten from THANHVIEN where Tendangnhap='" + Session["tendangnhap"].ToString() + "'";
                DataTable tb_hoten = ketnoi.getData(hoten);
                txt_hoten.Text    = tb_hoten.Rows[0][0].ToString();
                thanhvien.Visible = true;
                int phanquyen = Int32.Parse(Session["phanquyen"].ToString());

                if (phanquyen == 1)
                {
                    dangnhapthanhcong.HRef = "admin_thongke.aspx";
                }
                else
                {
                    dangnhapthanhcong.HRef = "Chinhsua_Dangky.aspx";
                }

                lbl_username.Text         = Session["tendangnhap"].ToString();
                dangnhap.Visible          = false;
                dangnhapthanhcong.Visible = true;
                dangky.Visible            = false;
                dangxuat.Visible          = true;
            }

            string sql_diemthi = "select TOP 10 * from BANGDIEM a, THANHVIEN b where a.IDThanhvien = b.IDThanhvien order by Tongdiem DESC";
            rpt_diemthi.DataSource = ketnoi.getData(sql_diemthi);
            rpt_diemthi.DataBind();
        }
    }
Esempio n. 16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string id  = Request.QueryString["id"].ToString();
         string sql = "select * from TINMOI where Noidung like N'%" + id.Trim() + "%' or Tieude like N'%" + id.Trim() + "%'";
         rpt_tinmoi.DataSource = ketnoi.getData(sql);
         rpt_tinmoi.DataBind();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string id         = Request.QueryString["macauhoi"].ToString();
         string sql_cauhoi = "select * from CAUHOI a, DAPAN b where a.IDCauhoi =b.IDCauhoi and b.IDCauhoi='" + id + "'";
         Repeater1.DataSource = ketnoi.getData(sql_cauhoi);
         Repeater1.DataBind();
     }
 }
Esempio n. 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MasterPage master = this.Master as MasterPage;

        master.BodyId = "grammar";
        string sql = "select * from CHUDE_NGUPHAP";

        rpt_tuvung.DataSource = ketnoi.getData(sql);
        DataBind();
    }
Esempio n. 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MasterPage master = this.Master as MasterPage;

        master.BodyId = "Toeic";
        string sql = "select * from GIAODIEN where IDGiaodien ='gioithieu'";

        Repeater1.DataSource = ketnoi.getData(sql);
        Repeater1.DataBind();
    }
Esempio n. 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MasterPage master = this.Master as MasterPage;

        master.BodyId = "lv880";
        string sql = "select * from DETHI where Loaide='880-990'";

        rpt_dethi.DataSource = ketnoi.getData(sql);
        rpt_dethi.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string    id     = Request.QueryString["id"].ToString();
            string    sql    = "select * from NGUPHAP where IDNguphap='" + id + "'";
            DataTable tb_sql = ketnoi.getData(sql);

            txt_noidung.Text = tb_sql.Rows[0]["Noidung"].ToString();
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string    id         = Request.QueryString["id"].ToString();
         string    nguphap    = "select * from NGUPHAP a, CHUDE_NGUPHAP b where a.IDChude = b.IDChude and IDNguphap='" + id + "'";
         DataTable tb_nguphap = ketnoi.getData(nguphap);
         dr_tennguphap.Text = tb_nguphap.Rows[0]["Tenchude"].ToString();
         txt_noidung.Text   = tb_nguphap.Rows[0]["Noidung"].ToString();
     }
 }
Esempio n. 23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string    id        = Request.QueryString["id"];
         string    sql       = "select * from DONGHO where IdDongho='" + id + "'";
         DataTable tb_dongho = ketnoi.getData(sql);
         txt_loai.Text = tb_dongho.Rows[0]["Phan"].ToString();
         txt_phut.Text = tb_dongho.Rows[0]["Phut"].ToString();
         txt_giay.Text = tb_dongho.Rows[0]["Giay"].ToString();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string    id  = Request.QueryString["id"];
         string    sql = "select * from THANHVIEN where Tendangnhap='" + id + "'";
         DataTable dt  = ketnoi.getData(sql);
         txt_tendangnhap.Text = dt.Rows[0]["Tendangnhap"].ToString();
         txt_matkhau.Text     = dt.Rows[0]["Matkhau"].ToString();
         dr_phanquyen.Text    = dt.Rows[0]["Phanquyen"].ToString();
     }
 }
Esempio n. 25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sql_noidung = "select COUNT(b.IDCauhoi) as soluong, c.IDNoidung from CHITIETNOIDUNG a, CAUHOI b, NOIDUNG c where a.IDNoidungchitiet=b.IDNoidung and a.IDNoidung=c.IDNoidung group by c.IDNoidung";
            Repeater1.DataSource = ketnoi.getData(sql_noidung);
            Repeater1.DataBind();

            string sql_tintuc = "select COUNT(IDTinmoi) as soluong from TINMOI";
            rpt_tintuc.DataSource = ketnoi.getData(sql_tintuc);
            rpt_tintuc.DataBind();

            string sql_kinhnghiem = "select COUNT(IDKinhnghiem) as soluong from KINHNGHIEM";
            rpt_kinhnghiem.DataSource = ketnoi.getData(sql_kinhnghiem);
            rpt_kinhnghiem.DataBind();

            string sql_tuvung = "select COUNT(IDTuvung) as soluong from TUVUNG";
            rpt_tuvung.DataSource = ketnoi.getData(sql_tuvung);
            rpt_tuvung.DataBind();

            string sql_nguphap = "select COUNT(IDNguphap) as soluong from NGUPHAP";
            rpt_nguphap.DataSource = ketnoi.getData(sql_nguphap);
            rpt_nguphap.DataBind();
            for (int i = 0; i < Repeater1.Items.Count; i++)
            {
                Label     lb     = (Label)Repeater1.Items[i].FindControl("txt_soluong");
                string    sql    = "select  COUNT(a.IDNoidungchitiet) as soluong2, c.IDNoidung from CHITIETNOIDUNG a, NOIDUNG c where a.IDNoidung=c.IDNoidung group by c.IDNoidung";
                DataTable tb_sql = ketnoi.getData(sql);

                lb.Text = tb_sql.Rows[i]["soluong2"].ToString();
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string    id        = Request.QueryString["dethi"].ToString();
            string    sql_dethi = "select Tende from DETHI where Made='" + id + "'";
            DataTable tb_dethi  = ketnoi.getData(sql_dethi);
            txt_dethi.Text  = tb_dethi.Rows[0][0].ToString().ToUpper();
            txt_dethi2.Text = tb_dethi.Rows[0][0].ToString().ToUpper();
            string sql_Phutnghe = "select * from DONGHO where IDDongho='03'";
            rpt_dongho.DataSource = ketnoi.getData(sql_Phutnghe);
            rpt_dongho.DataBind();

            string sql_docdientu = "select * from CAUHOI where IDNoidung='DoublePassage'";
            Rpt_nghe.DataSource = ketnoi.getData(sql_docdientu);
            Rpt_nghe.DataBind();
            for (int i = 0; i < Rpt_nghe.Items.Count; i++)
            {
                Label a = (Label)Rpt_nghe.Items[i].FindControl("A");
                Label b = (Label)Rpt_nghe.Items[i].FindControl("B");
                Label c = (Label)Rpt_nghe.Items[i].FindControl("C");
                Label d = (Label)Rpt_nghe.Items[i].FindControl("D");
                try
                {
                    string    sql = "select * from DAPAN where IDCauhoi ='1_Double_" + (i + 1) + "'";
                    DataTable tb  = ketnoi.getData(sql);
                    a.Text = tb.Rows[0]["NDDA"].ToString();
                    b.Text = tb.Rows[1]["NDDA"].ToString();
                    c.Text = tb.Rows[2]["NDDA"].ToString();
                    d.Text = tb.Rows[3]["NDDA"].ToString();
                }
                catch {}
            }
        }
    }
Esempio n. 27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Admin master = this.Master as Admin;

        master.BodyId = "Gioithieu";

        if (!IsPostBack)
        {
            string    sql = "select * from GIAODIEN where IDGiaodien='gioithieu'";
            DataTable dt  = ketnoi.getData(sql);
            txt_doanvan.Text = dt.Rows[0]["Noidung"].ToString();
        }
    }
Esempio n. 28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            FileUpload1.Visible = false;
            try
            {
                string    id            = Request.QueryString["id"].ToString();
                string    kinhnghiem    = "select  * from KINHNGHIEM where IDKinhnghiem='" + id + "'";
                DataTable tb_kinhnghiem = ketnoi.getData(kinhnghiem);

                txt_tieude.Text = tb_kinhnghiem.Rows[0]["Tieude"].ToString();

                DateTime ngaysinh = DateTime.Parse(tb_kinhnghiem.Rows[0]["Ngaydang"].ToString());
                txt_ngaydang.Text = ngaysinh.ToString("yyyy-MM-dd");
                txt_rutgon.Text   = tb_kinhnghiem.Rows[0]["Noidungrutgon"].ToString();
                txt_doanvan.Text  = tb_kinhnghiem.Rows[0]["Noidung"].ToString();
                idhinhanh         = tb_kinhnghiem.Rows[0]["Hinhanh"].ToString();
            }
            catch { }
        }
    }
Esempio n. 29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MasterPage master = this.Master as MasterPage;

        master.BodyId = "Kinhnghiem";
        try
        {
            string sql_tinmoi = "select convert(nchar(10),Ngaydang,103) as Ngaydang,* from KINHNGHIEM order by convert(nchar(10),Ngaydang,103) DESC";
            rpt_tinmoi.DataSource = ketnoi.getData(sql_tinmoi);
            rpt_tinmoi.DataBind();
        }
        catch { }
    }
Esempio n. 30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MasterPage master = this.Master as MasterPage;

        master.BodyId = "Home";

        try
        {
            string sql_gioithieu = "select * from GIAODIEN where IDGiaodien='gioithieu'";
            rpt_Gioithieu.DataSource = ketnoi.getData(sql_gioithieu);
            rpt_Gioithieu.DataBind();

            string sql_tinmoi = "select TOP 3 convert(nchar(10),Ngaydang,103) as Ngaydang,* from TINMOI order by convert(nchar(10),Ngaydang,103) DESC";
            rpt_tinmoi.DataSource = ketnoi.getData(sql_tinmoi);
            rpt_tinmoi.DataBind();

            string sql_kinhnghiem = "select TOP 3 convert(nchar(10),Ngaydang,103) as Ngaydang,* from KINHNGHIEM order by convert(nchar(10),Ngaydang,103) DESC";
            rpt_kinhnghiem.DataSource = ketnoi.getData(sql_kinhnghiem);
            rpt_kinhnghiem.DataBind();
        }
        catch { }
    }