private void btn_add_Click(object sender, EventArgs e) { if (!Checker.Check_Number(txt_optnum.Text.Trim(), false)) { MessageBox.Show("数量输入不正确"); return; } if (cbx_tp.SelectedIndex == -1) { MessageBox.Show("未选择操作类型"); return; } GoodsMenu menu = new GoodsMenu(); txt_menuid.Text = UpdateMulGoodsHelper.get_menu_id(user, dt_opttime.Value, ++menu_list_count); menu.MenuId = txt_menuid.Text.Trim(); menu.Date = dt_opttime.Value; menu.OptPeopleId = user.Userid; menu.TxtMsg = txt_msg.Text.Trim(); menu.Number = txt_optnum.Text.Trim(); menu.Goods = GoodsMSHelper.Select_goods_by_goodsId(txt_goodsid.Text.Trim()); if (menu.Goods == null) { MessageBox.Show("记录中不存在该货物"); return; } list.Add(new KeyValuePair <GoodsMenu, int>(menu, cbx_tp.SelectedIndex)); lis_menu.Items.Add(UpdateMulGoodsHelper.add_list_message(menu, cbx_tp.SelectedIndex)); this.btn_fresh_Click(sender, e); }
private void btn_fresh_Click(object sender, EventArgs e) { dt_opttime.Value = DateTime.Now; txt_menuid.Text = UpdateMulGoodsHelper.get_menu_id(user, dt_opttime.Value, ++menu_list_count); }