示例#1
0
        private void btn_Active_Click(object sender, EventArgs e)
        {
            string license = CreateLicense().Trim();
            string getKey  = txt_key.Text.Trim();

            if (license == getKey)
            {
                Active();
                ProductKeyDB context = new ProductKeyDB();
                MaSP         mSP     = new MaSP()
                {
                    MaKichHoat = getKey,
                };
                MaSP mSPQ = context.MaSP.FirstOrDefault(p => p.MaKichHoat == getKey);
                if (mSPQ == null)
                {
                    context.MaSP.Add(mSP);
                    context.SaveChanges();
                }
            }
            else
            {
                MessageBox.Show("Mã kích hoạt không hợp lệ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
 private void btnDeleteProduct_Click(object sender, EventArgs e)
 {
     if (CheckBill())
     {
         foreach (DataGridViewCell oneCell in dgvDachon.SelectedCells)
         {
             if (oneCell.Selected)
             {
                 ChiTietHoaDon ct = _service.getBillDetail(txtIDBilltoDetail.Text, MaSP.ToString());
                 _service.DeleteBillDetail(ct);
                 dgvDachon.Rows.RemoveAt(oneCell.RowIndex);
             }
         }
         txtTotaltoFake.Text = String.Format("{0:#,0 vnđ}", calculatedBill());
         HoaDon billtoUpdate = _service.getBill(txtIDBilltoDetail.Text);
         billtoUpdate.TongTien  = calculatedBill();
         billtoUpdate.TrangThai = "Đang chờ ";
         _service.EditBill(billtoUpdate);
     }
 }