Ejemplo n.º 1
0
 private void uploadProfilePhoto(bool bDoAll)
 {
     try
     {
         MobileModermController.Disconnect();
         MobileModermController.Connect();
         List <Task> tasks = new List <Task>();
         for (int iIndex = 0; iIndex < gridData.Rows.Count; iIndex++)
         {
             if (this.IsDisposed)
             {
                 return;
             }
             FaceBook model = gridData.Rows[iIndex].DataBoundItem as FaceBook;
             //bool bPostOK = new FaceBookController().ChangeProfilePhoto(model);
             tasks.Add(Task.Factory.StartNew(() =>
             {
                 int iIndexPost       = iIndex;
                 bool bPostOK         = new FaceBookController().ChangeProfilePhoto(model);
                 MethodInvoker action = delegate
                 {
                     if (bPostOK)
                     {
                         gridData[GridMainFormConst.Status, iIndexPost].Value = "Upload Profile Photo OK";
                     }
                     else
                     {
                         gridData[GridMainFormConst.Status, iIndexPost].Value = "Upload Profile Photo Fail";
                     }
                 };
                 this.BeginInvoke(action);
             }));
             System.Threading.Thread.Sleep(1000);
         }
         while (tasks.Any(t => !t.IsCompleted))
         {
             Application.DoEvents();
             System.Threading.Thread.Sleep(1000);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         isBusy = false;
         if (!this.IsDisposed)
         {
             MethodInvoker action = delegate
             {
                 if (!bDoAll)
                 {
                     btnUploadProfilePhoto.Enabled = true;
                 }
             };
             this.BeginInvoke(action);
         }
     }
 }
Ejemplo n.º 2
0
 void bgwk_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         if (e.Argument is int)
         {
             int iGridIndex        = (int)e.Argument;
             FaceBookController fb = new FaceBookController();//new LoginContain(gridData[ChangePassGridConst.Login, iGridIndex].Value.ToString(), gridData[ChangePassGridConst.CurrentPass, iGridIndex].Value.ToString()));
             fb.StatusChanged += (objs, obje) =>
             {
                 gridData.Invoke((Action)(() =>
                 {
                     gridData[ChangePassGridConst.Status, iGridIndex].Value = obje.Status;
                 }));
             };
             if (fb.CheckLogin())
             {
                 if (!bgwk.CancellationPending)
                 {
                     fb.ChangePass(gridData[ChangePassGridConst.NewPass, iGridIndex].Value.ToString());
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Ejemplo n.º 3
0
 void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         this.Enabled = false;
         FaceBook fb = new FaceBook();
         fb.Login = this.txtUserName.Text.Trim();
         fb.Pass  = this.txtPassword.Text.Trim();
         FaceBookController fbController = new FaceBookController();
         if (fbController.LoginMobile(fb))
         {
             this.model = fb;
             this.Close();
         }
         else
         {
             MessageBox.Show("Không thể đăng nhập !");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         this.Enabled = true;
     }
 }
Ejemplo n.º 4
0
 private void menuLoginAgain_Click(object sender, EventArgs e)
 {
     if (gridData.Rows.Count > 0)
     {
         FaceBook           model        = gridData.Rows[gridData.CurrentCell.RowIndex].DataBoundItem as FaceBook;
         FaceBookController fbController = new FaceBookController();
         if (fbController.LoginMobile(model))
         {
             Global.DBContext.SaveChanges();
             gridData[GridMainFormConst.Status, gridData.CurrentCell.RowIndex].Value = "Đăng nhập thành công";
         }
         else
         {
             if (MessageBox.Show("Đăng nhập thất bại ! Xóa ?", "", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
             {
                 Global.DBContext.FaceBook.Remove(model);
                 Global.DBContext.SaveChanges();
                 reloadGrid();
             }
             else
             {
                 gridData[GridMainFormConst.Status, gridData.CurrentCell.RowIndex].Value = "Đăng nhập thất bại";
             }
         }
     }
 }
Ejemplo n.º 5
0
        private void postStatus()
        {
            try
            {
                //btnPostStatus.Enabled = false;
                int iCountDo = 0;
                while (iCountDo < gridData.Rows.Count)
                {
                    iCountDo = 0;
                    int iIndex = 0;
                    for (; iIndex < gridData.Rows.Count; iIndex++)
                    {
                        FaceBookController fbController = gridData.Rows[iIndex].Tag as FaceBookController; //gridData[GridConst.Controller, iIndex].Value as FaceBookController;
                        //Check account die
                        FaceBook fb = gridData.Rows[iIndex].DataBoundItem as FaceBook;
                        if (fb.Status != null && fb.Status != 1)
                        {
                        }
                        else
                        {
                            fb = DataProvider.DB.FaceBook.Find(fb.ID);
                        }
                        if (fb != null && fb.Status != null && fb.Status != 1)
                        {
                            fbController.SetStatusChanged("Having problems with this account");
                            iCountDo++;
                            continue;
                        }
                        //Check not update status
                        var posted = DataProvider.DB.PostStatus.Where(m => m.FaceBookID == fb.ID && m.SessionID == workingSession.ID).ToList();
                        if (posted.Count > 0)
                        {
                            fbController.SetStatusChanged("This account has Posted Status in this Session");
                            iCountDo++;
                            continue;
                        }

                        //Check Still working
                        if (fbController.IsWorking)
                        {
                            continue;
                        }
                        //Post status
                        fbController.PostStatus();
                        if (!fbController.WorkingFail)
                        {
                            //Sleep 1 minutes
                            System.Threading.Thread.Sleep(120000);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TMessage.ShowException(ex);
            }
            finally
            {
            }
        }
Ejemplo n.º 6
0
        private void uploadPhotoAndCoiverToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Task task = Task.Factory.StartNew(() =>
            {
                FaceBookController fbController = new FaceBookController();
                FaceBook model = gridData.Rows[gridData.SelectedCells[0].RowIndex].DataBoundItem as FaceBook;
                fbController.UpdatePhotoAndCover(model);
            });

            task.Wait();
        }
Ejemplo n.º 7
0
 private void feedAccessTokenToolStripMenuItem_Click(object sender, EventArgs e)
 {
     for (int iINdex = 0; iINdex < gridData.Rows.Count; iINdex++)
     {
         Task task = Task.Factory.StartNew(() =>
         {
             FaceBookController fbController = new FaceBookController();
             FaceBook model = gridData.Rows[iINdex].DataBoundItem as FaceBook;
             fbController.FeedAccessToken(model);
         });
         task.Wait();
     }
 }
Ejemplo n.º 8
0
 private void menuReNameToUS_Click(object sender, EventArgs e)
 {
     if (gridData.Rows.Count > 0)
     {
         FaceBook           model        = gridData.Rows[gridData.CurrentCell.RowIndex].DataBoundItem as FaceBook;
         FaceBookController fbController = new FaceBookController();
         fbController.RenameToUS(model);
         if (Global.DBContext.ChangeTracker.HasChanges())
         {
             Global.DBContext.SaveChanges();
         }
     }
 }
Ejemplo n.º 9
0
 private void menuReNameToUSAll_Click(object sender, EventArgs e)
 {
     for (int iINdex = 0; iINdex < gridData.Rows.Count; iINdex++)
     {
         FaceBook           model        = gridData.Rows[iINdex].DataBoundItem as FaceBook;
         FaceBookController fbController = new FaceBookController();
         fbController.RenameToUS(model);
         if (Global.DBContext.ChangeTracker.HasChanges())
         {
             Global.DBContext.SaveChanges();
         }
     }
 }
Ejemplo n.º 10
0
        private void btnImportFacebook_Click(object sender, EventArgs e)
        {
            string strAccount = Clipboard.GetText();

            if (string.IsNullOrEmpty(strAccount))
            {
                TMessage.ShowInfomation("Nothing in clipboad");
                return;
            }
            if (TMessage.ShowQuestion("Are you sure to import there account", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            foreach (string strLogin in strAccount.Split('\n'))
            {
                if (string.IsNullOrEmpty(strLogin.Trim()))
                {
                    continue;
                }
                FaceBookController fb = new FaceBookController();
                fb.Models       = new FaceBook();
                fb.Models.Login = strLogin.Split('|')[0].Trim();
                fb.Models.Pass  = "******";//"random8&^";
                Clipboard.SetText(fb.Models.Login);
                if (fb.CheckLogin())
                {
                    var existFB = DataProvider.DB.FaceBook.Where(m => m.UserID == fb.Models.UserID).ToList();
                    if (existFB != null && existFB.Count == 0)
                    {
                        fb.Models.Cookies = Serializer.ConvertObjectToBlob(fb.WebClient.CookieContainer);
                        fb.Models.Status  = 1;
                        DataProvider.DB.FaceBook.Add(fb.Models);
                        DataProvider.DB.SaveChanges();
                    }
                }
                else
                {
                    if (fb.WebClient.Error != null)
                    {
                    }
                    else if (fb.WebClient.ResponseText.Contains("Email bạn Ä‘Ă£ nhập khĂ´ng thuá»™c bất kỳ tĂ i khoản nĂ o."))
                    {
                    }
                    else if (fb.WebClient.ResponseText.Contains("If this account reflects your real name and personal information, please help us verify it"))
                    {
                    }
                }
            }
        }
Ejemplo n.º 11
0
 private void menuCopyURL_Click(object sender, EventArgs e)
 {
     if (gridData.Rows.Count > 0)
     {
         FaceBook           model        = gridData.Rows[gridData.CurrentCell.RowIndex].DataBoundItem as FaceBook;
         FaceBookController fbController = new FaceBookController();
         string             strURL       = fbController.GetFaceBookLoginURL(model, "https://www.facebook.com/me");
         if (!string.IsNullOrEmpty(strURL))
         {
             Clipboard.SetText(strURL);
             //MessageBox.Show("Đã copy URL vào clipboad");
         }
     }
 }
Ejemplo n.º 12
0
 private void btnRegFBAccount_Click(object sender, EventArgs e)
 {
     btnRegFBAccount.Enabled = false;
     if (btnRegFBAccount.Text.Contains("Start"))
     {
         btnRegFBAccount.Text = "Stop Reg Auto";
     }
     else
     {
         btnRegFBAccount.Text = "Start Reg Auto";
     }
     //Task.Factory.StartNew(() =>
     {
         while (btnRegFBAccount.Text.Contains("Stop"))
         {
             Debug.WriteLine("Begin");
             MobileModermController.Disconnect();
             MobileModermController.Connect();
             Debug.WriteLine("Start Reg");
             FaceBookController controller = new FaceBookController();
             FaceBook           fb         = controller.RegNewAccount();
             Debug.WriteLine("End Reg");
             if (fb != null)
             {
                 Debug.WriteLine("Begin get Package");
                 FBPackage package = Global.DBContext.FBPackage.Where(m => m.FaceBooks.Count < 3).FirstOrDefault();
                 Debug.WriteLine("End get Package");
                 if (package == null)
                 {
                     long iMax = Global.DBContext.FBPackage.Max(m => m.ID);
                     package = new FBPackage {
                         Pack = iMax + 1
                     };
                 }
                 fb.FBPackage = package;
                 Debug.WriteLine("Begin save");
                 Global.DBContext.FaceBook.Add(fb);
                 Global.DBContext.SaveChanges();
                 Debug.WriteLine("End save");
                 //var t = Global.DBContext.FaceBook.ToList();
             }
             controller.Dispose();
         }
         btnRegFBAccount.Enabled = true;
     }
     //);
 }
Ejemplo n.º 13
0
 private void createPageToolStripMenuItem_Click(object sender, EventArgs e)
 {
     for (int iINdex = 0; iINdex < gridData.Rows.Count; iINdex++)
     {
         Task task = Task.Factory.StartNew(() =>
         {
             FaceBookController fbController = new FaceBookController();
             FaceBook model = gridData.Rows[iINdex].DataBoundItem as FaceBook;
             fbController.CreateNewPage(model);
             if (Global.DBContext.ChangeTracker.HasChanges())
             {
                 Global.DBContext.SaveChanges();
             }
         });
         System.Threading.Thread.Sleep(5000);
     }
 }
Ejemplo n.º 14
0
 private void menuCheckLive_Click(object sender, EventArgs e)
 {
     if (gridData.Rows.Count > 0)
     {
         FaceBook           model        = gridData.Rows[gridData.CurrentCell.RowIndex].DataBoundItem as FaceBook;
         FaceBookController fbController = new FaceBookController();
         if (fbController.checkFaceBook(model))
         {
             //Global.DBContext.SaveChanges();
             gridData[GridMainFormConst.Status, gridData.CurrentCell.RowIndex].Value = "Live";
         }
         else
         {
             gridData[GridMainFormConst.Status, gridData.CurrentCell.RowIndex].Value = "Die";
         }
     }
 }
Ejemplo n.º 15
0
 private void menuCheckLiveAll_Click(object sender, EventArgs e)
 {
     for (int iINdex = 0; iINdex < gridData.Rows.Count; iINdex++)
     {
         Task task = Task.Factory.StartNew(() =>
         {
             FaceBook model = gridData.Rows[iINdex].DataBoundItem as FaceBook;
             FaceBookController fbController = new FaceBookController();
             if (fbController.checkFaceBook(model))
             {
                 //Global.DBContext.SaveChanges();
                 gridData[GridMainFormConst.Status, iINdex].Value = "Live";
             }
             else
             {
                 gridData[GridMainFormConst.Status, iINdex].Value = "Die";
             }
         });
         task.Wait();
     }
 }
Ejemplo n.º 16
0
 private void menuLoginAgainAll_Click(object sender, EventArgs e)
 {
     for (int iINdex = 0; iINdex < gridData.Rows.Count; iINdex++)
     {
         Task task = Task.Factory.StartNew(() =>
         {
             FaceBook model = gridData.Rows[iINdex].DataBoundItem as FaceBook;
             FaceBookController fbController = new FaceBookController();
             if (fbController.LoginMobile(model))
             {
                 //gridData[GridMainFormConst.Status, iINdex].Value = "Đăng nhập thành công";
             }
             else
             {
                 model.FBPackageID = 1;
             }
         });
         task.Wait();
     }
     Global.DBContext.SaveChanges();
 }
Ejemplo n.º 17
0
 private void btnRegFBAccount_Click(object sender, EventArgs e)
 {
     if (btnRegFBAccount.Text.Contains("Start"))
     {
         btnRegFBAccount.Text = "Stop Reg Auto";
     }
     else
     {
         btnRegFBAccount.Text = "Start Reg Auto";
     }
     Task.Factory.StartNew(() =>
     {
         while (btnRegFBAccount.Text.Contains("Stop"))
         {
             if (DateTime.Today >= new DateTime(2014, 09, 10))
             {
                 return;
             }
             MobileModermController.Disconnect();
             MobileModermController.Connect();
             FaceBook fb = new FaceBookController().RegNewAccount();
             if (fb != null)
             {
                 FBPackage package = Global.DBContext.FBPackage.Where(m => m.FaceBooks.Count < 10).FirstOrDefault();
                 if (package == null)
                 {
                     long iMax = Global.DBContext.FBPackage.Max(m => m.ID);
                     package   = new FBPackage {
                         Pack = iMax + 1
                     };
                 }
                 fb.FBPackage = package;
                 Global.DBContext.FaceBook.Add(fb);
                 Global.DBContext.SaveChanges();
                 //var t = Global.DBContext.FaceBook.ToList();
             }
         }
     });
 }
Ejemplo n.º 18
0
        private void menuUpdatePhotoAndCoverAll_Click(object sender, EventArgs e)
        {
            bool bFind = true;

            while (bFind)
            {
                bFind = false;
                for (int iINdex = 0; iINdex < gridData.Rows.Count; iINdex++)
                {
                    Task task = Task.Factory.StartNew(() =>
                    {
                        FaceBookController fbController = new FaceBookController();
                        FaceBook model = gridData.Rows[iINdex].DataBoundItem as FaceBook;
                        Page page      = model.Pages.Where(x => (x.PageData == null || !x.PageData.Contains("\"LUPP\":\"\\/Date("))).FirstOrDefault();
                        if (page != null)
                        {
                            fbController.UpdatePhotoAndCover(page);
                            bFind = true;
                        }
                    });
                    task.Wait();
                    if (Global.DBContext.ChangeTracker.HasChanges())
                    {
                        Global.DBContext.SaveChanges();
                    }
                }
            }
            //for (int iINdex = 0; iINdex < gridData.Rows.Count; iINdex++)
            //{
            //    Task task = Task.Factory.StartNew(() =>
            //    {
            //        FaceBookController fbController = new FaceBookController();
            //        FaceBook model = gridData.Rows[iINdex].DataBoundItem as FaceBook;

            //        fbController.Like(model, "1420890824837381");
            //    });
            //    task.Wait();
            //}
        }
Ejemplo n.º 19
0
        private void regFaceBookAccounts()
        {
            try
            {
                while (true)
                {
                    string strNewName = Utilities.GenerationNewName(false);
                    if (!string.IsNullOrEmpty(strNewName))
                    {
                        //dang ky Email
                        string strNewEmail = Utilities.ConvertToUnSign3(strNewName.Replace(" ", string.Empty)).ToLower().Trim();

                        //Dang Ky Tai Khoan
                        FaceBookController fb = new FaceBookController();
                        fb.RegNewAccount(strNewName, strNewEmail + "@tinphuong.me");
                    }
                    System.Threading.Thread.Sleep(300000);
                }
            }
            catch
            {
            }
            finally { }
        }
Ejemplo n.º 20
0
 private void ketBan()
 {
     try
     {
         MobileModermController.Disconnect();
         MobileModermController.Connect();
         FaceBookController fbController = new FaceBookController();
         for (int iIndex = 0; iIndex < gridData.Rows.Count; iIndex++)
         {
             if (this.IsDisposed)
             {
                 return;
             }
             FaceBook model = gridData.Rows[iIndex].DataBoundItem as FaceBook;
             //Send FriendRequest
             for (int iSeed = iIndex + 1; iSeed < gridData.Rows.Count; iSeed++)
             {
                 if (this.IsDisposed)
                 {
                     return;
                 }
                 FaceBook modelDes = gridData.Rows[iSeed].DataBoundItem as FaceBook;
                 if (fbController.SendFriendRequest(model, modelDes))
                 {
                     gridData[GridMainFormConst.Status, iIndex].Value = "Gửi kết bạn thành công tới " + modelDes.Login;
                 }
                 else
                 {
                     gridData[GridMainFormConst.Status, iIndex].Value = "Gửi kết bạn KHÔNG thành công tới " + modelDes.Login;
                 }
                 System.Threading.Thread.Sleep(2000);
             }
             //Accept Friend Request
             for (int iSeed = iIndex - 1; iSeed >= 0; iSeed--)
             {
                 if (this.IsDisposed)
                 {
                     return;
                 }
                 FaceBook modelDes = gridData.Rows[iSeed].DataBoundItem as FaceBook;
                 if (fbController.AcceptFriendRequest(model, modelDes))
                 {
                     gridData[GridMainFormConst.Status, iIndex].Value = "Chấp nhận bạn thành công từ " + modelDes.Login;
                 }
                 else
                 {
                     gridData[GridMainFormConst.Status, iIndex].Value = "Chấp nhận bạn KHÔNG thành công từ " + modelDes.Login;
                 }
                 System.Threading.Thread.Sleep(2000);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         isBusy = false;
         if (!this.IsDisposed)
         {
             MethodInvoker action = delegate
             { btnKetBan.Enabled = true; };
             this.BeginInvoke(action);
         }
     }
 }
Ejemplo n.º 21
0
 private void confirmEmail(bool bDoAll)
 {
     try
     {
         //MobileModermController.Disconnect();
         //MobileModermController.Connect();
         List <Task>     tasks       = new List <Task>();
         List <FaceBook> listConfirm = new List <FaceBook>();
         for (int iIndex = 0; iIndex < gridData.Rows.Count; iIndex++)
         {
             if (this.IsDisposed)
             {
                 return;
             }
             FaceBook model = gridData.Rows[iIndex].DataBoundItem as FaceBook;
             //new FaceBookController().PostStatus(model);
             Task task = Task.Factory.StartNew(() =>
             {
                 int iIndexPost       = iIndex;
                 bool bPostOK         = new FaceBookController().ConfirmEmail(model);
                 MethodInvoker action = delegate
                 {
                     if (bPostOK)
                     {
                         try
                         {
                             gridData[GridMainFormConst.Status, iIndexPost].Value = "Confirm OK";
                         }
                         catch { }
                         listConfirm.Add(model);
                     }
                     else
                     {
                         try
                         {
                             gridData[GridMainFormConst.Status, iIndexPost].Value = "Confirm Fail";
                         }
                         catch { }
                     }
                 };
                 this.BeginInvoke(action);
             });
             task.Wait();
         }
         while (tasks.Any(t => !t.IsCompleted))
         {
             Application.DoEvents();
             System.Threading.Thread.Sleep(1000);
         }
         if (listConfirm.Count > 0)
         {
             Global.DBContext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         isBusy = false;
         if (!this.IsDisposed)
         {
             MethodInvoker action = delegate
             {
                 if (!bDoAll)
                 {
                     btnConfirmEmail.Enabled = true;
                     //reloadGrid();
                 }
             };
             this.BeginInvoke(action);
         }
     }
 }
Ejemplo n.º 22
0
        void btnFeedMail_Click(object sender, EventArgs e)
        {
            FaceBookController controller = new FaceBookController();

            controller.FeedEmail();
        }
Ejemplo n.º 23
0
        private bool checkFaceBook()
        {
            bool bOK = false;

            try
            {
                List <Task>     tasks      = new List <Task>();
                List <FaceBook> listDelete = new List <FaceBook>();
                for (int iIndex = 0; iIndex < gridData.Rows.Count; iIndex++)
                {
                    if (this.IsDisposed)
                    {
                        return(false);
                    }
                    FaceBook model = gridData.Rows[iIndex].DataBoundItem as FaceBook;
                    Task     task  = Task.Factory.StartNew(() =>
                    {
                        int iIndexPost = iIndex;
                        bool bPostOK   = new FaceBookController().checkFaceBook(model);
                        if (!bPostOK)
                        {
                            listDelete.Add(model);
                        }
                        else
                        {
                            bOK = true;
                        }
                        MethodInvoker action = delegate
                        {
                            if (bPostOK)
                            {
                                try
                                {
                                    gridData[GridMainFormConst.Status, iIndexPost].Value = "Live";
                                }
                                catch { }
                            }
                            else
                            {
                                try
                                {
                                    gridData[GridMainFormConst.Status, iIndexPost].Value = "Die";
                                }
                                catch { }
                            }
                        };
                        this.BeginInvoke(action);
                    });
                    task.Wait();
                }
                if (listDelete.Count > 0)
                {
                    listDelete.ForEach(m => m.FBPackageID = 1);
                    Global.DBContext.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
            return(bOK);
        }
Ejemplo n.º 24
0
        private void loadAllData()
        {
            try
            {
                //var dtFB = DataProvider.Provider.GetData("SELECT * FROM M_FaceBook", "");
                //if (dtFB != null && dtFB.Rows.Count > 0)
                //{
                //    foreach (DataRow rowFB in dtFB.Rows)
                //    {
                //        FaceBook model = new FaceBook();
                //        model.Cookies = (byte[])rowFB["Cookie"];
                //        model.Login = rowFB["Login"].ToString();
                //        model.Pass = rowFB["Pass"].ToString();
                //        model.Status = 1;
                //        model.UserID = rowFB["UserID"].ToString();
                //        db.FaceBook.Add(model);
                //    }
                //}
                //db.SaveChanges();
                //var listInactive = (from fb in DataProvider.DB.FaceBook
                //                    join post in DataProvider.DB.PostStatus on fb.ID equals post.FaceBookID into fbpost
                //                    from fp in fbpost.DefaultIfEmpty()
                //                    where fp.FaceBookID == null
                //                    select fb).ToList();
                //if (listInactive.Count > 0)
                //{
                //    listInactive.ForEach(m => m.Status = 2);
                //    DataProvider.DB.SaveChanges();
                //}

                List <FaceBook> listFB = (from m in DataProvider.DB.FaceBook
                                          select m).ToList();

                if (gridData.Columns.Count == 0)
                {
                    gridData.AutoGenerateColumns = false;
                    DataGridViewTextBoxColumn colStt = new DataGridViewTextBoxColumn();
                    colStt.Name       = GridConst.STT;
                    colStt.HeaderText = GridConst.STT;
                    colStt.Width      = 50;
                    colStt.SortMode   = DataGridViewColumnSortMode.NotSortable;
                    gridData.Columns.Add(colStt);

                    DataGridViewTextBoxColumn colAccount = new DataGridViewTextBoxColumn();
                    colAccount.Name             = GridConst.Login;
                    colAccount.HeaderText       = GridConst.Login;
                    colAccount.Width            = 200;
                    colAccount.DataPropertyName = GridConst.Login;
                    colAccount.SortMode         = DataGridViewColumnSortMode.NotSortable;
                    gridData.Columns.Add(colAccount);

                    DataGridViewTextBoxColumn colStatus = new DataGridViewTextBoxColumn();
                    colStatus.Name       = GridConst.GridStatus;
                    colStatus.HeaderText = GridConst.GridStatus;
                    colStatus.Width      = 500;
                    colStatus.SortMode   = DataGridViewColumnSortMode.NotSortable;
                    gridData.Columns.Add(colStatus);

                    DataGridViewTextBoxColumn colController = new DataGridViewTextBoxColumn();
                    colController.Name    = GridConst.Controller;
                    colController.Visible = false;
                    gridData.Columns.Add(colController);
                }
                BindingSource bs = new BindingSource();
                bs.DataSource       = listFB;
                gridData.DataSource = bs;

                for (int iIndex = 0; iIndex < gridData.Rows.Count; iIndex++)
                {
                    gridData[GridConst.STT, iIndex].Value = iIndex + 1;
                    FaceBookController fbController = new FaceBookController
                    {
                        Models = gridData.Rows[iIndex].DataBoundItem as FaceBook
                        ,
                        SessionID = workingSession.ID
                        ,
                        GridIndex = iIndex
                    };
                    gridData[GridConst.Controller, iIndex].Value = fbController;
                    gridData.Rows[iIndex].Tag   = fbController;
                    fbController.StatusChanged += (objs, obje) =>
                    {
                        gridData.Invoke((Action)(() =>
                        {
                            gridData[GridConst.GridStatus, (objs as FaceBookController).GridIndex].Value = obje.Status;
                        }));
                    };
                }
            }
            catch (Exception ex)
            {
                TMessage.ShowException(ex);
            }
        }