/// <summary> /// 查询是否存在指定的影像设备记录 /// </summary> /// <param name="iimgEquipment"></param> /// <returns></returns> public override bool Exists(IModel iimgEquipment) { MImgEquipment imgEquipment = (MImgEquipment)iimgEquipment; strSql = "select * from " + TableName + " where IMG_EQUIPMENT_ID=" + imgEquipment.IMG_EQUIPMENT_ID; return(recordIsExist(strSql)); }
/// <summary> /// 批量插入影像设备记录 /// </summary> /// <param name="ht2"></param> /// <returns></returns> public override int AddMore(Hashtable ht2) { MImgEquipment imgEquipment = new MImgEquipment(); Hashtable ht = new Hashtable(); Hashtable htstr = new Hashtable(); if (ht2.Count > 0) { for (int i = 0; i < ht2.Count; i++) { ht.Clear(); imgEquipment = (MImgEquipment)ht2[i]; ht.Add("IMG_EQUIPMENT_ID", imgEquipment.IMG_EQUIPMENT_ID); ht.Add("IMG_EQUIPMENT_NAME", imgEquipment.IMG_EQUIPMENT_NAME); ht.Add("CLINIC_OFFICE_CODE", imgEquipment.CLINIC_OFFICE_ID); ht.Add("OFFICE", imgEquipment.OFFICE); ht.Add("SERIAL_CLASS", imgEquipment.SERIAL_CLASS); ht.Add("EQUIPMENT_STATE", imgEquipment.EQUIPMENT_STATE); ht.Add("OPERATOR_DOCTOR", imgEquipment.OPERATOR_DOCTOR); ht.Add("IP", imgEquipment.IP); ht.Add("LAST_CALL", imgEquipment.LAST_CALL); ht.Add("EQU_GUID", imgEquipment.EQU_GUID); htstr.Add(i, StringConstructor.InsertSql(TableName, ht).ToString()); } return(ExecuteNonSql(htstr)); } else { return(0); } }
/// <summary> /// 插入一条影像设备记录 /// </summary> /// <param name="iimgEquipment"></param> /// <returns></returns> public override int Add(IModel iimgEquipment) { MImgEquipment imgEquipment = (MImgEquipment)iimgEquipment; Hashtable ht = new Hashtable(); ht.Add("IMG_EQUIPMENT_ID", imgEquipment.IMG_EQUIPMENT_ID); ht.Add("IMG_EQUIPMENT_NAME", imgEquipment.IMG_EQUIPMENT_NAME); ht.Add("CLINIC_OFFICE_CODE", imgEquipment.CLINIC_OFFICE_ID); ht.Add("OFFICE", imgEquipment.OFFICE); ht.Add("SERIAL_CLASS", imgEquipment.SERIAL_CLASS); ht.Add("EQUIPMENT_STATE", imgEquipment.EQUIPMENT_STATE); ht.Add("OPERATOR_DOCTOR", imgEquipment.OPERATOR_DOCTOR); ht.Add("IP", imgEquipment.IP); ht.Add("LAST_CALL", imgEquipment.LAST_CALL); ht.Add("EQU_GUID", imgEquipment.EQU_GUID); return(ExecuteSql(StringConstructor.InsertSql(TableName, ht).ToString())); }
/// <summary> /// 获取指定影像设备ID的影像设备记录 /// </summary> /// <param name="IMG_EQUIPMENT_ID"></param> /// <returns></returns> public override IModel GetModel(string IMG_EQUIPMENT_ID) { strSql = "select * from " + TableName + " where IMG_EQUIPMENT_ID = " + IMG_EQUIPMENT_ID; DataTable dt = GetDataTable(strSql); if (dt.Rows.Count == 0) { return(null); } MImgEquipment imgEquipment = new MImgEquipment(); imgEquipment.IMG_EQUIPMENT_ID = Convert.ToInt32(dt.Rows[0]["IMG_EQUIPMENT_ID"].ToString()); if (dt.Rows[0]["CLINIC_OFFICE_CODE"].ToString() == "") { imgEquipment.CLINIC_OFFICE_ID = null; } else { imgEquipment.CLINIC_OFFICE_ID = Convert.ToInt32(dt.Rows[0]["CLINIC_OFFICE_CODE"].ToString()); } if (dt.Rows[0]["LAST_CALL"].ToString() == "") { imgEquipment.LAST_CALL = null; } else { imgEquipment.LAST_CALL = Convert.ToDateTime(dt.Rows[0]["LAST_CALL"].ToString()); } imgEquipment.IMG_EQUIPMENT_NAME = dt.Rows[0]["IMG_EQUIPMENT_NAME"].ToString(); imgEquipment.OFFICE = dt.Rows[0]["OFFICE"].ToString(); imgEquipment.SERIAL_CLASS = dt.Rows[0]["SERIAL_CLASS"].ToString(); imgEquipment.EQUIPMENT_STATE = dt.Rows[0]["EQUIPMENT_STATE"].ToString(); imgEquipment.OPERATOR_DOCTOR = dt.Rows[0]["OPERATOR_DOCTOR"].ToString(); imgEquipment.IP = dt.Rows[0]["IP"].ToString(); imgEquipment.EQU_GUID = dt.Rows[0]["EQU_GUID"].ToString(); return(imgEquipment); }
private bool EditData() { Hashtable htEdit = new Hashtable(); int k = 0; if (htRow.Count > 0) { foreach (DictionaryEntry myDE in htRow) { int r = Convert.ToInt32(myDE.Value); MImgEquipment MigEquMent = new MImgEquipment(); MigEquMent.IMG_EQUIPMENT_ID = Convert.ToInt32(dgv_ImgEquipment.Rows[r].Cells["IMG_EQUIPMENT_ID"].Value.ToString().Trim()); if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[r].Cells["IMG_EQUIPMENT_NAME"].Value.ToString().Trim())) { MigEquMent.IMG_EQUIPMENT_NAME = dgv_ImgEquipment.Rows[r].Cells["IMG_EQUIPMENT_NAME"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[r].Cells["CLINIC_OFFICE_ID"].Value.ToString().Trim())) { MigEquMent.CLINIC_OFFICE_ID = Convert.ToInt32(((DataGridViewComboBoxCell)dgv_ImgEquipment.Rows[r].Cells["CLINIC_OFFICE_ID"]).Value.ToString().Trim()); } if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[r].Cells["OFFICE"].Value.ToString().Trim())) { MigEquMent.OFFICE = dgv_ImgEquipment.Rows[r].Cells["OFFICE"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[r].Cells["SERIAL_CLASS"].Value.ToString().Trim())) { MigEquMent.SERIAL_CLASS = dgv_ImgEquipment.Rows[r].Cells["SERIAL_CLASS"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[r].Cells["OPERATOR_DOCTOR"].Value.ToString().Trim())) { MigEquMent.OPERATOR_DOCTOR = dgv_ImgEquipment.Rows[r].Cells["OPERATOR_DOCTOR"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[r].Cells["EQUIPMENT_STATE"].Value.ToString().Trim())) { MigEquMent.EQUIPMENT_STATE = dgv_ImgEquipment.Rows[r].Cells["EQUIPMENT_STATE"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[r].Cells["IP"].Value.ToString().Trim())) { MigEquMent.IP = dgv_ImgEquipment.Rows[r].Cells["IP"].Value.ToString().Trim(); } try { MigEquMent.LAST_CALL = Convert.ToDateTime(dgv_ImgEquipment.Rows[r].Cells["LAST_CALL"].Value.ToString()); } catch { } MigEquMent.EQU_GUID = dgv_ImgEquipment.Rows[r].Cells["EQU_GUID"].Value.ToString().Trim(); htEdit.Add(k, MigEquMent); k += 1; } if (BigEquMent.UpdateMore(htEdit) >= 0) { MessageBoxEx.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBoxEx.Show("修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } htRow.Clear(); i = 0; return(true); }
private bool SaveData() { Hashtable ht = new Hashtable(); if (dgv_ImgEquipment.Rows.Count > rowcount - 1) //说明有新增行 { for (int i = rowcount, j = 0; i <= dgv_ImgEquipment.Rows.Count && j < dgv_ImgEquipment.Rows.Count; i++, j++) //从第rowcount个开始保存 { MImgEquipment MigEquMent = new MImgEquipment(); MigEquMent.IMG_EQUIPMENT_ID = Convert.ToInt32(dgv_ImgEquipment.Rows[i - 1].Cells["IMG_EQUIPMENT_ID"].Value.ToString().Trim()); if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[i - 1].Cells["IMG_EQUIPMENT_NAME"].Value.ToString().Trim())) { MigEquMent.IMG_EQUIPMENT_NAME = dgv_ImgEquipment.Rows[i - 1].Cells["IMG_EQUIPMENT_NAME"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[i - 1].Cells["CLINIC_OFFICE_ID"].Value.ToString().Trim())) { MigEquMent.CLINIC_OFFICE_ID = Convert.ToInt32(((DataGridViewComboBoxCell)dgv_ImgEquipment.Rows[i - 1].Cells["CLINIC_OFFICE_ID"]).Value.ToString()); } if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[i - 1].Cells["OFFICE"].Value.ToString().Trim())) { MigEquMent.OFFICE = dgv_ImgEquipment.Rows[i - 1].Cells["OFFICE"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[i - 1].Cells["SERIAL_CLASS"].Value.ToString().Trim())) { MigEquMent.SERIAL_CLASS = dgv_ImgEquipment.Rows[i - 1].Cells["SERIAL_CLASS"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[i - 1].Cells["OPERATOR_DOCTOR"].Value.ToString().Trim())) { MigEquMent.OPERATOR_DOCTOR = dgv_ImgEquipment.Rows[i - 1].Cells["OPERATOR_DOCTOR"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[i - 1].Cells["EQUIPMENT_STATE"].Value.ToString().Trim())) { MigEquMent.EQUIPMENT_STATE = dgv_ImgEquipment.Rows[i - 1].Cells["EQUIPMENT_STATE"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(dgv_ImgEquipment.Rows[i - 1].Cells["IP"].Value.ToString().Trim())) { MigEquMent.IP = dgv_ImgEquipment.Rows[i - 1].Cells["IP"].Value.ToString().Trim(); } try { MigEquMent.LAST_CALL = Convert.ToDateTime(dgv_ImgEquipment.Rows[i - 1].Cells["LAST_CALL"].Value.ToString()); } catch { } MigEquMent.EQU_GUID = dgv_ImgEquipment.Rows[i - 1].Cells["EQU_GUID"].Value.ToString().Trim(); ht.Add(j, MigEquMent); } } if (ht.Count > 0) { if (BigEquMent.AddMore(ht) > 0) { MessageBoxEx.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBoxEx.Show("添加失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } return(true); }