示例#1
0
 private void bt_add_Click(object sender, EventArgs e)
 {
     if (!check())
     {
         return;
     }
     InputManager.NewItemArgs args = new InputManager.NewItemArgs(tb_name.Text, tb_code.Text,
                                                                  cb_supplier.Text, Convert.ToDecimal(tb_price.Text), rb_discount_yes.Checked, rb_sale_yes.Checked, Convert.ToInt32(tb_quan.Text));
     if (!string.IsNullOrEmpty(tb_pro_price.Text))
     {
         if (DateTime.Compare(dtp_start.Value, dtp_end.Value) <= 0)
         {
             args.setDiscount(dtp_start.Value.ToString(), dtp_end.Value.ToString(), Convert.ToDecimal(tb_pro_price.Text));
         }
         else
         {
             MessageBox.Show("时间区间错误", "错误");
             return;
         }
     }
     if (!string.IsNullOrWhiteSpace(tb_quan_planned.Text))
     {
         args.setQuanPlanned(Convert.ToInt32(tb_quan_planned.Text));
     }
     if (!string.IsNullOrWhiteSpace(tb_quan_warning.Text))
     {
         args.setQuanWarn(Convert.ToInt32(tb_quan_warning.Text));
     }
     manager.addToDataTable(args);
     resetAll();
 }
示例#2
0
 private void bt_add_Click(object sender, EventArgs e)
 {
     if (!check())
     {
         return;
     }
     InputManager.NewItemArgs args = new InputManager.NewItemArgs(tb_name.Text, tb_code.Text,
          cb_supplier.Text, Convert.ToDecimal(tb_price.Text), rb_discount_yes.Checked, rb_sale_yes.Checked,Convert.ToInt32(tb_quan.Text));
     if (!string.IsNullOrEmpty(tb_pro_price.Text))
     {
         if (DateTime.Compare(dtp_start.Value ,dtp_end.Value)<=0)
         {
             args.setDiscount(dtp_start.Value.ToString(), dtp_end.Value.ToString(), Convert.ToDecimal(tb_pro_price.Text));
         }
         else
         {
             MessageBox.Show("时间区间错误", "错误");
             return;
         }
     }
     if (!string.IsNullOrWhiteSpace(tb_quan_planned.Text))
     {
         args.setQuanPlanned(Convert.ToInt32(tb_quan_planned.Text));
     }
     if (!string.IsNullOrWhiteSpace(tb_quan_warning.Text))
     {
         args.setQuanWarn(Convert.ToInt32(tb_quan_warning.Text));
     }
     manager.addToDataTable(args);
     resetAll();
 }