public static void Delete(EY_Batch VO) { using (ISession session = SessionHelper.GetSession()) { session.Delete(VO); session.Flush(); } }
//挑选案件编号 private void buttonX4_Click(object sender, EventArgs e) { if (listViewEx1.CheckedItems.Count == 0) { MessageBox.Show("请勾选至少一项案件编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (comboBoxEx2_operator2.Text == "") { MessageBox.Show("请选择质检员2", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } EY_Batch batchNo = new EY_Batch { BatchNo=EY_Batch_DAO.GetBatchNo(),CreateTime=DateTime.Now}; IList<EY_RegNo_DI> checkVO = ListViewItems2Regno(listViewEx1.CheckedItems); batchNo.BatchChild = checkVO; int i = 0; foreach (EY_RegNo_DI t in checkVO) { t.Batch = batchNo; t.Status = "Y"; // t.MatrNo = checkVO[i].RegNo.Substring(1,; t.CName=checkVO[i].CName; i++; } EY_Batch_DAO.Save(batchNo); GetBatchNo(); RefleshData(); dataGridViewX1.Rows.Clear(); DisplayDataGridView(checkVO); // int RowCount = dataGridViewX1.Rows.GetRowCount(DataGridViewElementStates.Displayed) - 1; /* for (int i = 0; i < RowCount; i++) { Scale_Value Scale_Value_Vo = new Scale_Value(); // Scale_Value_Vo.RegNo = Convert.ToString(dataGridViewX1.Rows[i].Cells[0].Value); // Scale_Value_Vo.EleNo = Convert.ToString(dataGridViewX1.Rows[i].Cells[1].Value); Scale_Value_PK spk = new Scale_Value_PK(); spk.EleNo = Convert.ToString(dataGridViewX1.Rows[i].Cells[1].Value); spk.RegNo = Convert.ToString(dataGridViewX1.Rows[i].Cells[0].Value); Scale_Value_Vo.Id = spk; Scale_Value_Vo.WgtOne = Convert.ToDecimal(dataGridViewX1.Rows[i].Cells[2].Value); Scale_Value_Vo.WgtTwo = Convert.ToDecimal(dataGridViewX1.Rows[i].Cells[3].Value); Scale_Value_Vo.WgtThree = Convert.ToDecimal(dataGridViewX1.Rows[i].Cells[4].Value); Scale_Value_Vo.WgtFinal = Convert.ToDecimal(dataGridViewX1.Rows[i].Cells[5].Value); Scale_Value_Dao.Create(Scale_Value_Vo); }*/ saveIt(); buttonX3.Focus(); }