private void insertItem(string category, string itemCode, string itemName) { //Add data itemBLL u = new itemBLL(); u.item_cat = category; u.item_code = itemCode; u.item_name = itemName; u.item_material = ""; u.item_mb = ""; u.item_color = ""; u.item_quo_ton = 0; u.item_best_ton = 0; u.item_pro_ton = 0; u.item_quo_ct = 0; u.item_pro_ct_from = 0; u.item_pro_ct_to = 0; u.item_capacity = 0; u.item_quo_pw_pcs = 0; u.item_quo_rw_pcs = 0; u.item_pro_pw_pcs = 0; u.item_pro_rw_pcs = 0; u.item_pro_pw_shot = 0; u.item_pro_rw_shot = 0; u.item_pro_cooling = 0; u.item_wastage_allowed = 0.05f; u.item_assembly = 0; u.item_production = 0; u.item_added_date = DateTime.Now; u.item_added_by = MainDashboard.USER_ID; //Inserting Data into Database bool success = dalItem.NewInsert(u); //If the data is successfully inserted then the value of success will be true else false if (success) { //Data Successfully Inserted //MessageBox.Show("Item successfully created"); } else { //Failed to insert data MessageBox.Show("Failed to add new item"); } }
private void insertItem() { //Add data u.item_cat = cmbCat.Text; u.item_code = txtItemCode.Text; u.item_name = txtItemName.Text; u.item_material = cmbMaterialType.Text; u.item_mb = cmbMasterBatch.Text; u.item_mb_rate = Convert.ToSingle(txtMBRate.Text); u.item_color = txtColor.Text; u.item_quo_ton = tool.Int_TryParse(txtQuoTon.Text); u.item_best_ton = tool.Int_TryParse(txtBestTon.Text); u.item_pro_ton = tool.Int_TryParse(txtProTon.Text); u.item_quo_ct = tool.Int_TryParse(txtQuoCT.Text); u.item_pro_ct_from = tool.Int_TryParse(txtProCTFrom.Text); u.item_pro_ct_to = tool.Int_TryParse(txtProCTTo.Text); u.item_capacity = tool.Int_TryParse(txtCapacity.Text); u.item_quo_pw_pcs = tool.Float_TryParse(txtQuoPWPcs.Text); u.item_quo_rw_pcs = tool.Float_TryParse(txtQuoRWPcs.Text); u.item_pro_pw_pcs = tool.Float_TryParse(txtProPWPcs.Text); u.item_pro_rw_pcs = tool.Float_TryParse(txtProRWPcs.Text); u.item_pro_pw_shot = tool.Float_TryParse(txtProPWShot.Text); u.item_pro_rw_shot = tool.Float_TryParse(txtProRWShot.Text); u.item_pro_cooling = tool.Int_TryParse(txtProCooling.Text); if (float.TryParse(txtWastageAllowed.Text, out float i)) { if (i <= 0) { u.item_wastage_allowed = 0.05f; } else { u.item_wastage_allowed = i; } } else { u.item_wastage_allowed = 0.05f; } if (cbAssembly.Checked) { u.item_assembly = 1; } else { u.item_assembly = 0; } if (cbProduction.Checked) { u.item_production = 1; } else { u.item_production = 0; } u.item_added_date = DateTime.Now; u.item_added_by = MainDashboard.USER_ID; //Inserting Data into Database bool success = dalItem.NewInsert(u); //If the data is successfully inserted then the value of success will be true else false if (success == true) { //Data Successfully Inserted //MessageBox.Show("Item successfully created"); this.Close(); } else { //Failed to insert data MessageBox.Show("Failed to add new item"); } }
private void insertItem() { //Add data itemBLL u = new itemBLL(); u.item_cat = cmbCat.Text; if (!join) { itemParentCode = txtItemCode.Text; parentCust = cmbCust.Text; } else { itemChildCode = txtItemCode.Text; } u.item_code = txtItemCode.Text; u.item_name = txtItemName.Text; u.item_material = cmbMat.Text; u.item_mb = cmbMB.Text; u.item_color = txtColor.Text; u.item_quo_ton = 0; u.item_best_ton = 0; u.item_pro_ton = 0; u.item_quo_ct = 0; u.item_pro_ct_from = 0; u.item_pro_ct_to = 0; u.item_capacity = tool.Int_TryParse(txtCapacity.Text); u.item_quo_pw_pcs = tool.Float_TryParse(txtQuoPWpcs.Text); u.item_quo_rw_pcs = tool.Float_TryParse(txtQuoRWpcs.Text); u.item_pro_pw_pcs = tool.Float_TryParse(txtPWpcs.Text); u.item_pro_rw_pcs = tool.Float_TryParse(txtRWpcs.Text); u.item_pro_pw_shot = tool.Float_TryParse(txtPWshot.Text); u.item_pro_rw_shot = tool.Float_TryParse(txtRWshot.Text); u.item_pro_cooling = 0; u.item_wastage_allowed = 0.05f; if (cbAssembly.Checked) { u.item_assembly = 1; } else { u.item_assembly = 0; } if (cbProduction.Checked) { u.item_production = 1; } else { u.item_production = 0; } u.item_added_date = DateTime.Now; u.item_added_by = MainDashboard.USER_ID; //Inserting Data into Database bool success = dalItem.NewInsert(u); //If the data is successfully inserted then the value of success will be true else false if (success) { //Data Successfully Inserted //MessageBox.Show("Item successfully created"); if (!join) { pairCustomer(); } } else { //Failed to insert data MessageBox.Show("Failed to add new item"); } }