private void btnRegist_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtItemName.Text.Trim()) == true) { MessageBox.Show(this, "ハードウェア名を入力してください", "ハードウェア管理"); return; } if (cbxItemType.SelectedValue is int itc && cbxItemState.SelectedValue is int sc && cbxZaiko.SelectedValue is ZaikoTypes zt) { var rs = DBAccessor.Instance.Reserves; var res = new Reserve(); res.ReserveCode = rs.Count() == 0 ? 1 : rs.Max(x => x.ReserveCode) + 1; res.Name = txtItemName.Text.Trim(); res.ModelNo = txtModelNo.Text.Trim(); res.InsertTime = DateTime.Now; res.UpdateTime = DateTime.Now; res.ItemTypeCode = itc; res.ItemStateCode = sc; res.Zaiko = zt; DBAccessor.Instance.Reserves = DBAccessor.Instance.UpsertJson <Reserve, DBObject.Reserve>(res); MessageBox.Show(this, "登録しました", "ハードウェア管理"); Clear(); var form = new FormReportTest(res); form.Show(); } }
private void btnReprint_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "ラベルを再印刷しますか?", "ハードウェア管理", MessageBoxButtons.YesNo) == DialogResult.Yes) { var form = new FormReportTest(ReserveDetail); form.Show(); } }
private void btnRegist_Click(object sender, EventArgs e) { if (cbxType.SelectedValue is int ts && cbxShop.SelectedValue is int ss && cbxState.SelectedValue is int es && cbxZaiko.SelectedValue is ZaikoTypes zt) { Malfunction mar; if (ts == 0) { MessageBox.Show(this, "種別を選択してください。", "ハードウェア管理"); return; } if (es == 0) { MessageBox.Show(this, "状態を選択してください。", "ハードウェア管理"); return; } if (Malfunction == null) { mar = new Malfunction(); mar.MalfunctionCode = DBAccessor.Instance.MaxUniqueNumber <DBObject.Malfunction>() + 1; mar.InsertTime = DateTime.Now; } else { mar = Malfunction; } mar.ShopCode = ss; mar.ItemTypeCode = ts; mar.ItemStateCode = es; mar.Name = txtItemName.Text; mar.ModelNo = txtModelNo.Text; mar.Zaiko = zt; mar.UpdateTime = DateTime.Now; DBAccessor.Instance.Malfunctions = DBAccessor.Instance.UpsertJson <Malfunction, DBObject.Malfunction>(mar); if (Relation != null) { Relation.MalfunctionCode = mar.MalfunctionCode; DBAccessor.Instance.Relations = DBAccessor.Instance.UpsertJson <Relation, DBObject.Relation>(Relation); } MessageBox.Show(this, "登録しました", "ハードウェア管理"); this.Visible = false; var form = new FormReportTest(mar); form.Show(); } }