/// <summary> /// 构造函数 /// </summary> public FormOSM_Offers_Add(string uuid = "") { InitializeComponent(); buyer = new Buyer(); seller = new Seller(); offer_sheet = new OfferSheet(); //hw = new HW(); dataGridView_HW.AutoGenerateColumns = false; string whereString = "where PID = 10"; SJZDController.setZD_ComboBox(whereString, comboBox_OFFERSHEET_REGION); whereString = "where PID = 33"; SJZDController.setZD_ComboBox(whereString, comboBox_OFFERSHEET_TYPE); string offsht_code = "U" + uuid + "OSC" + DateTime.Now.ToString("yyyyMMddHHmmss"); textBox_OFFERSHEET_CODE.Text = offsht_code; fillSellerComboBox(comboBox_SELLER); fillBuyerComboBox(comboBox_BUYER); //queryByHW(dataGridView_HW); }
/// <summary> /// 数据库更新报价单记录 /// </summary> /// <param name="offer_sheet"></param> /// <returns>是否更新成功</returns> private bool updateOfferSheet(OfferSheet offer_sheet) { string sql = "update OSM_OFFER_SHEET set OFFERSHEET_CODE = '" + offer_sheet.getOFFERSHEET_CODE() + "',"; sql += "GMF_ID=" + offer_sheet.getGMF_ID().ToString() + ",BJF_ID=" + offer_sheet.getBJF_ID() + ","; sql += "OFFERSHEET_TYPE='" + offer_sheet.getOFFERSHEET_TYPE() + "',OFFERSHEET_DATE = #" + offer_sheet.getOFFERSHEET_DATE() + "#,"; sql += "OFFERSHEET_STATE='" + offer_sheet.getOFFERSHEET_STATE() + "',"; sql += "OFFERSHEET_REGION = '" + offer_sheet.getOFFERSHEET_REGION() + "' "; sql += "where ID = " + offer_sheet.getID().ToString(); AccessDB adb = new AccessDB(); bool isExecuteSucc = adb.SQLExecute(sql); if (isExecuteSucc) { MessageBox.Show("更新成功!", "消息"); } else { MessageBox.Show("更新失败!", "消息"); } return isExecuteSucc; }
/// <summary> /// 数据库新增报价单记录 /// </summary> /// <param name="offer_sheet">报价单对象</param> /// <returns>是否添加成功</returns> private bool addOfferSheet(OfferSheet offer_sheet) { string sql = "insert into OSM_OFFER_SHEET(OFFERSHEET_CODE,GMF_ID,BJF_ID,OFFERSHEET_TYPE,OFFERSHEET_DATE,OFFERSHEET_STATE,OFFERSHEET_REGION) "; sql += "values('" + offer_sheet.getOFFERSHEET_CODE() + "'," + offer_sheet.getGMF_ID() + "," + offer_sheet.getBJF_ID(); sql += ",'" + offer_sheet.getOFFERSHEET_TYPE() + "','" + offer_sheet.getOFFERSHEET_DATE() + "','"; sql += offer_sheet.getOFFERSHEET_STATE() + "','" + offer_sheet.getOFFERSHEET_REGION() + "')"; AccessDB adb = new AccessDB(); bool isExecuteSucc = adb.SQLExecute(sql); if (isExecuteSucc) { MessageBox.Show("添加成功!", "消息"); } else { MessageBox.Show("添加失败!", "消息"); } return isExecuteSucc; }