Beispiel #1
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textADA.Text == "")
     {
         MessageBox.Show(Lan.g(this, "Code cannot be left blank."));
         listConditions.SelectedIndex = -1;
         FillList();
         return;
     }
     AutoCodeItemCur.CodeNum = ProcedureCodes.GetCodeNum(textADA.Text);
     if (IsNew)
     {
         AutoCodeItems.Insert(AutoCodeItemCur);
     }
     else
     {
         AutoCodeItems.Update(AutoCodeItemCur);
     }
     AutoCodeConds.DeleteForItemNum(AutoCodeItemCur.AutoCodeItemNum);
     for (int i = 0; i < listConditions.SelectedIndices.Count; i++)
     {
         AutoCodeCond AutoCodeCondCur = new AutoCodeCond();
         AutoCodeCondCur.AutoCodeItemNum = AutoCodeItemCur.AutoCodeItemNum;
         AutoCodeCondCur.Cond            = (AutoCondition)listConditions.SelectedIndices[i];
         AutoCodeConds.Insert(AutoCodeCondCur);
     }
     DialogResult = DialogResult.OK;
 }
Beispiel #2
0
        private void butDelete_Click(object sender, System.EventArgs e)
        {
            if (tbAutoItem.SelectedRow == -1)
            {
                MessageBox.Show(Lan.g(this, "Please select an item first."));
                return;
            }
            AutoCodeItem AutoCodeItemCur = listForCode[tbAutoItem.SelectedRow];

            AutoCodeConds.DeleteForItemNum(AutoCodeItemCur.AutoCodeItemNum);
            AutoCodeItems.Delete(AutoCodeItemCur);
            FillTable();
        }
Beispiel #3
0
 private void FormAutoCodeEdit_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (DialogResult == DialogResult.OK)
     {
         return;
     }
     if (IsNew)
     {
         for (int i = 0; i < AutoCodeItems.ListForCode.Length; i++)
         {
             AutoCodeItem AutoCodeItemCur = AutoCodeItems.ListForCode[i];
             AutoCodeConds.DeleteForItemNum(AutoCodeItemCur.AutoCodeItemNum);
             AutoCodeItems.Delete(AutoCodeItemCur);
         }
         AutoCodes.Delete(AutoCodeCur);
     }
 }