예제 #1
0
        ////Load
        //private static int SortByDate(BAIVIET_getall_newResult rs1, BAIVIET_getall_newResult rs2)
        //{
        //    if (rs1.NgayDang > rs2.NgayDang)
        //    {
        //        return -1;
        //    }
        //    if (rs1.NgayDang == rs2.NgayDang)
        //        return 0;
        //    return 1;
        //}
        public int LoadGopY()
        {
            BUSGopY gopY = new BUSGopY();
            List<GOPY> dsGopY = new List<GOPY>();
            dsGopY = gopY.LayDSGopY();

            if (dsGopY.Count > 0)
            {
                //lt.Sort(SortByDate);
                this.GridViewGopY.DataSource = dsGopY;
                GridViewGopY.DataBind();
                PanelDanhSach.Visible = true;
                PanelMessage.Visible = false;

                //                 for (int i = 0; i < lt.Count; i++)
                //                 {
                //                     GridViewBaiViet.Rows[i].Cells[4].Text = BUSLoaiBaiViet.TimKiem((int)lt[i].MaLoaiBaiViet).TenLoaiBaiViet;
                //                 }
                return dsGopY.Count;
            }
            else
            {
                PanelDanhSach.Visible = false;
                PanelMessage.Visible = true;
                return 0;
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = "Danh Sách Góp Ý";

            if (!IsPostBack)
            {
                int soDong = LoadGopY();

                //                 if (Request.QueryString["id"] != null)
                //                 {
                //                     for (int i = 0; i < ((List<BAIVIET_getall_newResult>)this.GridViewBaiViet.DataSource).Count; i++)
                //                     {
                //                         if (((List<BAIVIET_getall_newResult>)this.GridViewBaiViet.DataSource)[i].MaBaiViet.ToString() == Request.QueryString["id"].ToString())
                //                         {
                //                            // this.GridViewBaiViet.PageIndex = i / this.GridViewBaiViet.PageSize;
                //                             this.GridViewBaiViet.DataBind();
                //                            // this.GridViewBaiViet.Rows[i].CssClass = "selectedrow";
                //                             break;
                //                         }
                //                     }
                //                 }

                // FilterSTT(soDong, this.GridViewBaiViet.PageIndex, 10);

            }
            this.GridViewGopY.HeaderStyle.CssClass = "headerstyle";
            int maGopY;
            if (int.TryParse(Request.QueryString["id"], out maGopY))
            {
                BUSGopY busGopY = new BUSGopY();
                GOPY gopy = new GOPY();
                gopy = busGopY.LayGopYTheoMa(maGopY);

                txtTieuDe.Text = gopy.TieuDe;

                txtNoiDung.Text = gopy.NoiDungGopY;
            }
        }
예제 #3
0
        protected void btGopY_Click1(object sender, EventArgs e)
        {
            //Lấy user và email

            if (txtTieuDe.Text == "")
            {
                lblThongTin.Text = "Vui lòng tiêu đề của góp ý!";
                lblThongTin.Visible = true;
                return;
            }
            if (txtNoiDungGopY.Text == "")
            {
                lblThongTin.Text = "Vui lòng nhập nội dung góp ý của bạn!";
                lblThongTin.Visible = true;
                return;
            }
            if (txtMSSV.Text == "")
            {
                lblThongTin.Text = "Vui lòng nhập MSSV!";
                lblThongTin.Visible = true;
                return;
            }
            if (txtEmail.Text == "")
            {
                lblThongTin.Text = "Vui lòng nhập địa chỉ Email!";
                lblThongTin.Visible = true;
                return;
            }

            //BUSNguoiDung busnguoidung = new BUSNguoiDung();

            //NGUOIDUNG sv = busnguoidung.TimKiemTheoUsernameVaEmail(txtMSSV.Text, txtEmail.Text);

            //if (sv == null)
            //{
            //    lblThongTin.Text = "MSSV hoặc email không đúng, vui lòng nhập lại.";
            //}
            //else
            {
                BUSGopY busGopY = new BUSGopY();
                GOPY gopY = new GOPY();
                gopY.TieuDe = txtTieuDe.Text;
                gopY.NoiDungGopY = txtNoiDungGopY.Text;
                gopY.MSSV = txtMSSV.Text;
                gopY.Email = txtEmail.Text;
                int res = busGopY.Them(gopY);
                if (res == 1)
                {
                    lblEmail.Visible = false;
                    lblTieuDe.Visible = false;
                    lblMSSV.Visible = false;
                    lblNoiDung.Visible = false;
                    txtTieuDe.Visible = false;
                    lblThongBao.Visible = false;
                    txtMSSV.Visible = false;
                    txtEmail.Visible = false;
                    txtNoiDungGopY.Visible = false;
                    btGopY.Visible = false;
                    lblThongTin.Text = "Cảm ơn bạn đã đóng góp ý kiến nhằm giúp phát triển website!";
                }
                else lblThongTin.Text = "Chưa thực hiện được!";
            }
        }