private void btnSave_Click(object sender, RoutedEventArgs e) { var op = IngredientBLL.Update(new Ingredient() { Name = txtName.Text, UnitMeasure = txtUnitofMeasure.Text }); if (op.Code != "200") { MessageBox.Show("Error : " + op.Message); } else { MessageBox.Show("Succesfully Update"); } myParentWindow.showData(); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { DataTable dtCheck = ingredientBLL.GetMeasureDetailById(this.measureId, cbbIngredient.SelectedValue.ToString()); MeasureDetail obj = new MeasureDetail(); obj.MeasureId = this.measureId; obj.IngredientId = cbbIngredient.SelectedValue.ToString(); obj.MeasureQty = txtQty.Text; if (dtCheck != null) { if (dtCheck.Rows.Count != 0) { if (CustomMessageBox.MessageBox.ShowCustomMessageBox("Bạn có muốn cập nhật nguyên liệu này cho sản phẩm?", Common.clsLanguages.GetResource("Information"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.YESNO) == DialogResult.Yes) { // Update int i = ingredientBLL.Update(obj); if (i == 1) { CustomMessageBox.MessageBox.ShowCustomMessageBox("Cập nhật nguyên liệu thành công", Common.clsLanguages.GetResource("Information"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK); } else { CustomMessageBox.MessageBox.ShowCustomMessageBox("Cập nhật nguyên liệu thất bại", Common.clsLanguages.GetResource("Information"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK); } } } else { if (CustomMessageBox.MessageBox.ShowCustomMessageBox("Bạn có muốn thêm nguyên liệu mới cho sản phẩm?", Common.clsLanguages.GetResource("Information"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.YESNO) == DialogResult.Yes) { // Insert int i = ingredientBLL.Insert(obj); if (i == 1) { CustomMessageBox.MessageBox.ShowCustomMessageBox("Thêm mới nguyên liệu thành công", Common.clsLanguages.GetResource("Information"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK); } else { CustomMessageBox.MessageBox.ShowCustomMessageBox("Thêm mới nguyên liệu thất bại", Common.clsLanguages.GetResource("Information"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK); } } } } }