Exemplo n.º 1
0
        //保存
        private void AddVehicleDispatch()
        {
            ObservableCollection <T_OA_VEHICLEDISPATCHRECORD> lst = new ObservableCollection <T_OA_VEHICLEDISPATCHRECORD>();

            T_OA_VEHICLEDISPATCHRECORD r = dg.SelectedItem as T_OA_VEHICLEDISPATCHRECORD;

            r.NUM = txtNum.Text;

            r.T_OA_VEHICLEDISPATCHDETAIL.T_OA_VEHICLEDISPATCH.T_OA_VEHICLE = cmbVehicleInfo.SelectedItem as T_OA_VEHICLE;

            r.STARTTIME   = dtiStartDate.DateTimeValue;
            r.ENDTIME     = dtiEndDate.DateTimeValue;
            r.TEL         = txtTel.Text;
            r.ROUTE       = txtRoute.Text;
            r.FUEL        = decimal.Parse(txtFuel.Text);
            r.RANGE       = decimal.Parse(txtRange2.Text);
            r.ISCHARGE    = (bool)ckbHasFee.IsChecked ? "1" : "0";
            r.CONTENT     = txtREMARK.Text;
            r.CHARGEMONEY = decimal.Parse(txtFee.Text);
            r.T_OA_VEHICLEDISPATCHDETAIL.T_OA_VEHICLEDISPATCH.DRIVER = txtDriverID.Text;
            lst.Add(r);

            if (r.VEHICLEDISPATCHRECORDID == null)
            {
                r.VEHICLEDISPATCHRECORDID = System.Guid.NewGuid().ToString();
                _VM.Add_VDRecordAsync(lst);
            }
            else
            {
                _VM.Upd_VDRecordAsync(lst);
            }

            // _record = r;
        }