Example #1
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in dataGridViewLicense.SelectedRows)
     {
         LICENSE_NUMBER = row.Cells[1].Value.ToString();
     }
     //     MessageBox.Show(LICENSE_NUMBER);
     if (LICENSE_NUMBER == string.Empty || LICENSE_NUMBER == null)
     {
     }
     else
     {
         var result = MetroMessageBox.Show(this, "Are you sure to delete it?", "Delete", MessageBoxButtons.OKCancel);
         if (result == System.Windows.Forms.DialogResult.OK)
         {
             using (LicenseDataContext _context = new LicenseDataContext())
             {
                 TBL_LICENSE license = (from l in _context.TBL_LICENSEs
                                        where l.ACCOUNT_NO == LICENSE_NUMBER
                                        select l).FirstOrDefault();
                 license.IS_ACTIVE = false;
                 _context.SubmitChanges();
             }
             using (TBL_LICENSE_DATA_ACCESS lda = new TBL_LICENSE_DATA_ACCESS())
             {
                 dataGridViewLicense.DataSource = lda.ShowLicense();
             }
             GC.Collect();
         }
     }
     GC.Collect();
 }
Example #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            //FormUpdateLicense frmupdate = new FormUpdateLicense();

            foreach (DataGridViewRow row in dataGridViewLicense.SelectedRows)
            {
                LICENSE_NUMBER = row.Cells[1].Value.ToString();
            }
            //   MessageBox.Show(LICENSE_NUMBER.ToString());
            if (LICENSE_NUMBER != string.Empty)
            {
                FormUpdateLicense update = new FormUpdateLicense();
                update.ShowDialog(this);
            }
            else
            {
            }
            using (TBL_LICENSE_DATA_ACCESS lda = new TBL_LICENSE_DATA_ACCESS())
            {
                dataGridViewLicense.DataSource = lda.ShowLicense();
            }
            btnEdit.UseSelectable = false;
            txtSearch.Clear();
            GC.Collect();
        }
Example #3
0
 public void ControlLicense_Load(object sender, EventArgs e)
 {
     LICENSE_NUMBER = string.Empty;
     using (TBL_LICENSE_DATA_ACCESS lda = new TBL_LICENSE_DATA_ACCESS())
     {
         dataGridViewLicense.DataSource = lda.ShowLicense();
     };
     GC.Collect();
 }
Example #4
0
        private void btnAddNew_Click(object sender, EventArgs e)
        {
            FormAddNewLicense add = new FormAddNewLicense();

            add.ShowDialog(this);
            using (TBL_LICENSE_DATA_ACCESS lda = new TBL_LICENSE_DATA_ACCESS())
            {
                dataGridViewLicense.DataSource = lda.ShowLicense();
            }
            btnAddNew.UseSelectable = false;
            txtSearch.Clear();
            GC.Collect();
        }
Example #5
0
 private void txtSearch_TextChanged(object sender, EventArgs e)
 {
     if (txtSearch.Text.Length > 0)
     {
         using (TBL_LICENSE_DATA_ACCESS lda = new TBL_LICENSE_DATA_ACCESS())
         {
             dataGridViewLicense.DataSource = lda.Search(txtSearch.Text);
         }
     }
     else
     {
         using (TBL_LICENSE_DATA_ACCESS lda = new TBL_LICENSE_DATA_ACCESS())
         {
             dataGridViewLicense.DataSource = lda.ShowLicense();
         }
     }
 }