private FC_H_QSDC CreateFC_H_QSDC(DataGridViewRow row) { FC_H_QSDC h = new FC_H_QSDC(); h.LSZTYBM = null == row.Cells["BuildingInfo_id"].Value ? null : row.Cells["BuildingInfo_id"].Value.ToString(); h.TSTYBM= null == row.Cells["HouseInfo_id"].Value ? null : row.Cells["HouseInfo_id"].Value.ToString(); h.DYH = null==row.Cells["H_CeCode"].Value ? null : row.Cells["H_CeCode"].Value.ToString(); h.FJH= null == row.Cells["H_RoNum"].Value ? null : row.Cells["H_RoNum"].Value.ToString(); h.GHYT = ConvertToGHYT(row.Cells["H_HoUse"]); h.JZMJ = GetJZMJ(row.Cells["H_ConAcre"]); h.ZL = GetZL(row.Cells["I_Dist"], row.Cells["I_ItSite"], row.Cells["I_ItName"], row.Cells["BuName"], row.Cells["H_CeCode"], row.Cells["H_RoNum"]); return h; }
private void InsertIntoBDC(FC_H_QSDC h) { try { DbHelper.Conn = new Oracle.DataAccess.Client.OracleConnection(SXK); DbHelper.SetProvider(MyDBType.Oracle); string sql = DbHelper.CreateInsertStr<FC_H_QSDC>(h, "FC_H_QSDC", MyDBType.Oracle); sql = sql.Trim().Replace("\r\n", ""); DbParameter[] param = DbHelper.GetParamArray<FC_H_QSDC>(h, MyDBType.Oracle); DbHelper.ExecuteNonQuery(DbHelper.Conn, System.Data.CommandType.Text, sql, param); } catch(Exception ex) { throw ex; } finally { DbHelper.CloseConn(); } }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if(DialogResult.Yes==MessageBox.Show("是否导入?","提示",MessageBoxButtons.YesNo)) { int index = e.RowIndex; if ((null != dataGridView1.Rows[index].Cells[1].Value && dataGridView1.Rows[index].Cells[1].Value.ToString() == "1") || (null != dataGridView1.Rows[index].Cells[2].Value && dataGridView1.Rows[index].Cells[2].Value.ToString() == "1")) { MessageBox.Show("禁止操作"); } else { DataGridViewRow row = dataGridView1.Rows[index]; FC_H_QSDC h = CreateFC_H_QSDC(row); InsertIntoBDC(h); MessageBox.Show("导入成功!"); } } }
private Oracle.DataAccess.Client.OracleParameter[] GetParams(FC_H_QSDC fc_dyxx) { return DbHelper.GetParamArray<FC_H_QSDC>(fc_dyxx); }