/// <summary>Получение конечного текста записи</summary> private string f_GetDocumentText(string a_AppStartupPath, bool a_IsDoctor) { if (p_Type == E_RecordType.FinishedFile) { p_FileBytes = Cl_RecordsFacade.f_GetInstance().f_GetFileFromSql(this); if (p_FileBytes != null) { if (p_FileType == E_RecordFileType.HTML) { return(Encoding.UTF8.GetString(p_FileBytes).Replace("src=\"", "src=\"file:///" + a_AppStartupPath + "/")); } else if (p_FileType == E_RecordFileType.PDF) { return(Encoding.UTF8.GetString(p_FileBytes)); } else if (p_FileType == E_RecordFileType.JFIF || p_FileType == E_RecordFileType.JIF || p_FileType == E_RecordFileType.JPE || p_FileType == E_RecordFileType.JPEG || p_FileType == E_RecordFileType.JPG || p_FileType == E_RecordFileType.PNG || p_FileType == E_RecordFileType.GIF) { return(string.Format(@"<img src=""data:image/{0};base64,{1}"" />", Enum.GetName(typeof(E_RecordFileType), p_FileType).ToLower(), Convert.ToBase64String(p_FileBytes))); } } else { MonitoringStub.Warning("Файл отсутствует"); } } else if (a_IsDoctor && p_HTMLDoctor != null) { var res = p_HTMLDoctor.Replace("class=\"record_title_img\" src=\"", "class=\"record_title_img\" src=\"file:///" + a_AppStartupPath + "/"); res = p_HTMLDoctor.Replace("class=record_title_img src=", "class=record_title_img src=file:///" + a_AppStartupPath + "/"); return(res); } else if (!a_IsDoctor && p_HTMLPatient != null) { var res = p_HTMLPatient.Replace("class=\"record_title_img\" src=\"", "class=\"record_title_img\" src=\"file:///" + a_AppStartupPath + "/"); res = p_HTMLPatient.Replace("class=record_title_img src=", "class=record_title_img src=file:///" + a_AppStartupPath + "/"); return(res); } return(null); }
private void ctrlBLoadMedicalCard_Click(object sender, EventArgs e) { int patientId = 0; Guid patientUid = Guid.Empty; ctrlMedcardInfo.Text = ""; _currentMedCard = null; if (int.TryParse(ctrlTBPatientID.Text, out patientId)) { var medCard = Cl_MedicalCardsFacade.f_GetInstance().f_GetMedicalCard(ctrlTBMedCardNumber.Text, patientId); if (medCard != null) { ctrlMedcardInfo.Text = $"№{medCard.p_Number}, {medCard.p_PatientFIO}, {medCard.p_PatientDateBirth}"; _currentMedCard = medCard; } else { MonitoringStub.Warning("Не найдена медицинская карта"); } } else if (Guid.TryParse(ctrlTBPatientID.Text, out patientUid)) { var medCard = Cl_MedicalCardsFacade.f_GetInstance().f_GetMedicalCard(ctrlTBMedCardNumber.Text, patientUid); if (medCard != null) { ctrlMedcardInfo.Text = $"№{medCard.p_Number}, {medCard.p_PatientFIO}, {medCard.p_PatientDateBirth}"; _currentMedCard = medCard; } else { MonitoringStub.Warning("Не найдена медицинская карта"); } } else { MonitoringStub.Error("Error_Welcome", "Не верно указан Id пациента", null, null, null); } }
protected override void OnDragDrop(DragEventArgs drgevent) { string[] formats = drgevent.Data.GetFormats(); foreach (string format in formats) { var item = drgevent.Data.GetData(format); if (item is Ctrl_TreeNodeElement || item is Ctrl_TreeNodeTemplate) { if (item is Ctrl_TreeNodeElement) { Ctrl_TreeNodeElement nodeEl = (Ctrl_TreeNodeElement)item; if (f_HasElement(nodeEl.p_Element) || nodeEl.p_Element.p_Version == 0) { MonitoringStub.Warning("Элемент уже в шаблоне"); return; } } else if (item is Ctrl_TreeNodeTemplate) { Ctrl_TreeNodeTemplate nodeTemp = (Ctrl_TreeNodeTemplate)item; if (f_HasElement(nodeTemp.p_Template) || nodeTemp.p_Template.p_Version == 0) { MonitoringStub.Warning("Элемент уже в шаблоне"); return; } } } } if (this.IsDragging) { try { if (this.InsertionIndex != InvalidIndex) { int dragIndex; int dropIndex; dragIndex = (int)drgevent.Data.GetData(typeof(int)); dropIndex = this.InsertionIndex; if (dragIndex < dropIndex) { dropIndex--; } if (this.InsertionMode == I_InsertionMode.After && dragIndex < this.Items.Count - 1) { dropIndex++; } if (dropIndex != dragIndex) { //Point clientPoint = this.PointToClient(new Point(drgevent.X, drgevent.Y)); //args = new ListBoxItemDragEventArgs(dragIndex, dropIndex, this.InsertionMode, clientPoint.X, clientPoint.Y); //this.OnItemDrag(args); //if (!args.Cancel) { object dragItem; dragItem = this.Items[dragIndex]; this.Items.Remove(dragIndex); this.Items.Insert(dropIndex, dragItem); this.SelectedItem = dragItem; } } } } finally { this.Invalidate(this.InsertionIndex); this.InsertionIndex = InvalidIndex; this.InsertionMode = I_InsertionMode.None; this.IsDragging = false; } } else { if (drgevent.Data.GetData(drgevent.Data.GetFormats()[0]) is Ctrl_TreeNodeElement) { f_DragNewElement(drgevent.Data.GetData(drgevent.Data.GetFormats()[0]) as Ctrl_TreeNodeElement, drgevent.X, drgevent.Y); } else if (drgevent.Data.GetData(drgevent.Data.GetFormats()[0]) is Ctrl_TreeNodeTemplate) { f_DragNewTemplate(drgevent.Data.GetData(drgevent.Data.GetFormats()[0]) as Ctrl_TreeNodeTemplate, drgevent.X, drgevent.Y); } } base.OnDragDrop(drgevent); }