public void Get(userCtrPicture ctl) { this.drawArea.Initialize(); CurrentCtl = ctl; this.mImage = (MImage)((ImgObj)ctl.ImgObj).MImage; this.mLocMap = (MLocationMap)((ImgObj)ctl.ImgObj).MLocationMap; if (this.mLocMap != null && this.mLocMap.MAP_NAME != null && this.mLocMap.MAP_NAME != "") { this.SetLocMap(this.mLocMap.MAP_NAME); CtlComboBox.SetDisplay(this.mLocMap.MAP_PART, this.cmb_Part); this.BindExplain(this.mLocMap.MAP_NAME, this.mLocMap.MAP_PART); CtlComboBox.SetDisplay(this.mLocMap.MAP_EXPLAIN, this.cmb_Explain); if (this.mLocMap.MARK_INF != null && this.mLocMap.MARK_INF != "") { read.SetPoint(this.drawArea, this.mLocMap.MARK_INF); } else { drawArea.ActiveTool = BaseControls.ImageBox.ImageCtl.DrawToolType.Point; } } else { this.cmb_Part.Text = ""; this.cmb_Explain.Text = ""; drawArea.ActiveTool = BaseControls.ImageBox.ImageCtl.DrawToolType.Point; } if (this.cmb_TagImage.SelectedIndex == -1) { this.cmb_TagImage.SelectedIndex = 0; } }
public void PtbDbClick(userCtrPicture ctl) { CurrentCtl = ctl; this.ptb_Gather.Image = ctl.Image; this.Lb_ImgName.Text = ctl.FileName; this.mImage = (MImage)((ImgObj)ctl.ImgObj).MImage; this.mLocMap = (MLocationMap)((ImgObj)ctl.ImgObj).MLocationMap; if (this.mLocMap != null && this.mLocMap.MAP_NAME != null && this.mLocMap.MAP_NAME != "") { this.SetLocMap(this.mLocMap.MAP_NAME); CtlComboBox.SetDisplay(this.mLocMap.MAP_PART, this.cmb_Part); this.BindExplain(this.mLocMap.MAP_NAME, this.mLocMap.MAP_PART); CtlComboBox.SetDisplay(this.mLocMap.MAP_EXPLAIN, this.cmb_Explain); if (this.mLocMap.MARK_INF != null && this.mLocMap.MARK_INF != "") { read.SetPoint(this.drawArea, this.mLocMap.MARK_INF); } else { drawArea.ActiveTool = BaseControls.ImageBox.ImageCtl.DrawToolType.Point; } } else { drawArea.ActiveTool = BaseControls.ImageBox.ImageCtl.DrawToolType.Point; } }
/// <summary> /// 加载定位图片 /// </summary> /// <param name="saveDir"></param> /// <param name="MapId"></param> /// <param name="index"></param> /// <returns></returns> private int DownLoadLocMap(string saveDir, string MapId, int index) { BLocationMap bLocMap = new BLocationMap(); try { MLocationMap mLocMap = (MLocationMap)bLocMap.GetModel(MapId); if (mLocMap != null) { string Serverpath = mLocMap.MAP_PATH; string temppath = saveDir + "\\" + Serverpath.Substring(Serverpath.LastIndexOf("/") + 1); if (fileTranfer.FileDown(Serverpath, temppath) == 1) { arrayImg[index].Inf = mLocMap.MAP_EXPLAIN; arrayImg[index].LocMapPath = temppath; arrayImg[index].MLocationMap = mLocMap; } else { MessageBoxEx.Show("下载" + Serverpath + "文件失败!"); return(-1);//由于网络断开下载不成功,返回-1 } } return(0); } catch { //MessageBox.Show("下载图像失败"); return(-1); } }
/// <summary> /// 获取指定ID的定位图像记录 /// </summary> /// <param name="MAP_ID"></param> /// <returns></returns> public override IModel GetModel(string MAP_ID) { strSql = "select * from " + TableName + " where MAP_ID='" + MAP_ID + "'"; DataTable dt = GetDataTable(strSql); if (dt.Rows.Count == 0) { return(null); } MLocationMap model = new MLocationMap(); model.EXAM_ACCESSION_NUM = dt.Rows[0]["EXAM_ACCESSION_NUM"].ToString(); model.MAP_EXPLAIN = dt.Rows[0]["MAP_EXPLAIN"].ToString(); model.MAP_PATH = dt.Rows[0]["MAP_PATH"].ToString(); model.MAP_NAME = dt.Rows[0]["MAP_NAME"].ToString(); //if (dt.Rows[0]["MAP_ID"].ToString() == "") // model.MAP_ID = null; //else model.MAP_ID = Convert.ToInt32(dt.Rows[0]["MAP_ID"].ToString()); model.MAP_PART = dt.Rows[0]["MAP_PART"].ToString(); if (dt.Rows[0]["MAP_TIME"].ToString() == "") { model.MAP_TIME = null; } else { model.MAP_TIME = Convert.ToDateTime(dt.Rows[0]["MAP_TIME"].ToString()); } model.MARK_INF = dt.Rows[0]["MARK_INF"].ToString(); return(model); }
/// <summary> /// 查询是否存在指定的定位图像记录 /// </summary> /// <param name="imodel"></param> /// <returns></returns> public override bool Exists(IModel imodel) { MLocationMap model = (MLocationMap)imodel; strSql = "select * from " + TableName + " where MAP_ID='" + model.MAP_ID + "'"; return(recordIsExist(strSql)); }
public void Save() { if (this.mImage == null) { return; } Bitmap b = null, bt = null, btp = null; try { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } FileOperator ope = new FileOperator(); string newFileName = "Map" + this.CurrentCtl.FileName.Replace("Mark", ""); string Newpath = path + newFileName; b = ImageOpe.FromGraphics((Control)drawArea, drawArea.Width - 2, drawArea.Height - 2); bt = ImageOpe.KiResizeImage(b, 2 * GetConfig.RS_LocMapWidth, 2 * GetConfig.RS_LocMapHeight, 0); btp = DrawString(bt, this.cmb_Part.Text.Trim(), this.cmb_Explain.Text.Trim()); btp.Save(Newpath); if (this.mLocMap == null) { this.mLocMap = new MLocationMap(); mLocMap.MAP_ID = this.mImage.IMAGE_ID; mLocMap.EXAM_ACCESSION_NUM = this.mImage.EXAM_ACCESSION_NUM; } mLocMap.MAP_PART = this.cmb_Part.Text.Trim(); mLocMap.MAP_EXPLAIN = this.cmb_Explain.Text.Trim(); mLocMap.MAP_TIME = System.DateTime.Now; mLocMap.MARK_INF = save.SavePoint(this.drawArea); mLocMap.MAP_NAME = LocalMapName; mLocMap.MAP_PATH = this.mImage.IMAGE_PATH.Substring(0, this.mImage.IMAGE_PATH.LastIndexOf("/") + 1) + newFileName; CurrentCtl.LocMapPath = Newpath; int i = 0; ImageCopy ic = new ImageCopy(); i = ic.FileUpLoad(mLocMap, Newpath); if (i < 0) { MessageBoxEx.Show("±£´æʧ°Ü£¡", "¾¯¸æ"); } else { ((ImgObj)CurrentCtl.ImgObj).MLocationMap = mLocMap; } } catch { MessageBoxEx.Show("±£´æʧ°Ü£¡", "¾¯¸æ"); } finally { b.Dispose(); bt.Dispose(); btp.Dispose(); } }
/// <summary> /// 插入一条定位图像记录 /// </summary> /// <param name="imodel"></param> /// <returns></returns> public override int Add(IModel imodel) { MLocationMap model = (MLocationMap)imodel; Hashtable ht = new Hashtable(); ht.Add("MAP_ID", model.MAP_ID); ht.Add("EXAM_ACCESSION_NUM", model.EXAM_ACCESSION_NUM); ht.Add("MAP_PATH", model.MAP_PATH); ht.Add("MAP_PART", model.MAP_PART); ht.Add("MAP_EXPLAIN", model.MAP_EXPLAIN); ht.Add("IS_PRINT", model.IS_PRINT); ht.Add("PAGE_ORDER", model.PAGE_ORDER); ht.Add("MARK_INF", model.MARK_INF); ht.Add("MAP_TIME", model.MAP_TIME); ht.Add("MAP_NAME", model.MAP_NAME); return(ExecuteSql(StringConstructor.InsertSql(TableName, ht).ToString())); }
/// <summary> /// 上传定位图到服务器并更新数据库 /// </summary> public int FileUpLoad(MLocationMap mLocMap, string localpath) { try { fileTranfer.FileUpLoad(mLocMap.MAP_PATH, localpath); BLocationMap bLocMap = new BLocationMap(); int i = 0; if (bLocMap.Exists(mLocMap)) { i = bLocMap.Update(mLocMap, " where MAP_ID = " + mLocMap.MAP_ID); } else { i = bLocMap.Add(mLocMap); } return(1);// } catch { return(0); } }
/// <summary> /// 获取指定行的定位图像记录 /// </summary> /// <param name="dr"></param> /// <returns></returns> public override IModel GetModel(DataRow dr) { MLocationMap model = new MLocationMap(); model.EXAM_ACCESSION_NUM = dr["EXAM_ACCESSION_NUM"].ToString(); model.MAP_EXPLAIN = dr["MAP_EXPLAIN"].ToString(); model.MAP_PATH = dr["MAP_PATH"].ToString(); model.MAP_NAME = dr["MAP_NAME"].ToString(); //if (dr["MAP_ID"].ToString() == "") // model.MAP_ID = null; //else model.MAP_ID = Convert.ToInt32(dr["MAP_ID"].ToString()); model.MAP_PART = dr["MAP_PART"].ToString(); if (dr["MAP_TIME"].ToString() == "") { model.MAP_TIME = null; } else { model.MAP_TIME = Convert.ToDateTime(dr["MAP_TIME"].ToString()); } model.MARK_INF = dr["MARK_INF"].ToString(); return(model); }
private void btn_Save_Click(object sender, EventArgs e) { if (this.mImage == null) { return; } Bitmap b = null, bt = null, btp = null; try { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } FileOperator ope = new FileOperator(); string newFileName = "Map" + this.Lb_ImgName.Text; string Newpath = path + newFileName; b = ImageOpe.FromGraphics((Control)drawArea, drawArea.Width - 2, drawArea.Height - 2); bt = ImageOpe.KiResizeImage(b, 2 * GetConfig.RS_LocMapWidth, 2 * GetConfig.RS_LocMapHeight, 0); btp = DrawString(bt, this.cmb_Part.Text.Trim(), this.cmb_Explain.Text.Trim()); btp.Save(Newpath); if (this.mLocMap == null) { this.mLocMap = new MLocationMap(); mLocMap.MAP_ID = this.mImage.IMAGE_ID; mLocMap.EXAM_ACCESSION_NUM = this.mImage.EXAM_ACCESSION_NUM; } mLocMap.MAP_PART = this.cmb_Part.Text.Trim(); mLocMap.MAP_EXPLAIN = this.cmb_Explain.Text.Trim(); mLocMap.MAP_TIME = System.DateTime.Now; mLocMap.MARK_INF = save.SavePoint(this.drawArea); mLocMap.MAP_NAME = LocalMapName; mLocMap.MAP_PATH = this.mImage.IMAGE_PATH.Substring(0, this.mImage.IMAGE_PATH.LastIndexOf("/") + 1) + newFileName; ((ImgObj)CurrentCtl.ImgObj).MLocationMap = (object)mLocMap; CurrentCtl.LocMapPath = Newpath; int i = 0; ImageCopy ic = new ImageCopy(); i = ic.FileUpLoad(mLocMap, Newpath); if (i < 0) { MessageBoxEx.Show("保存失败!", "警告"); } if (this.isRpt) { ((ImgObj)CurrentCtl.ImgObj).MLocationMap = mLocMap; if (!this.CurrentCtl.GetCheck()) { this.CurrentCtl.SetCheck(true); } else { this.word.PasteImgWithLocMap(this.CurrentCtl.FilePath, this.CurrentCtl.LocMapPath); } this.Close(); } } catch { MessageBoxEx.Show("保存失败!", "警告"); } finally { b.Dispose(); bt.Dispose(); btp.Dispose(); } }