private void GridRequestDataBind()
 {
     GridView1.DataSource = YCWebServiceBUS.SelectNewRequest();
     GridView1.DataBind();
     if (GridView1.Rows.Count <= 0)
     {
         Button1.Visible = false;
     }
     else
     {
         Button1.Visible = true;
     }
 }
        protected void btYeuCau_Click(object sender, EventArgs e)
        {
            if (captcha.UserValidated)
            {
                lbCaptcha.Visible = false;
                YC_WEBSERVICE_DTO yc = new YC_WEBSERVICE_DTO();

                yc.UserName = txtUsername.Text;
                string pass = MD5.encryptPassword(txtPass.Text);
                yc.Tendn       = txtTenHeThongMuaChung.Text;
                yc.Email       = txtEmail.Text;
                yc.LinkWebSite = txtLink.Text;
                yc.LinkWS      = txtLinkWS.Text;
                yc.McUserName  = txtMCUsernme.Text;
                yc.McPassWord  = txtMCPass.Text;

                try
                {
                    int kq = YCWebServiceBUS.ValidateUserName(yc.UserName, pass);
                    if (kq == 1)
                    {
                        try
                        {
                            YCWebServiceBUS.InsertYCWebService(yc);
                            Panel1.Visible  = false;
                            Button1.Visible = true;
                            lbThongBao.Text = "<b style='color:red ' ><br />Yêu cầu của bạn đã được gửi đi thành công!</b>";
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }
                    }
                    else
                    {
                        lbThongBao.Text = "<b style='color:red ' ><br/> Không thành công! username, pass không đúng hoặc trạng thái của bạn chưa active!</b>";
                        Panel1.Visible  = true;
                        Button1.Visible = false;
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                lbCaptcha.Visible = true;
            }
        }
        protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int          ma        = int.Parse(GridView2.DataKeys[e.RowIndex].Value.ToString());
            DropDownList dr        = (DropDownList)GridView2.Rows[e.RowIndex].FindControl("DropDownList3");
            int          tinhtrang = -1;

            int.TryParse(dr.SelectedValue, out tinhtrang);
            try
            {
                YCWebServiceBUS.updateRequest(ma, tinhtrang);
                lbupdateResult.ForeColor = Color.Green;
                lbupdateResult.Text      = "Cập nhật thành công";
            }
            catch (Exception ex)
            {
                lbupdateResult.ForeColor = Color.Red;
                lbupdateResult.Text      = "Chưa cập nhật được";
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            List <YC_WEBSERVICE_DTO> list = new List <YC_WEBSERVICE_DTO>();
            int n = GridView1.Rows.Count;

            for (int i = 0; i < n; i++)
            {
                YC_WEBSERVICE_DTO yc = new YC_WEBSERVICE_DTO();
                yc.Ma = int.Parse(GridView1.DataKeys[i].Value.ToString());
                DropDownList drop = (DropDownList )GridView1.Rows[i].FindControl("DropDownList1");
                yc.TinhTrangYeuCau = int.Parse(drop.SelectedValue);
                yc.Email           = GridView1.Rows[i].Cells[2].Text;
                list.Add(yc);
            }
            YCWebServiceBUS.UpdateStatusRequest(list);

            /*GridView1.DataSource = YCWebServiceBUS.SelectNewRequest();
             * GridView1.DataBind();*/
            GridRequestDataBind();
        }
 private void GridView2DataBind()
 {
     GridView2.DataSource = YCWebServiceBUS.GetRequest();
     GridView2.DataBind();
 }