Exemplo n.º 1
0
        public void LoadConacts()
        {
            PhoneBookLocalStorage.phonebookSMSWindowOpen = true;
            gridContacts.Rows.Clear();
            gridContacts.Columns.Clear();

            DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();

            gridContacts.Columns.Add(chk);                          //0
            chk.HeaderText = "Select";
            chk.Name       = "isSelected";

            ContactsDAL db = new ContactsDAL();

            gridContacts.Columns.Add("cnt_id", "cnt_id");               //1
            gridContacts.Columns["cnt_id"].Visible = false;
            gridContacts.Columns.Add("cnt_FirstName_LastName", "Name"); //2
            gridContacts.Columns["cnt_FirstName_LastName"].ReadOnly = true;
            gridContacts.Columns.Add("cnt_Number", "Number");           //3
            gridContacts.Columns["cnt_Number"].ReadOnly = true;
            gridContacts.Columns["cnt_Number"].Width    = 140;



            foreach (var item in db.LoadAll().Where(m => m.status))
            {
                gridContacts.Rows.Add(
                    PhoneBookLocalStorage.IsInList(item.cnt_Number),
                    item.cnt_id,
                    item.cnt_FirstName + " " + item.cnt_LastName,
                    item.cnt_Number);
            }
        }
Exemplo n.º 2
0
 public void On_OK()
 {
     for (int i = 0; i < gridContacts.RowCount; i++)
     {
         if (Convert.ToBoolean(gridContacts.Rows[i].Cells[0].Value))
         {
             if (!PhoneBookLocalStorage.IsInList(gridContacts.Rows[i].Cells[3].Value.ToString()))
             {
                 PhoneBookLocalStorage.list.Add(gridContacts.Rows[i].Cells[3].Value.ToString());
             }
         }
         else
         {
             if (PhoneBookLocalStorage.IsInList(gridContacts.Rows[i].Cells[3].Value.ToString()))
             {
                 PhoneBookLocalStorage.list.Remove(gridContacts.Rows[i].Cells[3].Value.ToString());
             }
         }
     }
     PhoneBookLocalStorage.localStorageReaded     = false;
     PhoneBookLocalStorage.phonebookSMSWindowOpen = false;
     this.Hide();
 }