/// <summary> /// 查询是否存在指定的系统功能记录 /// </summary> /// <param name="isystemFun"></param> /// <returns></returns> public override bool Exists(IModel isystemFun) { MSystemFun systemFun = (MSystemFun)isystemFun; strSql = "select * from " + TableName + " where MODEL_ID = " + systemFun.MODEL_ID; return(recordIsExist(strSql)); }
private void btnCancle_Click(object sender, EventArgs e)//批量保存 { ht.Clear(); if (GvFunClassOne.Rows.Count > rowcount) //说明有新增行 { for (int i = rowcount, j = 0; i < GvFunClassOne.Rows.Count && j < GvFunClassOne.Rows.Count; i++, j++) //从第rowcount个开始保存 { MSystemFun MSysFunChi = new MSystemFun(); MSysFunChi.MODEL_ID = Convert.ToInt16(GvFunClassOne.Rows[i - 1].Cells["MODEL_ID"].Value.ToString()); MSysFunChi.UP_MODEL_ID = 0; MSysFunChi.MODEL_CLASS = "1"; MSysFunChi.DEL_FLAG = 0; MSysFunChi.SORT_FLAG = Convert.ToInt16(GvFunClassOne.Rows[i - 1].Cells["SORT_FLAG"].Value.ToString()); MSysFunChi.MODEL_PLACE = "SIS"; MSysFunChi.MODEL_NAME = GvFunClassOne.Rows[i - 1].Cells["MODEL_NAME"].Value.ToString(); ht.Add(j, MSysFunChi); } } if (CheckCellValue()) { //if ((ht)) //{ // rowcount = GvFunClassOne.Rows.Count;//起始保存的行数更新 // MessageBoxEx.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); // GetClassOneModel();//刷新表格 //} //else // MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 批量插入系统功能记录 /// </summary> /// <param name="ht2"></param> /// <returns></returns> public override int AddMore(Hashtable ht2) { MSystemFun MsysFun = new MSystemFun(); Hashtable ht = new Hashtable(); Hashtable htstr = new Hashtable(); if (ht2.Count > 0) { for (int i = 0; i < ht2.Count; i++) { ht.Clear(); MsysFun = (MSystemFun)ht2[i]; ht.Add("MODEL_ID", MsysFun.MODEL_ID); ht.Add("UP_MODEL_ID", MsysFun.UP_MODEL_ID); ht.Add("MODEL_CLASS", MsysFun.MODEL_CLASS); ht.Add("DEL_FLAG", MsysFun.DEL_FLAG); ht.Add("SORT_FLAG", MsysFun.SORT_FLAG); ht.Add("MODEL_PLACE", MsysFun.MODEL_PLACE); ht.Add("MODEL_NAME", MsysFun.MODEL_NAME); ht.Add("IMAGE_ADDRESS", MsysFun.IMAGE_ADDRESS); htstr.Add(i, StringConstructor.InsertSql(cp.Uid + "." + TableName, ht).ToString()); } return(ExecuteNonSql(htstr)); } else { return(0); } }
/// <summary> /// 批量更新系统功能记录 /// </summary> /// <param name="ht2"></param> /// <returns></returns> public override int UpdateMore(Hashtable ht2) { MSystemFun MSysFun = new MSystemFun(); Hashtable htStr = new Hashtable(); Hashtable ht = new Hashtable(); if (ht2.Count > 0) { for (int i = 0; i < ht2.Count; i++) { ht.Clear(); MSysFun = (MSystemFun)ht2[i]; ht.Add("MODEL_NAME", MSysFun.MODEL_NAME); ht.Add("MODEL_PLACE", MSysFun.MODEL_PLACE); ht.Add("SORT_FLAG", MSysFun.SORT_FLAG); ht.Add("IMAGE_ADDRESS", MSysFun.IMAGE_ADDRESS); if (MSysFun.UP_MODEL_ID != null) { ht.Add("Up_MODEL_ID", MSysFun.UP_MODEL_ID); } htStr.Add(i, StringConstructor.UpdateSql(TableName, ht, " where MODEL_ID=" + MSysFun.MODEL_ID)); } return(ExecuteNonSql(htStr)); } return(0); }
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 void GvFunClassOne_CellDoubleClick(object sender, DataGridViewCellEventArgs e)//双击单元格修改 { MSysFun2 = null; DataGridView gv = new DataGridView(); //if(gv.Rows[e.RowIndex]<rowcount) gv.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.MediumPurple; //MSysFun2.MModelId=Convert.ToInt16( gv.Rows[e.RowIndex].Cells["MODEL_ID"].Value.ToString()); //MSysFun2.MModelName = gv.Rows[e.RowIndex].Cells["MODEL_NAME"].Value.ToString(); //MSysFun2.MModelPlace = gv.Rows[e.RowIndex].Cells["MODEL_PLACE"].Value.ToString(); //MSysFun2.MSortFlag =Convert.ToInt16( gv.Rows[e.RowIndex].Cells["SORT_FLAG"].Value.ToString()); }
/// <summary> /// 插入一条系统功能记录 /// </summary> /// <param name="isystemFun"></param> /// <returns></returns> public override int Add(IModel isystemFun) { MSystemFun systemFun = (MSystemFun)isystemFun; Hashtable ht = new Hashtable(); ht.Add("MODEL_ID", systemFun.MODEL_ID); ht.Add("UP_MODEL_ID", systemFun.UP_MODEL_ID); ht.Add("MODEL_CLASS", systemFun.MODEL_CLASS); ht.Add("DEL_FLAG", systemFun.DEL_FLAG); ht.Add("SORT_FLAG", systemFun.SORT_FLAG); ht.Add("MODEL_PLACE", systemFun.MODEL_PLACE); ht.Add("MODEL_NAME", systemFun.MODEL_NAME); ht.Add("IMAGE_ADDRESS", systemFun.IMAGE_ADDRESS); return(ExecuteSql(StringConstructor.InsertSql(TableName, ht).ToString())); }
/// <summary> /// 动态夹杂着子系统模块,超声科 /// </summary> private void BuildStruct()//动态加载子系统模块 { if (GetConfig.SystemType.ToUpper() == "REGISTER") { BuildStructPacs(); } else { BSystemFun BSysFun = new BSystemFun(); MSystemFun MsysFun = new MSystemFun(); DataTable dt = new DataTable(); SIS_Model.MUser muser = (SIS_Model.MUser)iUser; switch (muser.DOCTOR_ROLE) { case "1": dt = BSysFun.GetList(" MODEL_CLASS='1' AND UP_MODEL_ID=0 AND MODEL_NAME ='检查登记' ORDER BY SORT_FLAG "); break; case "2": dt = BSysFun.GetList(" MODEL_CLASS='1' AND UP_MODEL_ID=0 ORDER BY SORT_FLAG "); break; } if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { frmDockForm tsl = new frmDockForm(); tsl.DockHandler.GetPersistStringCallback = null; tsl.DockHandler.PersistString = dt.Rows[i]["MODEL_ID"].ToString(); tsl.Name = dt.Rows[i]["MODEL_ID"].ToString();//将目录ID设置为名称 tsl.Tag = "SIS.comm.ToolboxPanel"; tsl.Text = dt.Rows[i]["MODEL_NAME"].ToString(); if (dt.Rows[i]["IMAGE_ADDRESS"].ToString() != "") { tsl.Icon = new Icon(Application.StartupPath + "\\images\\" + dt.Rows[i]["IMAGE_ADDRESS"].ToString()); } tsl.p = this.p_Sub; DockForm df = new DockForm(); df.frmDock = tsl; df.isShow = false; this.frmDockList.Add(df); } } } }
/// <summary> /// 获取指定ID的系统功能记录 /// </summary> /// <param name="MODEL_ID"></param> /// <returns></returns> public override IModel GetModel(string MODEL_ID) { strSql = "select * from " + TableName + " where MODEL_ID = " + MODEL_ID; DataTable dt = GetDataTable(strSql); if (dt.Rows.Count == 0) { return(null); } MSystemFun systemFun = new MSystemFun(); systemFun.MODEL_ID = Convert.ToInt32(dt.Rows[0]["MODEL_ID"].ToString()); systemFun.MODEL_CLASS = dt.Rows[0]["MODEL_CLASS"].ToString(); systemFun.MODEL_NAME = dt.Rows[0]["MODEL_NAME"].ToString(); systemFun.MODEL_PLACE = dt.Rows[0]["MODEL_PLACE"].ToString(); systemFun.IMAGE_ADDRESS = dt.Rows[0]["IMAGE_ADDRESS"].ToString(); if (dt.Rows[0]["UP_MODEL_ID"].ToString() == "") { systemFun.UP_MODEL_ID = null; } else { systemFun.UP_MODEL_ID = Convert.ToInt32(dt.Rows[0]["UP_MODEL_ID"].ToString()); } if (dt.Rows[0]["SORT_FLAG"].ToString() == "") { systemFun.SORT_FLAG = null; } else { systemFun.SORT_FLAG = Convert.ToInt32(dt.Rows[0]["SORT_FLAG"].ToString()); } return(systemFun); }
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); }