Beispiel #1
0
 public void loadInput()
 {
     if (ProductManage.Input == true)
     {
         productInput               = new Data.ProductInput();
         productInput.ID            = ProductManage.MSHD;
         productInput.MSKH          = SplitMSKH(txtMSNV.Text);
         productInput.MSXE          = txtLicencePlate.Text;
         productInput.Date          = DateTime.Parse(txtDate.Text);
         productInput.ProductName   = txtProductName.Text;
         productInput.ProductPrice  = int.Parse(txtPrice.Text);
         productInput.TruckWeight   = int.Parse(txtTruckofWeight.Text);
         productInput.ProductWeight = int.Parse(txtProductWeight.Text);
         productInput.TotalWeight   = int.Parse(txtTruckofWeight.Text) + int.Parse(txtProductWeight.Text);
         productInput.TotalAmount   = Int32.Parse(txtProductWeight.Text) * Int32.Parse(txtPrice.Text);
         productInput.ProductPrice  = Int32.Parse(txtPrice.Text);
     }
     else
     {
         productOutput               = new Data.ProductOutput();
         productOutput.ID            = ProductManage.MSHD;
         productOutput.MSKH          = SplitMSKH(txtMSNV.Text);
         productOutput.MSXE          = txtLicencePlate.Text;
         productOutput.Date          = DateTime.Parse(txtDate.Text);
         productOutput.ProductName   = txtProductName.Text;
         productOutput.ProductPrice  = int.Parse(txtPrice.Text);
         productOutput.TruckWeight   = int.Parse(txtTruckofWeight.Text);
         productOutput.ProductWeight = int.Parse(txtProductWeight.Text);
         productOutput.TotalWeight   = int.Parse(txtTruckofWeight.Text) + int.Parse(txtProductWeight.Text);
         productOutput.TotalAmount   = Int32.Parse(txtProductWeight.Text) * Int32.Parse(txtPrice.Text);
         productOutput.ProductPrice  = Int32.Parse(txtPrice.Text);
     }
 }
 private void frmEditProduct_Load(object sender, EventArgs e)
 {
     this.MaximizeBox = false;
     txtProductName.Focus();
     if (ProductManage.Input == true)
     {
         int ID = ProductManage.MSHD;
         productInput = productInputBO.GetData(u => u.isDelete == false && u.ID == ID, u => u.Customer).Single();
         loadProductTypeInput();
         loadProductPriceInput();
         loadLicencePlateInput(productInput.MSKH);
         txtName.Text          = productInput.Customer.Name;
         txtDate.Text          = productInput.Date.Value.ToShortDateString();
         txtMSNV.Text          = "KH" + productInput.MSKH.ToString("d6");
         txtMSHD.Text          = "HD" + productInput.ID.ToString("d6");
         txtProductName.Text   = productInput.ProductName;
         txtProductWeight.Text = productInput.ProductWeight.ToString();
         txtTruckofWeight.Text = productInput.TruckWeight.ToString();
         txtLicencePlate.Text  = productInput.MSXE.ToString();
         txtAll.Text           = productInput.TotalWeight.ToString();
         txtPrice.Text         = productInput.ProductPrice.ToString();
     }
     else
     {
         int ID = ProductManage.MSHD;
         productOutput = productOutputBO.GetData(u => u.isDelete == false && u.ID == ID, u => u.Customer).Single();
         loadProductTypeOutput();
         loadProductPriceOutput();
         loadLicencePlateOutput(productOutput.MSKH.Value);
         txtName.Text          = productOutput.Customer.Name;
         txtDate.Text          = productOutput.Date.Value.ToShortDateString();
         txtMSNV.Text          = "KH" + productOutput.MSKH.Value.ToString("d6");
         txtMSHD.Text          = "HD" + productOutput.ID.ToString("d6");
         txtProductName.Text   = productOutput.ProductName;
         txtProductWeight.Text = productOutput.ProductWeight.ToString();
         txtTruckofWeight.Text = productOutput.TruckWeight.ToString();
         txtLicencePlate.Text  = productOutput.MSXE.ToString();
         txtAll.Text           = productOutput.TotalWeight.ToString();
         txtPrice.Text         = productOutput.ProductPrice.ToString();
     }
 }