Beispiel #1
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();
        }
Beispiel #2
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();
 }
Beispiel #3
0
 private void FormEditSpecialLicense_Load(object sender, EventArgs e)
 {
     try
     {
         if (ControlLicenseSpecial.COLOR_ID == 1)
         {
             cboColor.SelectedIndex = 0;
         }
         else if (ControlLicenseSpecial.COLOR_ID == 2)
         {
             cboColor.SelectedIndex = 1;
         }
         else if (ControlLicenseSpecial.COLOR_ID == 3)
         {
             cboColor.SelectedIndex = 2;
         }
         using (TBL_LICENSE_DATA_ACCESS lda = new TBL_LICENSE_DATA_ACCESS())
         {
             foreach (var item in lda.ShowLicenseByID(ControlLicenseSpecial.LICENSE_ID))
             {
                 txtAccountName.Text   = item.ACCOUNT_NAME;
                 txtLicenseNumber.Text = item.ACCOUNT_NO;
                 LICENSE_ID            = item.LICENSE_ID;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
     }
 }
Beispiel #4
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();
 }
 private void FormMain_Load(object sender, EventArgs e)
 {
     btnMenuLicense.Enabled = false;
     lda      = new TBL_LICENSE_DATA_ACCESS();
     clm      = new ControlLicenseMenuLeft();
     cl       = new ControlLicense();
     clm.Dock = DockStyle.Fill;
     panelLeft.Controls.Add(clm);
     cl.Dock = DockStyle.Fill;
     panelContainer.Controls.Add(cl);
     GC.Collect();
 }
Beispiel #6
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();
        }
 private void FormLicenseAvailableBySeason_Load(object sender, EventArgs e)
 {
     try
     {
         using (TBL_LICENSE_DATA_ACCESS lda = new TBL_LICENSE_DATA_ACCESS())
         {
             dataGridViewLicense.DataSource = lda.DisplayAvailableLicenseBySeasonID(ControlWork.SEASON_ID);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        private bool invalid()
        {
            using (TBL_LICENSE_DATA_ACCESS lda = new TBL_LICENSE_DATA_ACCESS())
            {
                foreach (var item in lda.CheckLicenseNumber(txtLicenseNumber.Text))
                {
                    LICENSE_NUMBER = item.ACCOUNT_NO.ToString();
                }
            }
            bool flag = false;

            if (this.txtLicenseNumber.Text == LICENSE_NUMBER)
            {
                this.txtLicenseNumber.SetValidation(string.Format(Properties.Resources.LICENSENUMBER_ADREADY, this.label1.Text));
                flag = true;
            }
            if (this.txtLicenseNumber.Text == "")
            {
                this.txtLicenseNumber.SetValidation(string.Format(Properties.Resources.REQUIRED_LICENSENUMBER, this.label1.Text));
                flag = true;
            }
            if (this.txtAccountName.Text == "")
            {
                this.txtAccountName.SetValidation(string.Format(Properties.Resources.REQUIRED_ACCOUNTNAME, this.label1.Text));
                flag = true;
            }
            if (this.txtProvince.Text == "")
            {
                this.txtProvince.SetValidation(string.Format(Properties.Resources.REQUIRED_PROVINCE_NAME, this.label1.Text));
                flag = true;
            }
            if (this.txtContactName.Text == "")
            {
                this.txtContactName.SetValidation(string.Format(Properties.Resources.REQUIRED_CONTACTNAME, this.label1.Text));
                flag = true;
            }
            if (this.txtPhone.Text == "")
            {
                this.txtPhone.SetValidation(string.Format(Properties.Resources.REQUIRED_PHONE, this.label1.Text));
                flag = true;
            }
            if (this.txtAddress.Text == "")
            {
                this.txtAddress.SetValidation(string.Format(Properties.Resources.REQUIRED_ADDRESS, this.label1.Text));
                flag = true;
            }

            return(flag);
        }
 private void dataGridViewLicense_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     using (TBL_LICENSE_DATA_ACCESS lda = new TBL_LICENSE_DATA_ACCESS())
     {
         foreach (DataGridViewRow row in dataGridViewLicense.SelectedRows)
         {
             ID = Convert.ToInt32(row.Cells["L_ID"].Value);
         }
         foreach (var item in lda.ShowLicenseByID(ID))
         {
             txtAccountName.Text   = item.ACCOUNT_NAME;
             txtLicenseNumber.Text = item.ACCOUNT_NO;
             LICENSE_ID            = item.LICENSE_ID;
         }
     }
 }
Beispiel #10
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();
         }
     }
 }