void ShowWrench(wrenchinfo w) { if (w == null) { return; } if (w.wrench == null) { return; } this.wrenchbarcode.Text = w.wrench.wrenchBarCode; this.wrenchcode.Text = w.wrench.wrenchCode; this.setvalue.Text = w.wrench.targetvalue.ToString("f2"); this.factory.Text = w.wrench.factory; this.rang.Text = w.wrench.rangeMin.ToString("f2") + "~" + w.wrench.rangeMax.ToString("f2"); this.time.Text = w.wrench.createDate.ToString().Replace('T', ' '); this.lasttime.Text = w.wrench.lastrepair.ToString().Replace('T', ' '); this.cycletime.Text = w.wrench.cycletime.ToString("f0"); if (w.species != null) { this.species.Text = w.species.speciesName; } if (w.status != null) { this.status.Text = w.status.statusName; } }
public wrenchinfo GetWrenchinfo(string barcode) { wrench w = Wrench.selectByBarcode(barcode); if (w == null) { return(null); } wrenchspecies ws = WrenchSpecies.selectByGuid(w.species); wrenchstatus wss = WrenchStatus.selectByguid(w.status); wrenchinfo wi = new wrenchinfo(); wi.wrench = w; wi.species = ws; wi.status = wss; return(wi); }
private void cb_wrench_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cb_wrench.SelectedIndex == 1) { if (!string.IsNullOrEmpty(this.wrenchbarcode.Text.Trim())) { GetWrenchInfo gwi = new GetWrenchInfo(); wrenchinfo wi = gwi.GetWrenchinfo(this.wrenchbarcode.Text.Trim()); if (wi == null) { MessageAlert.Alert("没有任何详细信息!"); } else { WrenchShow us = new WrenchShow(wi); us.ShowDialog(); } } } if (cb_wrench.SelectedIndex == 2) { if (string.IsNullOrEmpty(this.wrenchbarcode.Text.Trim())) { return; } WrenchBorrowHistory wbh = new WrenchBorrowHistory(); wrench w = Wrench.selectByBarcode(this.wrenchbarcode.Text.Trim()); if (w == null) { return; } List <BorrowHistory> bhl = wbh.GetByUser(Borrow.SelectByWrench(w.guid)); UserBorrow ub = new UserBorrow(bhl); ub.ShowDialog(); } this.cb_wrench.SelectedIndex = 0; }
public WrenchShow(wrenchinfo w) { InitializeComponent(); _wrenchinfo = w; ShowWrench(_wrenchinfo); }