private void butOK_Click(object sender, System.EventArgs e) { if (textName.Text == "") { MsgBox.Show(this, "Name required."); return; } DefCur.ItemName = textName.Text; string itemVal = ""; if (checkX.Checked) { itemVal += "X"; } if (checkF.Checked) { itemVal += "F"; } if (checkP.Checked) { itemVal += "P"; } if (checkS.Checked) { itemVal += "S"; } if (checkT.Checked) { itemVal += "T"; } DefCur.ItemValue = itemVal; DefCur.IsHidden = checkHidden.Checked; if (IsNew) { Defs.Insert(DefCur); } else { Defs.Update(DefCur); } DialogResult = DialogResult.OK; }
public static bool UpClick(ODGrid gridDefs, List <Def> listDefsCur) { if (gridDefs.GetSelectedIndex() == -1) { MessageBox.Show(Lan.g("Defs", "Please select an item first.")); return(false); } if (gridDefs.GetSelectedIndex() == 0) { return(false); } Def defSelected = listDefsCur[gridDefs.GetSelectedIndex()]; Def defAbove = listDefsCur[gridDefs.GetSelectedIndex() - 1]; defSelected.ItemOrder--; defAbove.ItemOrder++; Defs.Update(defSelected); Defs.Update(defAbove); return(true); }
public static bool DownClick(ODGrid gridDefs) { if (gridDefs.GetSelectedIndex() == -1) { MessageBox.Show(Lan.g("Defs", "Please select an item first.")); return(false); } if (gridDefs.GetSelectedIndex() == gridDefs.ListGridRows.Count - 1) { return(false); } Def defSelected = (Def)gridDefs.ListGridRows[gridDefs.GetSelectedIndex()].Tag; Def defBelow = (Def)gridDefs.ListGridRows[gridDefs.GetSelectedIndex() + 1].Tag; int indexDefSelectedItemOrder = defSelected.ItemOrder; defSelected.ItemOrder = defBelow.ItemOrder; defBelow.ItemOrder = indexDefSelectedItemOrder; Defs.Update(defSelected); Defs.Update(defBelow); return(true); }
private void butOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textName.Text.Trim())) { MsgBox.Show(this, "Reason required."); return; } if (_apptTypeCur == null) { MsgBox.Show(this, "Appointment Type required."); return; } _defCur.ItemName = PIn.String(textName.Text); if (_defCur.IsNew) { Defs.Insert(_defCur); } else { Defs.Update(_defCur); } DefLinks.SetFKeyForDef(_defCur.DefNum, _apptTypeCur.AppointmentTypeNum, DefLinkType.AppointmentType); DialogResult = DialogResult.OK; }