예제 #1
0
        private void dgvPer_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (string.Compare(dgvPer.CurrentCell.OwningColumn.Name, "active") == 0)
            {
                bool checkBoxStatus = Convert.ToBoolean(dgvPer.CurrentCell.EditedFormattedValue);

                if (checkBoxStatus)
                {
                    int id  = Convert.ToInt32(dgvPer.CurrentRow.Cells[3].Value);
                    var idr = cbbPer.SelectedValue.ToString();
                    int id1 = -1;
                    try
                    {
                        id1 = Convert.ToInt32(idr);
                    }
                    catch (Exception ex) { }

                    rfDAO.update(id1, id, 1);
                    GetSource.getTableSourceFromList <RoleFunc>(rfDAO.getAllByIDRole(id1), dgvPer);
                }
                else
                {
                    int id  = Convert.ToInt32(dgvPer.CurrentRow.Cells[3].Value);
                    var idr = cbbPer.SelectedValue.ToString();
                    int id1 = -1;
                    try
                    {
                        id1 = Convert.ToInt32(idr);
                    }
                    catch (Exception ex) { }
                    rfDAO.update(id1, id, 0);
                    GetSource.getTableSourceFromList <RoleFunc>(rfDAO.getAllByIDRole(id1), dgvPer);
                }
            }
        }
예제 #2
0
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            String key = txtSearch.Text;

            if (key.Equals(""))
            {
                GetSource.getTableSource(BillDAOL.READ_ALL, dgvBill);
            }
            else
            {
                List <Object> search = new List <Object>();

                DataGridViewRowCollection rows = dgvBill.Rows;
                foreach (DataGridViewRow row in rows)
                {
                    if (row.Cells[1].Value.ToString().Contains(key))
                    {
                        search.Add(new
                        {
                            id       = row.Cells[0].Value,
                            fullname = row.Cells[1].Value,
                            address  = row.Cells[2].Value,
                            phone    = row.Cells[3].Value,
                            cusid    = row.Cells[4].Value,
                            name     = row.Cells[5].Value,
                            startday = row.Cells[6].Value,
                            paid     = row.Cells[7].Value
                        });
                    }
                }

                GetSource.getTableSourceFromList <Object>(search, dgvBill);
            }
        }
예제 #3
0
        private void cbbPer_SelectedValueChanged(object sender, EventArgs e)
        {
            var id = cbbPer.SelectedValue.ToString();


            int id1 = -1;

            try
            {
                id1 = Convert.ToInt32(id);
            }
            catch (Exception ex) { }


            if (id1 != -1)
            {
                GetSource.getTableSourceFromList <RoleFunc>(rfDAO.getAllByIDRole(id1), dgvPer);
            }
        }