protected void lbtSearch_Click(object sender, EventArgs e)
 {
     string keyword = CpanelUtils.ClearUnicode(txtKeyword.Value);
     int _catid = Utils.CIntDef(ddlCategory.SelectedValue);
     ProductEntity pro = new ProductEntity();
     if (!String.IsNullOrEmpty(keyword))
         pro = getNewsid(keyword, _catid);
     var list = db.BAO_GIADETAILs.Where(n => n.ID_BAOGIA == idbaogia && n.NEWS_ID == pro.NEWS_ID).ToList();
     if (list.Count == 0)
     {
         BAO_GIADETAIL bgdetail = new BAO_GIADETAIL();
         bgdetail.ID_BAOGIA = idbaogia;
         bgdetail.NEWS_ID = pro.NEWS_ID;
         bgdetail.BGD_PRICE = pro.PRICE;
         bgdetail.BGD_QUANTITY = 1;
         db.BAO_GIADETAILs.InsertOnSubmit(bgdetail);
         db.SubmitChanges();
     }
     txtKeyword.Value = "";
     loadPro();
 }
 private void Savebaogia()
 {
    
     HtmlInputCheckBox check = new HtmlInputCheckBox();
     string _sMailContent = string.Empty;
     try
     {
         for (int i = 0; i < GridItemList.Items.Count; i++)
         {
             check = new HtmlInputCheckBox();
             check = (HtmlInputCheckBox)GridItemList.Items[i].FindControl("chkSelect");
             HiddenField hdid = new HiddenField();
             hdid = GridItemList.Items[i].FindControl("Hdnewsid") as HiddenField;
             int _newid = Utils.CIntDef(hdid.Value);
             if (check.Checked)
             {
                 if(!lcheck.Contains(_newid.ToString()))
                     lcheck.Add(_newid.ToString());
                 
             }
         }
         for (int j = 0; j < lcheck.Count; j++)
         {
             int _newsid=Utils.CIntDef(lcheck[j]);
             var list = DB.BAO_GIADETAILs.Where(n => n.ID_BAOGIA == _idbaogia&&n.NEWS_ID==_newsid).ToList();
             if (list.Count == 0)
             {
                 BAO_GIADETAIL bgdetail = new BAO_GIADETAIL();
                 bgdetail.ID_BAOGIA = _idbaogia;
                 bgdetail.NEWS_ID = _newsid;
                 DB.BAO_GIADETAILs.InsertOnSubmit(bgdetail);
                 DB.SubmitChanges();
             }
            
         }
         
     }
     catch (Exception ex)
     {
         clsVproErrorHandler.HandlerError(ex);
     }
     finally
     {
         UpdateTotalAmount();
         Session["lnewsid"] = null;
         Response.Redirect("Page-bao-gia.aspx?id="+_idbaogia);
     }
 }