/// <summary> /// 构造函数 /// </summary> public FormOSM_HW_Add() { InitializeComponent(); hw = new HW(); string whereString = "where PID = 43 "; SJZDController.setZD_ComboBox(whereString, comboBox_HW_TYPE); comboBox_HW_TYPE.Enabled = false; //产品列表数据填充 fillProductComboBox(); }
/// <summary> /// 实现数据库插入货物数据 /// </summary> /// <param name="hw"></param> /// <returns></returns> private bool addHW(HW hw) { string sql = "insert into OSM_HW(OFFERSHEET_CODE,PRODUCT_ID,HW_NUMBER,HW_PRICE,HW_TOTALPRICE,COMMENT) "; sql += "values('" + hw.getOFFERSHEET_CODE() + "'," + hw.getPRODUCT_ID() + ","; sql += hw.getHW_NUMBER().ToString() + "," + hw.getHW_PRICE().ToString(); sql += "," + hw.getHW_TOTALPRICE().ToString() + ",'" + hw.getCOMMENT() + "')"; AccessDB adb = new AccessDB(); bool isExecuteSucc = adb.SQLExecute(sql); if (isExecuteSucc) { MessageBox.Show("添加成功!", "消息"); } else { MessageBox.Show("添加失败!", "消息"); } return isExecuteSucc; }
/// <summary> /// 将窗口输入框内容填入货物对象 /// </summary> /// <param name="hw"></param> private void createHW(HW hw) { int number = int.Parse(textBox_HW_NUMBER.Text); double price = double.Parse(textBox_HW_PRICE.Text); //hw.setHW_NAME(textBox_HW_NAME.Text); //hw.setHW_CODE(textBox_HW_CODE.Text); hw.setHW_NUMBER(number); hw.setHW_PRICE(price); hw.setHW_TOTALPRICE(price * number); hw.setCOMMENT(textBox_HW_COMMENT.Text); }