Exemple #1
0
        /// <summary>
        /// 确认保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnOK_Click(object sender, EventArgs e)
        {
            if (cLookEmployee.EditValue == null)
            {
                MessageBox.Show("请输入经办人!");
                return;
            }
            if (cLCarID.EditValue == null)
            {
                MessageBox.Show("请选择车辆!");
                return;
            }
            if (dateRepairDate.EditValue == null)
            {
                MessageBox.Show("请输入维修日期!");
                return;
            }
            if (cLookRepairItem1.EditValue == null)
            {
                MessageBox.Show("请选择维修项目!");
                return;
            }

            CarRepairRecord model = new CarRepairRecord

            {
                CreatID     = ValueConvert.ToInt32(cLookEmployee.EditValue),
                CarID       = ValueConvert.ToInt32(cLCarID.EditValue),
                RepairDate  = ValueConvert.ToDateTime(dateRepairDate.EditValue),
                ItemStr     = ValueConvert.ToInt32(cLookRepairItem1.EditValue),
                RepairKil   = ValueConvert.ToDecimal(textRepairKil.EditValue),
                PartsCost   = ValueConvert.ToDecimal(textPartsCost.EditValue),
                RepairPlace = textRepairPlace.Text,
                Result      = comResult.Text,
                Note        = memoNote.Text,
                OperateID   = Program.CurrentEmployee.EmployeeID,
                OperateTime = DateTime.Now
            };
            bool result = false;

            if (FormState == DS.MSClient.FormState.Modify)
            {
                model.RepairID = curData.RepairID;
                result         = new CarRepairRecordDao().Update(model);
            }
            else
            {
                model.RepairID = new CommonDAO().GetIntUniqueNumber("t_car_repair_record");
                result         = new CarRepairRecordDao().Add(model);
            }
            if (result)
            {
                MessageBox.Show("保存成功");
                this.DialogResult = DialogResult.OK;
            }
        }
 void MainCarApply_Load(object sender, EventArgs e)
 {
     cLCar.BindList();
     cLEmployeeID.BindList();
     _list = new CarRepairRecordDao().GetList();
     if (_list.Count > 0)
     {
         gcApply.DataSource = _list;
         gcApply.RefreshDataSource();
     }
 }