private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtEngName.Text)) { CommonTool.ShowMessage("English Name can not NULL!"); return; } if (string.IsNullOrEmpty(txtOtherName.Text)) { CommonTool.ShowMessage("Other Name can not NULL!"); return; } TaMenuItemOtherChoiceInfo taMenuItemOtherChoiceInfo = new TaMenuItemOtherChoiceInfo(); taMenuItemOtherChoiceInfo.MiEngName = txtEngName.Text; taMenuItemOtherChoiceInfo.MiOtherName = txtOtherName.Text; taMenuItemOtherChoiceInfo.MiPrice = string.IsNullOrEmpty(txtAddPrice.Text) ? "0.00" : txtAddPrice.Text; taMenuItemOtherChoiceInfo.IsAutoAppend = chkEditAppend.Checked ? "Y" : "N"; taMenuItemOtherChoiceInfo.IsEnableChoice = chkEditEnableChoice.Checked ? "Y" : "N"; taMenuItemOtherChoiceInfo.MiID = miID; taMenuItemOtherChoiceInfo.MiType = miType; try { if (isAdd) { _control.AddEntity(taMenuItemOtherChoiceInfo); isAdd = false; } else { taMenuItemOtherChoiceInfo.ID = Convert.ToInt32(gvOtherChoice.GetRowCellValue(gvOtherChoice.FocusedRowHandle, "ID")); _control.UpdateEntity(taMenuItemOtherChoiceInfo); } BindData(miType); } catch (Exception ex) { LogHelper.Error(this.Name, ex); } CommonTool.ShowMessage("Save successful!"); }
private void btnOK_Click(object sender, EventArgs e) { new SystemData().GetTaMenuItemOtherChoice(); var lstMiOther = CommonData.TaMenuItemOtherChoice.Where(s => s.MiID == miID && s.MiType == miOtherType); foreach (var taMiOther in lstMiOther) { try { TaMenuItemOtherChoiceInfo taMenuItemOtherChoiceInfo = new TaMenuItemOtherChoiceInfo(); taMenuItemOtherChoiceInfo.MiEngName = taMiOther.MiEngName; taMenuItemOtherChoiceInfo.MiOtherName = taMiOther.MiOtherName; taMenuItemOtherChoiceInfo.MiPrice = taMiOther.MiPrice; taMenuItemOtherChoiceInfo.IsAutoAppend = taMiOther.IsAutoAppend; taMenuItemOtherChoiceInfo.IsEnableChoice = taMiOther.IsEnableChoice; taMenuItemOtherChoiceInfo.MiType = miOtherType; taMenuItemOtherChoiceInfo.OptionNum = taMiOther.OptionNum; int[] iSelectRows = gvMenuItem.GetSelectedRows(); foreach (int rows in iSelectRows) { taMenuItemOtherChoiceInfo.MiID = Convert.ToInt32(gvMenuItem.GetRowCellValue(rows, "ID")); _control.AddEntity(taMenuItemOtherChoiceInfo); } } catch (Exception ex) { LogHelper.Error(this.Name, ex); } } CommonTool.ShowMessage("Save successful!"); this.DialogResult = DialogResult.OK; Hide(); }