Example #1
0
 public void loadInput()
 {
     product               = new Data.ProductInput();
     product.ID            = GetIDMSHD();
     product.MSKH          = SplitMSKH(txtMSKH.Text);
     product.MSXE          = txtLicencePlate.Text;
     product.Date          = txtDate.Value.Date;
     product.ProductName   = txtProductName.Text;
     product.ProductPrice  = double.Parse(txtPrice.Text);
     product.TruckWeight   = double.Parse(txtTruckofWeight.Text);
     product.ProductWeight = double.Parse(txtProductWeight.Text);
     product.TotalWeight   = double.Parse(txtTruckofWeight.Text) + double.Parse(txtProductWeight.Text);
     product.TotalAmount   = double.Parse(txtProductWeight.Text) * double.Parse(txtPrice.Text);
     product.ProductPrice  = double.Parse(txtPrice.Text);
 }
Example #2
0
 private void btnRemove_Click(object sender, EventArgs e)
 {
     if (currentlyRows < dataDS.Rows.Count - 1)
     {
         product = new Data.ProductInput();
         int ID = int.Parse(dataDS.Rows[currentlyRows].Cells[0].Value.ToString().Split('H')[1]);
         product = list.Find(u => u.ID == ID);
         string       masseage = "Bạn có muốn xóa hóa đơn " + "HK" + product.ID.ToString("D6").Trim() + " không?";
         string       Title    = "Chú ý";
         DialogResult result   = MessageBox.Show(masseage, Title, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
         if (result == DialogResult.Yes)
         {
             productInputBO.isDelete(ID);
             loadDG();
         }
     }
 }
Example #3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            product = new Data.ProductInput();
            if (Validation())
            {
                int maxMount = int.Parse(txtProductWeight.Text) * int.Parse(txtPrice.Text);
                if (maxMount < 0)
                {
                    MessageBox.Show("Trọng lượng không hợp lệ hoặc quá tải!");
                }
                else
                {
                    product.ID          = fladID;
                    product.MSKH        = SplitMSKH(txtMSKH.Text);
                    product.MSXE        = txtLicencePlate.Text;
                    product.Date        = txtDate.Value.Date;
                    product.ProductName = txtProductName.Text;

                    product.ProductPrice  = double.Parse(txtPrice.Text);
                    product.TruckWeight   = double.Parse(txtTruckofWeight.Text);
                    product.ProductWeight = double.Parse(txtProductWeight.Text);
                    product.TotalWeight   = double.Parse(txtTruckofWeight.Text) + double.Parse(txtProductWeight.Text);
                    product.TotalAmount   = double.Parse(txtProductWeight.Text) * double.Parse(txtPrice.Text);
                    product.ProductPrice  = double.Parse(txtPrice.Text);
                    productInputBO.Update(product);
                    loadDG();
                    RefreshAdd();
                    txtHoten.Focus();
                    btnEdit.Visible   = false;
                    btnThem.Visible   = true;
                    btnRemove.Enabled = true;
                }
            }
            else
            {
                txtLicencePlate.Focus();
                MessageBox.Show("Vui lòng điền đúng thông tin");
            }
        }