private void button_teisei_Click(object sender, EventArgs e) { if (this.curItem == null) { return; } string def; if (this.curItem.item_sellprice.HasValue) { def = this.curItem.item_sellprice.ToString(); } else { def = "未売却"; } while (true) { string res; DialogResult dres = InputBox.ShowIntDialog("修正後の売価を入力してください\n商品名: " + this.curItem.item_name, "売価修正", def, out res); if (dres == DialogResult.Cancel) { return; } else { uint baika; if (!uint.TryParse(res, out baika)) { def = "不正な文字列です"; continue; } IItemDao itDao = GlobalData.getIDao <IItemDao>(); this.curItem.item_sellprice = baika; this.curItem.item_selltime = DateTime.Now; this.curItem.item_sell_operator = this.nowOperator.operator_id; itDao.Update(this.curItem); this.DoKansaItem(itDao.GetItemById(curItem.item_id).First()); this.label_error.Text = "金額訂正が完了しました"; return; } } }
private void button_mibai_Click(object sender, EventArgs e) { if (curItem == null) { return; } curItem.item_sellprice = null; curItem.item_selltime = null; IItemDao idao = GlobalData.getIDao <IItemDao>(); idao.Update(curItem); this.DoKansaItem(idao.GetItemById(curItem.item_id).First()); this.label_error.Text = "商品を未売却にしました"; }
private void textBox_ban_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string s = this.textBox_ban.Text; if (s == null) { return; } uint shinaBan; if (Globals.TryParseBarcode(s, out shinaBan)) { } else { if (!uint.TryParse(this.textBox_ban.Text, out shinaBan)) { this.textBox_ban_err("不明な文字列です"); return; } } if (!(0 <= shinaBan && shinaBan <= 999999)) { this.textBox_ban_err("不正な品番です"); } IItemDao itemDao = GlobalData.getIDao <IItemDao>(); List <Item> its = itemDao.GetItemById(shinaBan); if (its.Count == 0) { this.textBox_ban_err("品番に該当する商品がありません"); return; } this.DoKansaItem(its[0]); } }