public bool StockContractAdd(stockContract stockContract, List <Indent> list) { ArrayList sqlLIst = new ArrayList(); sqlLIst.Add(stockContractDetailDb.getInsertSqlMain(stockContract)); foreach (Indent indent in list) { sqlLIst.Add(stockContractDetailDb.getInsertSqlSub(indent)); } return(sqlHelper.ExecuteTransaction(sqlLIst)); }
//保存合同 private void saveContract() { stockContract stockContract = GetStockContract(); List <Indent> list = GetIndent(); if (stockContractDetailLogic.StockContractAdd(stockContract, list)) { this.DialogResult = DialogResult.OK; this.Close(); } }
//采购合同主表信息 private stockContract GetStockContract() { stockContract stockContract = new stockContract(); // 分一般合同和补充合同两种情况 if (rdb1.Checked) { stockContract.no = textBox2.Text.Trim(); } else { stockContract.no = textBox1.Text.Trim(); } //stockContract.no = txtno.Text.Trim(); stockContract.name = txtname.Text.Trim(); stockContract.piId = int.Parse(cbm_providerInfo.SelectedValue.ToString()); if (cmb_personnelInfo.Text != "") { stockContract.producer = cmb_personnelInfo.Text; } stockContract.sum = decimal.Parse(txtsum.Text.Trim()); stockContract.minQuantity = decimal.Parse(txtminQuantity.Text.Trim()); stockContract.no2 = txtno2.Text.Trim(); stockContract.startDate = dtpstartDate.Value; stockContract.endDate = dtpendDate.Value; if (txtsquareMode.Text.Trim() != "") { stockContract.squareMode = txtsquareMode.Text.Trim(); } stockContract.conveyancer = comboBox1.Text.Trim(); // 如果是一般合同则parentId存储0 是补充合同parentId返回主合同编号的id值 if (rdb1.Checked) { stockContract.parentId = 0; } else { stockContract.parentId = Convert.ToInt32(txtno.SelectedValue.ToString()); } return(stockContract); }