コード例 #1
0
        protected override void EnterField(int fn)
        {
            Field  f = (Field)fields[fn];
            string s = f.ToString();
            int    ol;

            try
            {
                if (fn < 10)
                {
                    switch (fn)
                    {
                    case 1: did = int.Parse(s);
                        FetchDistrict(ref s);
                        break;

                    case 2: cid = int.Parse(s);
                        FetchCustomer(ref s);
                        break;

                    case 7: ol_cnt = int.Parse(s);
                        DoOLCount(ref s);
                        for (int j = 0; j < ol_cnt; j++)
                        {
                            ols[j] = new OrderLine();
                        }
                        break;
                    }
                }
                else
                {
                    ol = (fn - 10) / 8;
                    fn = (fn - 10) % 8;
                    OrderLine o = ols[ol];
                    switch (fn)
                    {
                    case 0: o.ol_supply_w_id = int.Parse(s);
                        break;

                    case 1: o.oliid = int.Parse(s);
                        FetchItemData(ol, ref s);
                        break;

                    case 3: o.ol_quantity = int.Parse(s);
                        DoOLQuantity(ol, ref s);
                        if (ol == ol_cnt - 1)
                        {
                            DoTotal();
                        }
                        break;
                    }
                }
                status.Text = s;
            }
            catch (Exception ex) {
                status.Text = ex.Message;
                Form1.RecordResponse(ex, fid, tid);
                tr.Rollback();
                Form1.wconflicts++;
            }
            Invalidate(true);
        }