private void btnSave_Click(object sender, EventArgs e) { ThisAddIn.ResetBeginTime(); XmlDocument doc = new XmlDocument(); XmlElement rules = doc.CreateElement(ElementNames.Rules); #region Put into database using (gjtEmrService.emrServiceXml es = new gjtEmrService.emrServiceXml()) { try { string msg = ""; foreach (Control cc in pnlNote.Controls) { FilingUC FilingUC = (FilingUC)cc; msg = es.NewFilingSetup(RegistryID, FilingUC.GetNoteID().Trim(), rules, Globals.DoctorID); } if (pnlNote.Controls.Count == 0) { if (szlx == "个人") { MessageBox.Show("个人归档项目设置为空,将自动引用此人所属科室归档项目", "提示"); return; } else { MessageBox.Show("设置完成", "提示"); return; } } if (msg == null) { MessageBox.Show("设置完成", "提示"); return; } else { MessageBox.Show(msg, ErrorMessage.Error); return; } } catch (Exception ex) { Globals.logAdapter.Record("EX925511256895", ex.Message + ">>" + ex.ToString(), true); return; } } #endregion ThisAddIn.ResetBeginTime(); }
private bool IsExist(string noteID) { foreach (Control cc in pnlNote.Controls) { FilingUC FilingUC = (FilingUC)cc; if (noteID.Trim() == FilingUC.GetNoteID().Trim()) { return(true); } } return(false); }
private void NewFilingUC(string noteID, string noteName) { if (IsExist(noteID)) { return; } FilingUC note = new FilingUC(RegistryID, noteID, noteName); pnlNote.Controls.Add(note); pnlNote.Controls[noteCount].Location = NewFilingUCLocation(note); noteCount++; }
private void RemoveFilingUC(string noteID) { foreach (Control ctrl in pnlNote.Controls) { FilingUC nuc = (FilingUC)ctrl; if (noteID == nuc.GetNoteID()) { pnlNote.Controls.Remove(ctrl); noteCount--; return; } } }
private Point NewFilingUCLocation(FilingUC note) { int colCount = pnlNote.Width / (note.Width + 2); int top = 0; int left = 0; if (colCount == 0) { top = noteCount * (note.Height + 2); } else { top = noteCount / colCount * (note.Height + 2); left = noteCount % colCount * (note.Width + 2); } return(new Point(left, top)); }