Exemple #1
0
        private void LoadData()
        {
            DataTable dt = new DataTable();

            dt = AccountFB.LoadDuLieuByNhanVien(taikhoan);
            gridControl1.DataSource = dt;
        }
Exemple #2
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     ThuVienLamViecFacebook.DangXuat();
     if (txtEmail.Text != "" && txtPassword.Text != "")
     {
         tblAccountFB ac = ThuVienLamViecFacebook.DangNhap(txtEmail.Text, txtPassword.Text);
         ac.TaiKhoan = taikhoan;
         if (radioTichCuc.Checked == true)
         {
             ac.Status = 1;
         }
         else
         {
             ac.Status = -1;
         }
         if (ac.NumberIDAccount != "")
         {
             if (AccountFB.Them(ac))
             {
                 MessageBox.Show("Đã thêm tài khoản");
                 LoadData();
             }
             else
             {
                 MessageBox.Show("Tài khoản đã tồn tại");
             }
         }
         else
         {
             MessageBox.Show("Thông tin đăng nhập không đúng");
         }
     }
 }
Exemple #3
0
        private void Xoa_Click(object sender, EventArgs e)
        {
            string email = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Email").ToString();

            if (AccountFB.Xoa(email, taikhoan))
            {
                MessageBox.Show("Đã xóa tài khoản!");
                LoadData();
            }
        }
 private void LoadListAccount()
 {
     tichcuc = AccountFB.LoadDuLieuByStatus(1, taikhoan);
     tieucuc = AccountFB.LoadDuLieuByStatus(-1, taikhoan);
     lsCheckTKTichCuc.Items.Add("Tất cả");
     lsCheckTKTieuCuc.Items.Add("Tất cả");
     for (int i = 0; i < tichcuc.Rows.Count; i++)
     {
         lsCheckTKTichCuc.Items.Add(tichcuc.Rows[i]["Name"].ToString());
     }
     for (int i = 0; i < tieucuc.Rows.Count; i++)
     {
         lsCheckTKTieuCuc.Items.Add(tieucuc.Rows[i]["Name"].ToString());
     }
 }
Exemple #5
0
 public void DoWork()
 {
     for (;;)
     {
         Thread.Sleep(30000);
         if (Work.KiemTraTienDo(idpost, taikhoan) == false)
         {
             MessageBox.Show("Đã bình luận xong với bài viết có id= " + idpost);
             //load lại csdl
             try
             {
                 getreload();
             }
             catch { }
             break;
         }
         //làm công tác bình luận
         string idaccountbl = WorkAccount.LayIDBinhLuan(idpost, taikhoan);
         // đăng xuất
         ThuVienLamViecFacebook.DangXuat();
         DataTable dtac = AccountFB.LoadDuLieuByID(idaccountbl);
         //đăng nhập và lấy fb-dtsg
         string fb_dtsg        = ThuVienLamViecFacebook.DNLay_fb_dtsg(dtac.Rows[0]["Email"].ToString(), dtac.Rows[0]["Password"].ToString());
         string noidungcomment = WorkComment.LayNoiDungComment(idpost, taikhoan);
         // bắt đầu bình luận
         ThuVienLamViecFacebook.BinhLuan(idpost, noidungcomment, idaccountbl, fb_dtsg);
         //thay đổi trạng thái của hoạt động
         //lưu thông tin vào worked
         tblWorked wd = new tblWorked();
         wd.IDPost      = idpost;
         wd.IDAccoutFB  = idaccountbl;
         wd.NoiDung     = noidungcomment;
         wd.TaiKhoan    = taikhoan;
         wd.TimeComment = DateTime.Now;
         Worked.Them(wd);
         //kết thúc lưu thông tin vào worked
         Work.updatetiendo(idpost, taikhoan);
         try
         {
             getreload();
         }
         catch { }
         Thread.Sleep(int.Parse(time.ToString()) * 60000);
     }
 }
        //Kết thúc đăng xuất
        //đăng nhập không lấy thông tin
        public static void DNKhongLayTT(string idaccountfb)
        {
            DataTable  dt   = AccountFB.LoadDuLieuByID(idaccountfb);
            WebBrowser web1 = new WebBrowser();

            web1.ScriptErrorsSuppressed = true;
            string postdata = "email=" + dt.Rows[0]["Email"] + "&pass="******"Password"];

            System.Text.Encoding encoding = System.Text.Encoding.UTF8;
            byte[] bytes = encoding.GetBytes(postdata);
            string url   = "https://mobile.facebook.com/login.php";

            web1.Navigate(url, string.Empty, bytes, "Content-Type: application/x-www-form-urlencoded");
            while (web1.ReadyState != WebBrowserReadyState.Complete)
            {
                Application.DoEvents();
            }
        }
Exemple #7
0
        //đánh giá trang, nhóm
        private void DanhGia(int kt)
        {
            foreach (ListViewItem item in lsKetQuaSearch.SelectedItems)
            {
                // thêm vào pages
                if (DrbtnLoaiTim.selectedIndex == 0)
                {
                    tblPage pg = new tblPage();
                    pg.IDPage   = lsIDPage[item.Index];
                    pg.Name     = lsNamePage[item.Index];
                    pg.ImgLink  = lsLinkImgPage[item.Index];
                    pg.Status   = kt;
                    pg.TaiKhoan = taikhoan;
                    DAO.Pages.Them(pg);
                }
                //thêm vào groups
                if (DrbtnLoaiTim.selectedIndex == 1)
                {
                    tblGroup newgroup = new tblGroup();
                    newgroup.IDGroup  = lsIDPage[item.Index];
                    newgroup.Name     = lsNamePage[item.Index];
                    newgroup.ImgLink  = lsLinkImgPage[item.Index];
                    newgroup.Status   = kt;
                    newgroup.TaiKhoan = taikhoan;
                    DAO.Group.Them(newgroup);

                    DataTable dt = AccountFB.LoadDuLieuByNhanVien(taikhoan);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        ThuVienLamViecFacebook.DangXuat();
                        ThuVienLamViecFacebook.DNKhongLayTT(dt.Rows[i]["NumberIDAccount"].ToString());
                        ThuVienLamViecFacebook.JoinGroup(lsIDPage[item.Index]);
                    }
                }
                //xóa cái vừa đánh giá khỏi danh sách
                lsIDPage.RemoveAt(item.Index);
                lsNamePage.RemoveAt(item.Index);
                lsLinkImgPage.RemoveAt(item.Index);
                lsKetQuaSearch.Items.RemoveAt(item.Index);
            }
            MessageBox.Show("Đã thêm vào danh sách");
        }