private Boolean saveAction() { // Check input if (checkValideSubmit() == false) { return(false); } FormAddProductObj frmObj = tranfersInput(); if (currentMode == CONS_MODE_ADD) { LogicResult rs = new ProductLogic().addProduct(frmObj); if (rs.severity == Contanst.MSG_ERROR) { MessageBox.Show(rs.msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { return(true); } } if (currentMode == CONS_MODE_EDIT) { LogicResult rs = new ProductLogic().updateProduct(frmObj); if (rs.severity == Contanst.MSG_ERROR) { MessageBox.Show(rs.msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { return(true); } } return(true); }
private FormAddProductObj tranfersInput() { FormAddProductObj obj = new FormAddProductObj(); if (this.comboBoxLoaiSanPham.SelectedIndex < 0) { obj.idSanPhamCha = 0; obj.tenSanPhamCha = this.comboBoxLoaiSanPham.Text; } else { obj.idSanPhamCha = (int)this.comboBoxLoaiSanPham.SelectedValue; obj.tenSanPhamCha = this.comboBoxLoaiSanPham.SelectedText; } obj.idSanPham = this.id.Text != "" ? int.Parse(this.id.Text) : 0; obj.tenSanPham = this.tenSanPham.Text; obj.loaiBia = this.loaiBia.Text; obj.loaiGiay = this.loaiGiay.Text; obj.size = this.size.Text; obj.description = this.description.Text; obj.donGia = float.Parse(this.donGia.Text); obj.numPageDefault = (int)this.numPageDefault.Value; obj.addPageCost = float.Parse(this.addPageCost.Text); return(obj); }