private bool EditData()//批量修改 { Hashtable htEdit = new Hashtable(); int r = 0; if (htRow.Count > 0) { for (int k = 0; k < htRow.Count; k++) { r = Convert.ToInt32(htRow[k].ToString()); MSystemFun MSysFun = new MSystemFun(); MSysFun.MODEL_ID = Convert.ToInt32(GvFunClassOne.Rows[r].Cells["MODEL_ID"].Value.ToString()); if (!string.IsNullOrEmpty(GvFunClassOne.Rows[r].Cells["MODEL_NAME"].FormattedValue.ToString())) { MSysFun.MODEL_NAME = GvFunClassOne.Rows[r].Cells["MODEL_NAME"].Value.ToString(); } else { MessageBoxEx.Show("系统名称不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } if (!string.IsNullOrEmpty(GvFunClassOne.Rows[r].Cells["MODEL_PLACE"].FormattedValue.ToString())) { MSysFun.MODEL_PLACE = GvFunClassOne.Rows[r].Cells["MODEL_PLACE"].Value.ToString(); } else { MessageBoxEx.Show("窗体对象名称不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } if (ExpressionValidat.IsInt(GvFunClassOne.Rows[r].Cells["SORT_FLAG"].FormattedValue.ToString())) { MSysFun.SORT_FLAG = Convert.ToInt32(GvFunClassOne.Rows[r].Cells["SORT_FLAG"].Value.ToString()); } else { MessageBoxEx.Show("排序号必须为数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } if (!string.IsNullOrEmpty(GvFunClassOne.Rows[r].Cells["IMAGE_ADDRESS"].FormattedValue.ToString())) { MSysFun.IMAGE_ADDRESS = GvFunClassOne.Rows[r].Cells["IMAGE_ADDRESS"].Value.ToString(); } htEdit.Add(k, MSysFun); } if (BSysFun.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 EditData()//批量修改 { Hashtable htEdit = new Hashtable(); int r = 0; if (htRow.Count > 0) { for (int k = 0; k < htRow.Count; k++) { r = Convert.ToInt32(htRow[k].ToString()); MClinicOfficeDict MOfficeDict = new MClinicOfficeDict(); MOfficeDict.CLINIC_OFFICE_ID = Convert.ToInt32(GvDept.Rows[r].Cells["CLINIC_OFFICE_ID"].Value.ToString()); if (!string.IsNullOrEmpty(GvDept.Rows[r].Cells["CLINIC_OFFICE"].Value.ToString().Trim())) { MOfficeDict.CLINIC_OFFICE = GvDept.Rows[r].Cells["CLINIC_OFFICE"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(GvDept.Rows[r].Cells["PATIENT_SOURCE_ID"].Value.ToString())) { MOfficeDict.PATIENT_SOURCE_ID = Convert.ToInt32(((DataGridViewComboBoxCell)GvDept.Rows[r].Cells["PATIENT_SOURCE_ID"]).Value.ToString()); } if (!string.IsNullOrEmpty(GvDept.Rows[r].Cells["CLINIC_OFFICE_CODE"].Value.ToString().Trim())) { MOfficeDict.CLINIC_OFFICE_CODE = GvDept.Rows[r].Cells["CLINIC_OFFICE_CODE"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(GvDept.Rows[r].Cells["CLINIC_OFFICE_FLAG"].Value.ToString().Trim())) { MOfficeDict.CLINIC_OFFICE_FLAG = GvDept.Rows[r].Cells["CLINIC_OFFICE_FLAG"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(GvDept.Rows[r].Cells["STUDY_UID_HEADER"].Value.ToString().Trim())) { MOfficeDict.STUDY_UID_HEADER = GvDept.Rows[r].Cells["STUDY_UID_HEADER"].Value.ToString().Trim(); } if (ExpressionValidat.IsNumeric(GvDept.Rows[r].Cells["CUR_SERIAL_NUM"].Value.ToString())) { MOfficeDict.CUR_SERIAL_NUM = Convert.ToInt32(GvDept.Rows[r].Cells["CUR_SERIAL_NUM"].Value.ToString()); } if (!string.IsNullOrEmpty(GvDept.Rows[r].Cells["CLINIC_OFFICE_PYCODE"].Value.ToString())) { MOfficeDict.CLINIC_OFFICE_PYCODE = GvDept.Rows[r].Cells["CLINIC_OFFICE_PYCODE"].Value.ToString().Trim(); } htEdit.Add(k, MOfficeDict); } if (BOfficeDict.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 (GvDept.Rows.Count > rowcount - 1) //说明有新增行 { for (int i = rowcount, j = 0; i <= GvDept.Rows.Count && j < GvDept.Rows.Count; i++, j++) //从第rowcount个开始保存 { MClinicOfficeDict MOfficeDict = new MClinicOfficeDict(); MOfficeDict.CLINIC_OFFICE_ID = Convert.ToInt32(GvDept.Rows[i - 1].Cells["CLINIC_OFFICE_ID"].Value.ToString()); if (!string.IsNullOrEmpty(GvDept.Rows[i - 1].Cells["CLINIC_OFFICE"].Value.ToString().Trim())) { MOfficeDict.CLINIC_OFFICE = GvDept.Rows[i - 1].Cells["CLINIC_OFFICE"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(GvDept.Rows[i - 1].Cells["PATIENT_SOURCE_ID"].Value.ToString())) { MOfficeDict.PATIENT_SOURCE_ID = Convert.ToInt32(((DataGridViewComboBoxCell)GvDept.Rows[i - 1].Cells["PATIENT_SOURCE_ID"]).Value.ToString()); } if (!string.IsNullOrEmpty(GvDept.Rows[i - 1].Cells["CLINIC_OFFICE_CODE"].Value.ToString().Trim())) { MOfficeDict.CLINIC_OFFICE_CODE = GvDept.Rows[i - 1].Cells["CLINIC_OFFICE_CODE"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(GvDept.Rows[i - 1].Cells["CLINIC_OFFICE_FLAG"].Value.ToString().Trim())) { MOfficeDict.CLINIC_OFFICE_FLAG = GvDept.Rows[i - 1].Cells["CLINIC_OFFICE_FLAG"].Value.ToString().Trim(); } if (!string.IsNullOrEmpty(GvDept.Rows[i - 1].Cells["STUDY_UID_HEADER"].Value.ToString().Trim())) { MOfficeDict.STUDY_UID_HEADER = GvDept.Rows[i - 1].Cells["STUDY_UID_HEADER"].Value.ToString().Trim(); } if (ExpressionValidat.IsNumeric(GvDept.Rows[i - 1].Cells["CUR_SERIAL_NUM"].Value.ToString())) { MOfficeDict.CUR_SERIAL_NUM = Convert.ToInt32(GvDept.Rows[i - 1].Cells["CUR_SERIAL_NUM"].Value.ToString()); } if (!string.IsNullOrEmpty(GvDept.Rows[i - 1].Cells["CLINIC_OFFICE_PYCODE"].Value.ToString())) { MOfficeDict.CLINIC_OFFICE_PYCODE = GvDept.Rows[i - 1].Cells["CLINIC_OFFICE_PYCODE"].Value.ToString().Trim(); } ht.Add(j, MOfficeDict); } } if (ht.Count > 0) { if (BOfficeDict.AddMore(ht) > 0) { MessageBoxEx.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBoxEx.Show("添加失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } return(true); }
private bool SaveData()//批量保存 { Hashtable ht = new Hashtable(); if (GvFunClassThree.Rows.Count > rowcount - 1) //说明有新增行 { for (int i = rowcount, j = 0; i <= GvFunClassThree.Rows.Count && j < GvFunClassThree.Rows.Count; i++, j++) //从第rowcount个开始保存 { MSystemFun MSysFunChi = new MSystemFun(); MSysFunChi.MODEL_ID = Convert.ToInt32(GvFunClassThree.Rows[i - 1].Cells["MODEL_ID"].Value.ToString()); if (!string.IsNullOrEmpty(GvFunClassThree.Rows[i - 1].Cells["UP_MODEL_NAME"].FormattedValue.ToString())) { MSysFunChi.UP_MODEL_ID = Convert.ToInt32(BSysFun.GetList(" MODEL_NAME='" + GvFunClassThree.Rows[i - 1].Cells["UP_MODEL_NAME"].Value.ToString() + "'").Rows[0]["MODEL_ID"].ToString()); } else { MessageBoxEx.Show("二级模块不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } MSysFunChi.MODEL_CLASS = "3"; MSysFunChi.DEL_FLAG = 0; if (ExpressionValidat.IsInt(GvFunClassThree.Rows[i - 1].Cells["SORT_FLAG"].FormattedValue.ToString())) { MSysFunChi.SORT_FLAG = Convert.ToInt32(GvFunClassThree.Rows[i - 1].Cells["SORT_FLAG"].Value.ToString()); } else { MessageBoxEx.Show("排序号必须为整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } MSysFunChi.MODEL_ID = Convert.ToInt32(GvFunClassThree.Rows[i - 1].Cells["MODEL_ID"].Value.ToString()); if (!string.IsNullOrEmpty(GvFunClassThree.Rows[i - 1].Cells["MODEL_NAME"].FormattedValue.ToString())) { MSysFunChi.MODEL_NAME = GvFunClassThree.Rows[i - 1].Cells["MODEL_NAME"].Value.ToString(); } else { MessageBoxEx.Show("三级模块不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } if (!string.IsNullOrEmpty(GvFunClassThree.Rows[i - 1].Cells["MODEL_PLACE"].FormattedValue.ToString())) { MSysFunChi.MODEL_PLACE = GvFunClassThree.Rows[i - 1].Cells["MODEL_PLACE"].Value.ToString(); } else { MessageBoxEx.Show("系统对象名称不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } ht.Add(j, MSysFunChi); } } if (ht.Count > 0) { if (BSysFun.AddMore(ht) > 0) { MessageBoxEx.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBoxEx.Show("添加失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } return(true); }
private void btn_Save_Click(object sender, EventArgs e) { if (Now_Modify_NodeID == "") { return; } if (ChgNull()) { return; } MReportTempDict MRptTemp = new MReportTempDict(); MRptTemp.NODE_ID = Convert.ToInt32(Now_Modify_NodeID); if (txt_SORT_FLAG.Text.Trim() != "") { if (!ExpressionValidat.IsNumeric(txt_SORT_FLAG.Text.Trim())) { MessageBoxEx.Show("请输入数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } MRptTemp.SORT_FLAG = Convert.ToInt32(txt_SORT_FLAG.Text.Trim()); } TreeNode[] tn = trv_ReportTempDict.Nodes.Find(Now_Modify_NodeID, true); if (tn[0].Level == 0) { MRptTemp.NODE_PARENT_ID = 0; } else { MRptTemp.NODE_PARENT_ID = Convert.ToInt32(tn[0].Parent.Name); } MRptTemp.NODE_NAME = txt_NODE_NAME.Text.Trim(); MRptTemp.NODE_DEPICT = txt_NODE_DEPICT.Text.Trim(); MRptTemp.NODE_SIGN = cmb_NODE_SIGN.SelectedValue.ToString(); MRptTemp.INPUT_CODE = txt_INPUT_CODE.Text.ToString().Trim(); MUser user = (MUser)frmMainForm.iUser; MRptTemp.DOCTOR_ID = user.DOCTOR_ID; MRptTemp.EXAM_CLASS = GetConfig.RS_TempExamClass; MRptTemp.ICD10_CODE = txt_Icdcode.Text.Trim(); if (cmb_IS_PRIVATE.Text.Trim() == "公共") { MRptTemp.IS_PRIVATE = 0; } else if (cmb_IS_PRIVATE.Text.Trim() == "私有") { MRptTemp.IS_PRIVATE = 1; } bool bl = BReportTpDct.Exists(MRptTemp); if (bl) { int i = BReportTpDct.Update(MRptTemp, " where NODE_ID=" + MRptTemp.NODE_ID); if (i >= 0) { tn[0].Text = txt_NODE_NAME.Text; MessageBoxEx.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); btn_Clean_Click(null, null); Now_Add_NodeID = ""; Now_Modify_NodeID = ""; } else { MessageBoxEx.Show("修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { int i = BReportTpDct.Add(MRptTemp); if (i > 0) { tn[0].Text = txt_NODE_NAME.Text; MessageBoxEx.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); btn_Clean_Click(null, null); Now_Add_NodeID = ""; Now_Modify_NodeID = ""; } else { MessageBoxEx.Show("添加失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }