/// <summary> /// /// </summary> /// <param name="fl"></param> /// <returns></returns> private bool CheckSelectedFlow(tblFlow fl) { if (fl == null) { NUnit.UiKit.UserMessage.DisplayFailure(Strings.SelectMTFirst); } return fl != null; }
/// <summary> /// /// </summary> /// <returns></returns> public static tblFlow Create() { tblFlow f = new tblFlow(); f.tblIntroducer = IntroducerFactory.Create(); f.tblMaintain = MaintainFactory.Create(); f.SetFLStatus(FLStatus.New); //f.fl_status Debug.Assert(f.GetFLStatus() == FLStatus.New); return f; }
public static FlowData[] Convert(tblFlow[] flArray) { FlowData[] array = new FlowData[flArray.Length]; for (int i = 0; i < flArray.Length; i++) { tblFlow fl = flArray[i]; FlowData f = Convert(fl); array[i] = f; } return array; }
public static FlowData Convert(tblFlow fl) { FlowData f = new FlowData(); f.FlID = fl.fl_id; f.FlStatus = fl.GetFLStatusText(); tblIntroducer it = fl.tblIntroducer; f.ItAddress = it.it_address; f.ItName = it.it_name; f.ItPhone = it.it_phone ; f.ItRemark = it.it_remark; tblMaintain mt = fl.tblMaintain ; f.MtBeginDT = mt.mt_begin_dt; f.MtContent = mt.mt_content; f.MTCreateDT = mt.mt_create_dt; f.MtLocation = mt.mt_location; f.MtPoseDT = mt.mt_pose_dt; f.MtRemark = mt.mt_remark; f.MtTimeoutDT = mt.mt_timeout_dt; f.MtOperatorName = mt.tblOperator.op_name; f.MtLevel = mt.tblMaintainLevel.ml_name; tblReceive rc = fl.tblReceive; if (rc != null) { f.RcDT = fl.tblReceive.rc_dt; f.RcOperatorName = fl.tblReceive.tblOperator.op_name; } tblReply rp = fl.tblReply; if (rp != null) { f.RpContent = rp.rp_content; f.RpEndDT = (DateTime)rp.rp_end_dt; f.RpRemark = rp.rp_remark; f.RpWorker = rp.rp_worker; } f.TblFlow = fl; return f; }
/// <summary> /// /// </summary> private void UpdateFL() { using (var db = DBFactory.GetBxdbDataContext()) { tblFlow old = this.FL; tblFlow updateFL = db.tblFlow.First(c => c.fl_id == old.fl_id); updateFL.SetFLStatus(old.GetFLStatus()); if (updateFL.GetFLStatus() == FLStatus.Closed) { updateFL.SetFLStatus(FLStatus.Finally); } FLStatus status = updateFL.GetFLStatus(); if (status == FLStatus.New || status == FLStatus.Created) { updateFL.tblIntroducer = ucIt1.UpdateIntroducer(db, updateFL.tblIntroducer); updateFL.tblMaintain = ucMt1.UpdateMaintain(db, updateFL.tblMaintain); } if (status == FLStatus.Received || status == FLStatus.Completed) { updateFL.tblReceive = ucRc1.UpdateReceive(db, updateFL.tblReceive); updateFL.tblReply = ucRp1.UpdateReply(db, updateFL.tblReply); } try { db.SubmitChanges(); this.DialogResult = DialogResult.OK; NUnit.UiKit.UserMessage.DisplayInfo(Strings.SaveSuccess); } catch (System.Data.Linq.ChangeConflictException ee) { foreach (ObjectChangeConflict occ in db.ChangeConflicts) { Dump(occ); occ.Resolve(RefreshMode.OverwriteCurrentValues); } NUnit.UiKit.UserMessage.DisplayFailure(ee.Message); //this._oldFLStatus = this.FL.GetFLStatus(); //this.UpdateView(); this.FL = this.FL; } } }
/// <summary> /// /// </summary> private void InsertFL() { using (var db = DBFactory.CreateDataContext()) { tblFlow newFL = new tblFlow(); newFL.fl_status = (int)FLStatus.Created; newFL.tblIntroducer = ucIt1.GetIntroducer(db); newFL.tblMaintain = ucMt1.GetMaintain(db); newFL.tblReceive = ucRc1.Rc; newFL.tblReply = ucRp1.Reply; if (newFL.fl_id == 0) { db.tblFlow.InsertOnSubmit(newFL); } try { db.SubmitChanges(); //Debug.Assert(this.FL.fl_id != 0); this.DialogResult = DialogResult.OK; } catch (Exception ex) { NUnit.UiKit.UserMessage.DisplayFailure(ex.Message); } } }