public static MyRenderDeviceSettings CreateDevice(IntPtr windowHandle, MyRenderDeviceSettings?settingsToTry) { Debug.Assert(Device == null, "Device was not properly released"); // try first settingsToTry (if available) // if that doesn't work, try again using desktop fullscreen settings // if that doesn't work, use fallback settings (800x600 or 640x480 in window) and hope for the best m_windowHandle = windowHandle; var deviceType = DeviceType.Hardware; int adapterOrdinal = 0; if (settingsToTry.HasValue) { adapterOrdinal = settingsToTry.Value.AdapterOrdinal; } EnablePerfHUD(m_d3d, ref adapterOrdinal, ref deviceType); bool deviceCreated = false; if (settingsToTry.HasValue) { try { var settings = settingsToTry.Value; var originalWindowMode = settings.WindowMode; settings.AdapterOrdinal = adapterOrdinal; settings.WindowMode = MyWindowModeEnum.Window; TryCreateDeviceInternal(windowHandle, deviceType, settings, out m_device, out m_parameters); Debug.Assert(m_device != null); m_settings = settings; bool modeExists = false; foreach (var mode in m_adaptersList[settings.AdapterOrdinal].SupportedDisplayModes) { if (mode.Width == m_settings.BackBufferWidth && mode.Height == m_settings.BackBufferHeight && mode.RefreshRate == m_settings.RefreshRate) { modeExists = true; break; } } if (!modeExists) { var fallbackMode = m_adaptersList[settings.AdapterOrdinal].SupportedDisplayModes.Last(x => true); m_settings.BackBufferHeight = fallbackMode.Height; m_settings.BackBufferWidth = fallbackMode.Width; m_settings.RefreshRate = fallbackMode.RefreshRate; } if (originalWindowMode != m_settings.WindowMode) { m_settings.WindowMode = originalWindowMode; ApplySettings(m_settings); } deviceCreated = true; } catch { /* These settings don't work so we'll try different. Dispose device in case it failed while switching to fullscreen. */ DisposeDevice(); } } if (!deviceCreated) { // find the best match among supported display modes var adapters = GetAdaptersList(); int i = 0; int j = 0; for (; i < adapters.Length; ++i) { for (j = 0; j < adapters[i].SupportedDisplayModes.Length; ++j) { #if !XB1 var bounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds; if (adapters[i].SupportedDisplayModes[j].Width == bounds.Width && adapters[i].SupportedDisplayModes[j].Height == bounds.Height) { goto DISPLAY_MODE_FOUND_LABEL; } #else // XB1 System.Diagnostics.Debug.Assert(false, "XB1 TODO?"); #endif // XB1 } } DISPLAY_MODE_FOUND_LABEL: if (i != adapters.Length) // found appropriate display mode { var displayMode = adapters[i].SupportedDisplayModes[j]; var bestFitSettings = new MyRenderDeviceSettings() { AdapterOrdinal = i, BackBufferWidth = displayMode.Width, BackBufferHeight = displayMode.Height, RefreshRate = displayMode.RefreshRate, VSync = true, WindowMode = MyWindowModeEnum.Window, // initially create windowed, we change it to fullscreen afterwards }; try { TryCreateDeviceInternal(windowHandle, deviceType, bestFitSettings, out m_device, out m_parameters); Debug.Assert(m_device != null); m_settings = bestFitSettings; m_settings.WindowMode = MyWindowModeEnum.Fullscreen; ApplySettings(m_settings); deviceCreated = true; } catch { /* Doesn't work again. */ DisposeDevice(); } } } if (!deviceCreated) { var simpleSettings = new MyRenderDeviceSettings() { AdapterOrdinal = 0, BackBufferHeight = 480, BackBufferWidth = 640, WindowMode = MyWindowModeEnum.Window, VSync = true, }; try { TryCreateDeviceInternal(windowHandle, deviceType, simpleSettings, out m_device, out m_parameters); Debug.Assert(m_device != null); m_settings = simpleSettings; deviceCreated = true; } catch { // These settings don't work either so we're done here. #if !XB1 MyMessageBox.Show("Unsupported graphics card", "Graphics card is not supported, please see minimum requirements"); #else // XB1 System.Diagnostics.Debug.Assert(false, "Unsupported graphics card"); #endif // XB1 throw; } } SupportsHDR = GetAdaptersList()[m_settings.AdapterOrdinal].HDRSupported; return(m_settings); }
private async void GenerateButton_Click(object sender, RoutedEventArgs e) { try { if (extendedJObject != null) { var msg = extendedJObject.HasEmptyProperties(); if (msg != null) { MyMessageBox.Show(msg); return; } } if (extendedJObject != null) { StringBuilder sb = new StringBuilder(); if (!String.IsNullOrWhiteSpace(ConfigHelper.Instance.Config.FileHeaderInfo)) { var info = ConfigHelper.Instance.Config.FileHeaderInfo; //[Date MM-dd HH:mm] try { var start = info.IndexOf("[Date"); var startIndex = start; if (start >= 0) { start = start + "[Date".Length; var end = info.IndexOf("]", start); if (end >= start) { var format = info.Substring(start, end - start).Trim(); var replaceString = info.Substring(startIndex, end - startIndex + 1); if (format == null || format == "") { format = "yyyy MM-dd"; } info = info.Replace(replaceString, DateTime.Now.ToString(format)); } } } catch (Exception ex) { MyMessageBox.Show("[Date]时间格式有问题"); } sb.AppendLine(info); sb.AppendLine(""); } sb.AppendLine(DartHelper.JsonImport); if (ConfigHelper.Instance.Config.AddMethod) { if (ConfigHelper.Instance.Config.EnableArrayProtection) { sb.AppendLine(DartHelper.DebugPrintImport); sb.AppendLine(""); sb.AppendLine(DartHelper.TryCatchMethod); sb.AppendLine(""); } sb.AppendLine(ConfigHelper.Instance.Config.EnableDataProtection ? DartHelper.AsTMethodWithDataProtection : DartHelper.AsTMethod); sb.AppendLine(""); } sb.AppendLine(extendedJObject.ToString()); var result = sb.ToString(); #if WINDOWS_UWP || WPF if (ConfigHelper.Instance.Config.EnableDartFormat) { result = await DartHelper.FormatCode(result); } #endif tb.Text = result; #if WINDOWS_UWP var dp = new DataPackage(); dp.SetText(result); Clipboard.SetContent(dp); XDocument xd = XDocument.Load("Assets/Toast.xml"); XmlDocument doc = new XmlDocument(); doc.LoadXml(xd.ToString()); ToastNotification notification = new ToastNotification(doc); notification.ExpirationTime = DateTime.Now.AddSeconds(2); ToastNotificationManager.CreateToastNotifier().Show(notification); #else Clipboard.SetText(result); MyMessageBox.Show("Dart生成成功\n已复制到剪切板"); #endif } } catch (Exception ex) { HideProgressRing(); MyMessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
private void Button_Click_2(object sender, RoutedEventArgs e) { MyMessageBox myMessageBox = new MyMessageBox(); myMessageBox.Show(); }
private void button2_Click(object sender, EventArgs e) { if (itemId == "0") { try { using (SqlConnection connection = new SqlConnection(global::GymMembershipSystem.Properties.Settings.Default.GymMembershipSystemDatabase)) { using (SqlCommand command2 = new SqlCommand("INSERT INTO Items(ItemName, ItemId, ItemPrice, ItemCount, ItemDescription) " + "VALUES(@ItemName, @ItemId, @ItemPrice, @ItemCount, @ItemDescription)", connection)) { command2.Parameters.AddWithValue("@ItemName", itemname.Text.ToUpper()); command2.Parameters.AddWithValue("@ItemId", Convert.ToInt32(itemid2.Text)); command2.Parameters.AddWithValue("@ItemPrice", itemprice2.Text); command2.Parameters.AddWithValue("@ItemCount", Convert.ToInt32(itemcount1.Text)); command2.Parameters.AddWithValue("@ItemDescription", itemdesc1.Text); command2.Connection.Open(); command2.ExecuteNonQuery(); command2.Connection.Close(); saveImage(); itemname.Clear(); getLastIndex(); itemprice2.Clear(); itemcount1.Clear(); itemdesc1.Clear(); List <Label> Labels = new List <Label>(); Labels.Add(MyLabel.SetOKLabel("Adding Items")); Labels.Add(MyLabel.SetOKLabel("Sucessfully added item.")); List <Button> Buttons = new List <Button>(); Buttons.Add(MyButton.SetOKThemeButton()); MyMessageBox.Show( Labels, "", Buttons, MyImage.SetSuccess()); } } } catch (Exception ex) { List <Label> Labels = new List <Label>(); Labels.Add(MyLabel.SetOKLabel("General Error")); Labels.Add(MyLabel.SetOKLabel(ex.Message)); List <Button> Buttons = new List <Button>(); Buttons.Add(MyButton.SetOKThemeButton()); MyMessageBox.Show( Labels, "", Buttons, MyImage.SetFailed()); } } else { try { using (SqlConnection connection = new SqlConnection(global::GymMembershipSystem.Properties.Settings.Default.GymMembershipSystemDatabase)) { using (SqlCommand command = new SqlCommand("UPDATE Items SET ItemCount" + "=@Count, ItemPrice=@Price WHERE ItemId=@itemid", connection)) { command.Parameters.AddWithValue("@Count", itemcount1.Text); command.Parameters.AddWithValue("@Price", itemprice2.Text); command.Parameters.AddWithValue("@itemid", itemId); command.Connection.Open(); command.ExecuteNonQuery(); command.Connection.Close(); List <Label> Labels = new List <Label>(); Labels.Add(MyLabel.SetOKLabel("Updating Items")); Labels.Add(MyLabel.SetOKLabel("Sucessfully updated item.")); List <Button> Buttons = new List <Button>(); Buttons.Add(MyButton.SetOKThemeButton()); MyMessageBox.Show( Labels, "", Buttons, MyImage.SetSuccess()); } } } catch (Exception ex) { List <Label> Labels = new List <Label>(); Labels.Add(MyLabel.SetOKLabel("General Error")); Labels.Add(MyLabel.SetOKLabel(ex.Message)); List <Button> Buttons = new List <Button>(); Buttons.Add(MyButton.SetOKThemeButton()); MyMessageBox.Show( Labels, "", Buttons, MyImage.SetFailed()); } } }
private void Polyline_MouseDown(object sender, MouseButtonEventArgs e) { Polyline polyline = sender as Polyline; LineInfo info = (LineInfo)polyline.Tag; string[] ress = info.Info.Split('|'); int ss = int.Parse(ress[0]); string[] fi = ress[1].Split(new char[] { '=', '+', '*', 'X' }); double b = double.Parse(fi[1]); double m = double.Parse(fi[4]); double c = double.Parse(fi[5]); string tt = ""; switch (ss) { case 0: tt = "基本的函数:" + b + "X**" + m + "+" + c; break; case 1: tt = "Sin()函数:" + b + "Sin(X**" + m + ")+" + c; break; case 2: tt = "Cos()函数:" + b + "Cos(X**" + m + ")+" + c;; break; case 3: tt = "Tan()函数:" + b + "Tan(X**" + m + ")+" + c;; break; } switch (MyMessageBox.Show("是否删除此条函数线?\n" + tt, "提示", MyMessageBox.MyMessageBoxButton.ConfirmNOButton, "删除该曲线", "取消", "查找值")) { case MyMessageBox.MyMessageBoxResult.Comfirm: temp = info.Info; int x = Lines.FindIndex(pre); Lines.RemoveAt(x); temp = ""; Draw(); break; case MyMessageBox.MyMessageBoxResult.Buttons: InputBox inputBox = new InputBox(); string res = inputBox.Show("请输入X的值:", "查找Y值"); if (isNum(res) == true) { double xv = double.Parse(res); switch (ss) { case 0: MessageBox.Show("当X=" + xv + "时\nY=" + (b * Math.Pow(xv, m) + c).ToString(), "结果"); break; case 1: MessageBox.Show("当X=" + xv + "时\nY=" + (b * Math.Sin(Math.Pow(xv, m)) + c).ToString(), "结果"); break; case 2: MessageBox.Show("当X=" + xv + "时\nY=" + (b * Math.Cos(Math.Pow(xv, m)) + c).ToString(), "结果"); break; case 3: MessageBox.Show("当X=" + xv + "时\nY=" + (b * Math.Tan(Math.Pow(xv, m)) + c).ToString(), "结果"); break; } } else { MessageBox.Show("输入错误", "错误"); } break; } }
public bool Registration(string password1, string password2) { Reg_Password = password1; Db_Password = password2; if (!String.IsNullOrEmpty(Name) && !String.IsNullOrEmpty(Reg_Login) && !String.IsNullOrEmpty(Reg_Password) && !String.IsNullOrEmpty(Db_Password)) { if (Group >= 1 && Group <= 10) { if (Course >= 1 && Course <= 5) { if (Subgroup == 1 || Subgroup == 2) { if (NumStudCard.ToString().Length == 8) { if (password1.Equals(password2)) { User tmp1 = eFUser.GetUserByLogin(Reg_Login); Student tmp2 = eFStudent.GetStudentById(NumStudCard); if (tmp2 == null) { if (tmp1 == null) { Model.Group tmp = eFGroup.GetGroup(Group, Course, Subgroup); if (tmp == null) { eFGroup.addGroup(new Model.Group(Group, Course, Subgroup)); } eFStudent.addStudent(new Student(NumStudCard, eFGroup.GetGroup(Group, Course, Subgroup).idGroup, Name)); eFUser.addUser(new User(NumStudCard, Reg_Login, User.getHash(Reg_Password))); eFUser.Save(); return(true); } else { MyMessageBox.Show("User with this login already exists!", MessageBoxButton.OK); return(false); } } else { MyMessageBox.Show("A user with that student card number is already there!", MessageBoxButton.OK); return(false); } } else { MyMessageBox.Show("Passwords must match!", MessageBoxButton.OK); return(false); } } else { MyMessageBox.Show("Student card number must contain 8 digits!", MessageBoxButton.OK); return(false); } } else { MyMessageBox.Show("Subgroup must be 1 or 2!", MessageBoxButton.OK); return(false); } } else { MyMessageBox.Show("Course must be 1-5!", MessageBoxButton.OK); return(false); } } else { MyMessageBox.Show("Group must be 1-10!", MessageBoxButton.OK); return(false); } } else { MyMessageBox.Show("Check entered data!", MessageBoxButton.OK); return(false); } }
/// <summary> /// tabControl 索引变化时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tabControl_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) { try { int i = tabControl.SelectedTabPageIndex; switch (i) { case 0: this.baBtnSubmit.Enabled = true; this.baBtnEdit.Enabled = true; this.baBtnDel.Enabled = true; // this.baBtnRead.Enabled = false; this.baBtnApplyDe.Enabled = false; this.baBtnFeed.Enabled = false; this.baBtnBack.Enabled = false; this.baBtnReason.Enabled = false; break; case 1: this.baBtnSubmit.Enabled = false; this.baBtnEdit.Enabled = false; this.baBtnDel.Enabled = false; // this.baBtnRead.Enabled = true; this.baBtnApplyDe.Enabled = true; this.baBtnFeed.Enabled = true; this.baBtnBack.Enabled = false; this.baBtnReason.Enabled = false; break; case 2: this.baBtnSubmit.Enabled = false; this.baBtnEdit.Enabled = false; this.baBtnDel.Enabled = false; // this.baBtnRead.Enabled = false; this.baBtnApplyDe.Enabled = false; this.baBtnFeed.Enabled = false; this.baBtnBack.Enabled = true; this.baBtnReason.Enabled = false; break; case 3: this.baBtnSubmit.Enabled = false; this.baBtnEdit.Enabled = false; this.baBtnDel.Enabled = false; // this.baBtnRead.Enabled = false; this.baBtnApplyDe.Enabled = false; this.baBtnFeed.Enabled = false; this.baBtnBack.Enabled = false; this.baBtnReason.Enabled = true; break; case 4: this.baBtnSubmit.Enabled = false; this.baBtnEdit.Enabled = false; this.baBtnDel.Enabled = false; // this.baBtnRead.Enabled = false; this.baBtnApplyDe.Enabled = false; this.baBtnFeed.Enabled = false; this.baBtnBack.Enabled = false; this.baBtnReason.Enabled = false; break; case 5: this.baBtnSubmit.Enabled = false; this.baBtnEdit.Enabled = false; this.baBtnDel.Enabled = false; // this.baBtnRead.Enabled = false; this.baBtnApplyDe.Enabled = false; this.baBtnFeed.Enabled = false; this.baBtnBack.Enabled = false; this.baBtnReason.Enabled = false; break; default: break; } UserControlDB(i); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 检查是否出现相同时间的问题 /// </summary> /// <returns></returns> private bool CheckEmrDateIsSame() { try { DataTable dt = gridControlDailyEmr.DataSource as DataTable; foreach (DataRow dataRow in dt.Rows) { string captiondatetime = dataRow["EMRDATE"] + " " + dataRow["EMRTIME"]; int cnt = dt.AsEnumerable().Cast <DataRow>().Where(row => { if (row["EMRDATE"] + " " + row["EMRTIME"] == captiondatetime) { return(true); } return(false); }).Count(); if (cnt > 1) { MyMessageBox.Show("病程记录:" + dataRow["EMRNAME"].ToString() + " 的病程时间出现重复请修改。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); return(true); } } //获取内存中所有病程的节点 List <EmrModel> emrModelList = Util.GetAllEmrModels(m_CurrentUCEmrInput.CurrentInputBody.CurrentTreeList.Nodes, new List <EmrModel>()); emrModelList = emrModelList.Where(emrModel => { return(emrModel.ModelCatalog == "AC"); }).ToList(); if (emrModelList.Count > 0) { foreach (DataRow dataRow in dt.Rows) { string captiondatetime = dataRow["EMRDATE"] + " " + dataRow["EMRTIME"]; int cnt = emrModelList.Where(model => { if (model.DisplayTime.ToString("yyyy-MM-dd HH:mm:ss") == captiondatetime) { return(true); } return(false); }).Count(); if (cnt >= 1) { MyMessageBox.Show("病程记录:" + dataRow["EMRNAME"].ToString() + " 的病程时间出现重复请修改。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); return(true); } } } //获取数据库中所有的病程节点 List <string> captionDateTimeList = GetDailyEmrModel(m_CurrentUCEmrInput.CurrentInpatient.NoOfFirstPage.ToString()); if (captionDateTimeList.Count > 0) { foreach (DataRow dataRow in dt.Rows) { string captiondatetime = dataRow["EMRDATE"] + " " + dataRow["EMRTIME"]; int cnt = captionDateTimeList.Where(cpDateTime => { if (cpDateTime == captiondatetime) { return(true); } return(false); }).Count(); if (cnt >= 1) { MyMessageBox.Show("病程记录:" + dataRow["EMRNAME"].ToString() + " 的病程时间出现重复请修改。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); return(true); } } } return(false); } catch (Exception ex) { MyMessageBox.Show(1, ex); return(false); } }
private void Login() { JObject jObj = new JObject(); string username = tb_username.Text.Trim(); string password = tb_password.Text; //检查输入是否为空 if (string.IsNullOrEmpty(username)) { MyMessageBox.Show(ResourceCulture.GetString("please_input_username")); tb_username.Focus(); return; } if (string.IsNullOrEmpty(password)) { MyMessageBox.Show(ResourceCulture.GetString("please_input_password")); tb_password.Focus(); return; } //检查是否正在连接 if (task != null && task.Status == TaskStatus.Running) { return; } //组装JSON字符串 jObj.Add("username", username); jObj.Add("password", MD5.GetMD5(password)); string urlStr = "LoginHandler.ashx"; FlushCursor(Cursors.WaitCursor); //将用户名和密码放入JSON字符串中并发送HTTP请求,取得返回结果并分析(异步) task = HttpHelper.ConnectionForResultAsync(urlStr, jObj.ToString()); task.ContinueWith((curTask) => { //光标切换回正常 FlushCursor(Cursors.Default); //取得Task的返回结果 string result = curTask.Result; //没有任何响应:连接失败 if (string.IsNullOrEmpty(result)) { MyMessageBox.Show(ResourceCulture.GetString("connect_timeout")); return; } //连接成功,分析状态码 JObject jObjResult = JObject.Parse(result); string state = (string)jObjResult.Property("state"); switch (state) { case "username not exist": MyMessageBox.Show(ResourceCulture.GetString("username_not_exist")); break; case "success": //得到医生信息 string content = (string)jObjResult.Property("content"); DoctorModel doctorModel = JsonConvert.DeserializeObject <DoctorModel>(content); //保存到全局数据 LoginStatus.SaveLoginStatus(doctorModel); this.SafeClose(); break; case "password error": MyMessageBox.Show(ResourceCulture.GetString("password_error")); break; default: MyMessageBox.Show(ResourceCulture.GetString("data_error")); return; } }); }
private void LoadFile(LoadType loadType, string filename, Stream isoStream, Stream tblStream) { BackgroundWorker worker = new BackgroundWorker(); worker.WorkerSupportsCancellation = true; worker.WorkerReportsProgress = true; DialogResult missingFilesResult = DialogResult.No; string missingFilesIsoFilename = null; MethodInvoker missingPrompt = null; missingPrompt = delegate() { var res = MyMessageBox.Show(this, "Some files are missing." + Environment.NewLine + "Load missing files from ISO?", "Files missing", MessageBoxButtons.YesNoCancel); if (res == DialogResult.Yes) { openFileDialog.Filter = "ISO files (*.iso, *.bin, *.img)|*.iso;*.bin;*.img"; openFileDialog.FileName = string.Empty; if (openFileDialog.ShowDialog(this) == DialogResult.OK) { missingFilesIsoFilename = openFileDialog.FileName; } else { missingPrompt(); } } missingFilesResult = res; }; worker.DoWork += delegate(object sender, DoWorkEventArgs args) { FFTText text = null; switch (loadType) { case LoadType.Open: Set <Guid> missing = FFTTextFactory.DetectMissingGuids(filename); if (missing.Count > 0) { if (InvokeRequired) { Invoke(missingPrompt); } else { missingPrompt(); } if (missingFilesResult == DialogResult.Yes) { using (Stream missingStream = File.OpenRead(missingFilesIsoFilename)) { text = FFTTextFactory.GetFilesXml(filename, worker, missing, missingStream); } } else if (missingFilesResult == DialogResult.Cancel) { text = null; } else if (missingFilesResult == DialogResult.No) { text = FFTTextFactory.GetFilesXml(filename, worker); } } else { text = FFTTextFactory.GetFilesXml(filename, worker); } break; case LoadType.PspFilename: text = FFTText.ReadPSPIso(filename, worker); break; case LoadType.PsxFilename: text = FFTText.ReadPSXIso(filename, worker); break; } if (text == null || worker.CancellationPending) { args.Cancel = true; return; } LoadFile(text); }; MethodInvoker enableForm = delegate() { fileMenuItem.Enabled = true; isoMenuItem.Enabled = true; textMenuItem.Enabled = true; fileEditor1.Enabled = true; helpMenuItem.Enabled = true; generateResourcesZipMenuItem.Enabled = true; editMenuItem.Enabled = true; regulateNewlinesMenuItem.Enabled = true; Cursor = Cursors.Default; }; worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs args) { if (args.Error != null) { MyMessageBox.Show(this, "Error loading file: " + args.Error.Message, "Error", MessageBoxButtons.OK); } if (InvokeRequired) { Invoke(enableForm); } else { enableForm(); } }; fileMenuItem.Enabled = false; isoMenuItem.Enabled = false; textMenuItem.Enabled = false; fileEditor1.Enabled = false; helpMenuItem.Enabled = false; generateResourcesZipMenuItem.Enabled = false; editMenuItem.Enabled = false; regulateNewlinesMenuItem.Enabled = false; Cursor = Cursors.WaitCursor; worker.RunWorkerAsync(); }
private void Button_Click(Object sender, EventArgs e) { if (sender == Button_Start) { if (Parties.Any()) { SearchQuery Query_Search = Session.CreateSearchQuery(); Query_Search.Limit = 0; Query_Search.CombineResults = ConditionGroupOperation.Or; CardTypeQuery Query_CardType = Query_Search.AttributiveSearch.CardTypeQueries.AddNew(CardOrd.ID); SectionQuery Query_Section = Query_CardType.SectionQueries.AddNew(CardOrd.MainInfo.ID); Query_Section.Operation = SectionQueryOperation.And; Query_Section.ConditionGroup.Operation = ConditionGroupOperation.And; Query_Section.ConditionGroup.Conditions.AddNew(CardOrd.MainInfo.Type, FieldType.RefId, ConditionOperation.Equals, MyHelper.RefType_ListofDocs); Query_Section = Query_CardType.SectionQueries.AddNew(CardOrd.Properties.ID); Query_Section.Operation = SectionQueryOperation.And; Query_Section.ConditionGroup.Operation = ConditionGroupOperation.And; Query_Section.ConditionGroup.Conditions.AddNew(CardOrd.Properties.Name, FieldType.Unistring, ConditionOperation.Equals, RefPropertiesListOfDocs.Requisities.Party); ConditionGroup Query_ConditionGroup = Query_Section.ConditionGroup.ConditionGroups.AddNew(); Query_ConditionGroup.Operation = ConditionGroupOperation.Or; foreach (SelectionItem Party in Parties) { Condition Query_Condition = Query_ConditionGroup.Conditions.AddNew(CardOrd.Properties.Value, FieldType.RefId, ConditionOperation.Equals, Party.Id); Query_Condition.FieldSubtype = FieldSubtype.Universal; Query_Condition.FieldSubtypeId = MyHelper.RefItem_Party; } CardDataCollection ListOfDocsDatas = Session.CardManager.FindCards(Query_Search.GetXml()); if (ListOfDocsDatas.Count > 0) { List <Guid> WrongPartyIds = ListOfDocsDatas.Select(card => card.Sections[CardOrd.Properties.ID].GetPropertyValue(RefPropertiesListOfDocs.Requisities.Party).ToGuid()) .Where(g => !g.IsEmpty()).Distinct().ToList(); List <String> WrongPartyNames = WrongPartyIds.Select(WrongPartyId => Edit_Parties.SelectedItems.FirstOrDefault(item => item.ObjectId == WrongPartyId)) .Where(item => !item.IsNull()).Select(item => "«" + item.DisplayValue + "»").ToList(); if (WrongPartyNames.Any()) { if (WrongPartyNames.Count == 1) { MyMessageBox.Show("Партия " + WrongPartyNames[0] + " уже запущена в производство." + Environment.NewLine + "Удалите её из списка!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MyMessageBox.Show("Партии " + WrongPartyNames.Aggregate((a, b) => a + ", " + b) + " уже запущены в производство." + Environment.NewLine + "Удалите их из списка!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); } DialogResult = DialogResult.None; } } } else { MyMessageBox.Show("Не выбрано ни одной партии!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); DialogResult = DialogResult.None; } } else { DialogResult = DialogResult.None; } }
public void OnFailure() { MyMessageBox.Show(Window, "Đăng nhập thất bại", "Tên đăng nhập hoặc mật khẩu không đúng"); }
private void stworzRdp(string rdpDirectory, string nazwa, string adresRDP, string login, string haslo = "") { try { bool rdpJuzIstnieje = false; DirectoryInfo dir = new DirectoryInfo(rdpDirectory); FileInfo[] files = dir.GetFiles(); foreach (FileInfo s in files) { if (s.Name == nazwa + ".rdp") { File.Delete(s.FullName); } } if (rdpJuzIstnieje == false) { StreamWriter writer = File.CreateText(rdpDirectory + nazwa + ".rdp"); Process process = new Process(); process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.FileName = "cmdkey"; process.StartInfo.Arguments = "/generic:TERMSRV/" + adresRDP + " /user:"******" /pass:"******"screen mode id:i:2"); writer.WriteLine("desktopwidth:i:1280"); writer.WriteLine("desktopheight:i:800"); writer.WriteLine("session bpp:i:32"); writer.WriteLine("winposstr:s:0,1,237,52,1037,652"); writer.WriteLine("full address:s:" + adresRDP); writer.WriteLine("compression:i:1"); writer.WriteLine("keyboardhook:i:2"); writer.WriteLine("audiomode:i:0"); writer.WriteLine("redirectprinters:i:1"); writer.WriteLine("redirectcomports:i:0"); writer.WriteLine("redirectsmartcards:i:1"); writer.WriteLine("redirectclipboard:i:1"); writer.WriteLine("redirectposdevices:i:0 "); writer.WriteLine("displayconnectionbar:i:1 "); writer.WriteLine("autoreconnection enabled:i:1 "); writer.WriteLine("authentication level:i:2 "); writer.WriteLine("prompt for credentials:i:0 "); writer.WriteLine("negotiate security layer:i:1 "); writer.WriteLine("remoteapplicationmode:i:0 "); writer.WriteLine("alternate shell:s: "); writer.WriteLine("shell working directory:s: "); writer.WriteLine("disable wallpaper:i:0 "); writer.WriteLine("disable full window drag:i:0 "); writer.WriteLine("allow desktop composition:i:1 "); writer.WriteLine("allow font smoothing:i:1 "); writer.WriteLine("disable menu anims:i:0 "); writer.WriteLine("disable themes:i:0 "); writer.WriteLine("disable cursor setting:i:0 "); writer.WriteLine("bitmapcachepersistenable:i:1 "); writer.WriteLine("gatewayhostname:s: "); writer.WriteLine("gatewayusagemethod:i:0 "); writer.WriteLine("gatewaycredentialssource:i:4 "); writer.WriteLine("gatewayprofileusagemethod:i:0 "); writer.WriteLine("redirectdrives:i:0 "); writer.WriteLine("username:s:" + login); writer.WriteLine("promptcredentialonce:i:1 "); writer.WriteLine("drivestoredirect:s: "); writer.Close(); } } catch (Exception ex) { MyMessageBox.Show(ex.Message, "Błąd", MyMessageBoxButtons.Ok); return; } }
private void btnOk_Click(object sender, EventArgs e) { try { if (checkedListBoxControlEmrNode.CheckedItems.Count == 0) { MyMessageBox.Show("没有需要导入的病历,请勾选【病历列表】中的病历。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); return; } else { List <EmrNode> emrNodeList = new List <EmrNode>(); foreach (ListBoxItem item in checkedListBoxControlEmrNode.CheckedItems) { EmrNode emrNode = item.Value as EmrNode; emrNodeList.Add(emrNode); } if (emrNodeList.Any(node => { if (node.DataRowItem["sortid"].ToString() == "AC") { return(true); } return(false); })) { //检查在内存中或数据库中是否存在首次病程 bool isHaveFirstDailyEmr = CheckIsHaveFirstDailyEmr(); //判断是否选择首次病程 if (emrNodeList.Any(node => { if (node.DataRowItem["sortid"].ToString() == "AC" && node.DataRowItem["isfirstdaily"].ToString() == "1") { return(true); } return(false); })) {//有选择首次病程 if (isHaveFirstDailyEmr) { MyMessageBox.Show("已经存在首次病程,不能重复导入", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); return; } } else {//没有选择首次病程 if (!isHaveFirstDailyEmr) { MyMessageBox.Show("导入病程时同时需要导入首次病程,请选择", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); return; } } int dayCnt = 0; emrNodeList = emrNodeList.OrderBy(node => { return(Convert.ToDateTime(node.DataRowItem["captiondatetime"])); }).ToList(); foreach (EmrNode node in emrNodeList) { if (node.DataRowItem["sortid"].ToString() == "AC") { node.DataRowItem["captiondatetime"] = System.DateTime.Now.AddDays(dayCnt).ToString("yyyy-MM-dd HH:mm:ss"); dayCnt++; } } HistoryEmrTimeAndCaption timeAndCaption = new HistoryEmrTimeAndCaption(emrNodeList, m_CurrentUCEmrInput); timeAndCaption.StartPosition = FormStartPosition.CenterScreen; if (timeAndCaption.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //保存选中的历史病历 m_HistoryEmrBll.HistoryEmrBatchIn(emrNodeList, m_DeptChangeID); MyMessageBox.Show("历史病历导入成功", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.InformationIcon); this.Close(); RefreshEMRMainPad(); return; } else { return; } } //保存选中的历史病历 m_HistoryEmrBll.HistoryEmrBatchIn(emrNodeList, m_DeptChangeID); MyMessageBox.Show("历史病历导入成功", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.InformationIcon); this.Close(); RefreshEMRMainPad(); return; } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 初始化,自定义窗体,和TabControl项数据 /// </summary> private void InitUserControl() { try { m_WaitDialog = new DevExpress.Utils.WaitDialogForm("正在查询数据...", "请稍等"); int index = this.tabControl.SelectedTabPageIndex; if (listAll.Count == 0) { int st = 0; for (int i = 0; i < this.tabControl.TabPages.Count; i++) { switch (i) { case 0: st = 0; break; case 1: st = 2; break; case 2: st = 1; break; case 3: st = 3; break; case 4: st = 5; break; case 5: st = 4; break; default: st = 0; break; } DataTable table = GetInitDB(i, st); int rowscount = table.Rows.Count; RefreshInformation(i, rowscount); if (i == index) { MedicalRecordBrowse medicalrecordbrowse = new MedicalRecordBrowse(i, st, table); medicalrecordbrowse.Dock = DockStyle.Fill; listAll.Add(new RecordModel(i, st, rowscount, medicalrecordbrowse, table)); tabControl.TabPages[i].Controls.Add(medicalrecordbrowse); medicalrecordbrowse.OnButtonClick += new MedicalRecordBrowse.MyControlEventHandler(OnButtonClick); } else { listAll.Add(new RecordModel(i, st, rowscount, null, table)); } } } else { UserControlDB(index); } m_WaitDialog.Close(); } catch (Exception ex) { m_WaitDialog.Close(); MyMessageBox.Show(1, ex); } }
public EmergencySituationControlVM(Model.IEmergencySituationRepositiry _emergencySituationRepositiry, Model.IVechicleRepository _vechicleRepository) { emergencySituationRepositiry = _emergencySituationRepositiry; vechicleRepository = _vechicleRepository; Model.Vechicle2Emergency vechicleToEmergency = new Model.Vechicle2Emergency(); Messenger.Default.Register <Model.DutyOfficer>(this, HandleDutyOfficer); Messenger.Default.Register <DateTime>(this, HandleDate); NeighborhoodList = new ObservableCollection <string>(); Vechicle2Emergency = new ObservableCollection <Model.Vechicle2Emergency>(); CurrentVechicle2Emergency = new Model.Vechicle2Emergency(); EmergencySituation = new Model.EmergencySituation(); Victim = new Model.Victim(); ReceivedMessage = new Model.ReceivedMessage(); IsButtonDeleteReportEnable = false; IsButtonMinusEnable = false; PathSpecialReport = "Ссылка на документ отсутствует"; string time = DateTime.Now.ToString("HH:mm:ss"); ReceivedMessage.TimeOfReceive = new TimeSpan(int.Parse(time.Split(':')[0]), // hours int.Parse(time.Split(':')[1]), int.Parse(time.Split(':')[2])); SuperiorOfficers = new ObservableCollection <Model.SuperiorOfficer>() { new Model.SuperiorOfficer() { Position = "Министр по ЧС", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "1-й заместитель Министра", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Заместитель Министра (куратор службы)", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Заместитель Министра (куратор тыла)", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Заместитель Министра (куратор кадров)", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Ответственный по МЧС", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Начальник УАССиЛЧС", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Начальник РЦУРЧС", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "1-й заместитель начальника РЦУРЧС", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Начальник ОУСиС РЦУРЧС", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Дежурная часть МЧС", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Пресс-секретарь МЧС", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Совет Министров", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Администрация Президента", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Служба безопасности Президента", StatusOfReport = false }, new Model.SuperiorOfficer() { Position = "Гос. секретариат Сов.Без.", StatusOfReport = false } }; RegionList = new List <string> { "Брестская область", "Витебская область", "Гомельская область", "Гродненская область", "Минская область", "Могилевская область", "г.Минск" }; KindEmergencyList = new List <string> { "Загорание частного жилого дома", "Загорание частного нежилого дома", "Загорание дачного дома", "Загорание бытовок,вагончиков", "Загорание в гараже", "Загорание в квартире", "Загорание в административном здании", "Загорание на промышленном предприятии", "Загорание частного жилого дома", "Загорание на железнодорожном транспорте", "Загорание в сельскохозяйственной отрасли", "Загорание в учреждении образования", "Загорание в гостиницах, общежитиях", "Загорание автомобиля", "Загорание леса, травы и кустарников", "Загорание торфяника", "Загорание полигона ТБО", "Взрыв", "Обрушение", "ДТП", "Авария ЖКХ", "Происшествие по ЛС", "Прочее" }; SelectionRegionCommand = new RelayCommand(() => { switch (EmergencySituation.Region) { case "Брестская область": { NeighborhoodList.Clear(); NeighborhoodList.Add("Барановичский район"); NeighborhoodList.Add("Берёзовский район"); NeighborhoodList.Add("Брестский район"); NeighborhoodList.Add("Ганцевичский район"); NeighborhoodList.Add("Дрогичинский район"); NeighborhoodList.Add("Жабинковский район"); NeighborhoodList.Add("Ивановский район"); NeighborhoodList.Add("Ивацевичский район"); NeighborhoodList.Add("Каменецкий район"); NeighborhoodList.Add("Кобринский район"); NeighborhoodList.Add("Лунинецкий район"); NeighborhoodList.Add("Ляховичский район"); NeighborhoodList.Add("Малоритский район"); NeighborhoodList.Add("Пинский район"); NeighborhoodList.Add("Пружанский район"); NeighborhoodList.Add("Столинский район"); NeighborhoodList.Add("г.Брест"); } break; case "Витебская область": { NeighborhoodList.Clear(); NeighborhoodList.Add("Бешенковичский район"); NeighborhoodList.Add("Браславский район"); NeighborhoodList.Add("Верхнедвинский район"); NeighborhoodList.Add("Витебский район"); NeighborhoodList.Add("Глубокский район"); NeighborhoodList.Add("Городокский район"); NeighborhoodList.Add("Докшицкий район"); NeighborhoodList.Add("Дубровенский район"); NeighborhoodList.Add("Лепельский район"); NeighborhoodList.Add("Лиозненский район"); NeighborhoodList.Add("Миорский район"); NeighborhoodList.Add("Оршанский район"); NeighborhoodList.Add("Полоцкий район"); NeighborhoodList.Add("Поставский район"); NeighborhoodList.Add("Россонский район"); NeighborhoodList.Add("Сенненский район"); NeighborhoodList.Add("Толочинский район"); NeighborhoodList.Add("Ушачский район"); NeighborhoodList.Add("Чашникский район"); NeighborhoodList.Add("Шарковщинский район"); NeighborhoodList.Add("Шумилинский район"); NeighborhoodList.Add("г.Витебск"); } break; case "Гомельская область": { NeighborhoodList.Clear(); NeighborhoodList.Add("Брагинский район"); NeighborhoodList.Add("Буда-Кошелевский район"); NeighborhoodList.Add("Ветковский район"); NeighborhoodList.Add("Гомельский район"); NeighborhoodList.Add("Добрушский район"); NeighborhoodList.Add("Ельский район"); NeighborhoodList.Add("Житковичский район"); NeighborhoodList.Add("Жлобинский район"); NeighborhoodList.Add("Калинковичский район"); NeighborhoodList.Add("Кормянский район"); NeighborhoodList.Add("Лельчицкий район"); NeighborhoodList.Add("Лоевский район"); NeighborhoodList.Add("Мозырский район"); NeighborhoodList.Add("Наровлянский район"); NeighborhoodList.Add("Октябрьский район"); NeighborhoodList.Add("Петриковский район"); NeighborhoodList.Add("Речицкий район"); NeighborhoodList.Add("Рогачевский район"); NeighborhoodList.Add("Светлогорский район"); NeighborhoodList.Add("Хойникский район"); NeighborhoodList.Add("Чечерский район"); NeighborhoodList.Add("г.Гомель"); } break; case "Гродненская область": { NeighborhoodList.Clear(); NeighborhoodList.Add("Берестовицкий район"); NeighborhoodList.Add("Волковысский район"); NeighborhoodList.Add("Вороновский район"); NeighborhoodList.Add("Гродненский район"); NeighborhoodList.Add("Дятловский район"); NeighborhoodList.Add("Зельвенский район"); NeighborhoodList.Add("Ивьевский район"); NeighborhoodList.Add("Кореличский район"); NeighborhoodList.Add("Лидский район"); NeighborhoodList.Add("Мостовский район"); NeighborhoodList.Add("Новогрудский район"); NeighborhoodList.Add("Островецкий район"); NeighborhoodList.Add("Ошмянский район"); NeighborhoodList.Add("Свислочский район"); NeighborhoodList.Add("Слонимский район"); NeighborhoodList.Add("Сморгонский район"); NeighborhoodList.Add("Щучинский район"); NeighborhoodList.Add("г.Гродно"); } break; case "Минская область": { NeighborhoodList.Clear(); NeighborhoodList.Add("Березинский район"); NeighborhoodList.Add("Борисовский район"); NeighborhoodList.Add("Вилейский район"); NeighborhoodList.Add("Воложинский район"); NeighborhoodList.Add("Дзержинский район"); NeighborhoodList.Add("Клецкий район"); NeighborhoodList.Add("Копыльский район"); NeighborhoodList.Add("Крупский район"); NeighborhoodList.Add("Логойский район"); NeighborhoodList.Add("Любанский район"); NeighborhoodList.Add("Минский район"); NeighborhoodList.Add("Молодечненский район"); NeighborhoodList.Add("Мядельский район"); NeighborhoodList.Add("Несвижский район"); NeighborhoodList.Add("Пуховичский район"); NeighborhoodList.Add("Слуцкий район"); NeighborhoodList.Add("Смолевичский район"); NeighborhoodList.Add("Солигорский район"); NeighborhoodList.Add("Стародорожский район"); NeighborhoodList.Add("Столбцовский район"); NeighborhoodList.Add("Узденский район"); NeighborhoodList.Add("Червенский район"); } break; case "Могилевская область": { NeighborhoodList.Clear(); NeighborhoodList.Add("Белыничский район"); NeighborhoodList.Add("Бобруйский район"); NeighborhoodList.Add("Быховский район"); NeighborhoodList.Add("Глусский район"); NeighborhoodList.Add("Горецкий район"); NeighborhoodList.Add("Дрибинский район"); NeighborhoodList.Add("Кировский район"); NeighborhoodList.Add("Климовичский район"); NeighborhoodList.Add("Кличевский район"); NeighborhoodList.Add("Костюковичский район"); NeighborhoodList.Add("Краснопольский район"); NeighborhoodList.Add("Кричевский район"); NeighborhoodList.Add("Круглянский район"); NeighborhoodList.Add("Могилевский район"); NeighborhoodList.Add("Мстиславский район"); NeighborhoodList.Add("Осиповичский район"); NeighborhoodList.Add("Славгородский район"); NeighborhoodList.Add("Хотимский район"); NeighborhoodList.Add("Чаусский район"); NeighborhoodList.Add("Чериковский район"); NeighborhoodList.Add("Шкловский район"); NeighborhoodList.Add("г.Могилев"); } break; case "г.Минск": { NeighborhoodList.Clear(); NeighborhoodList.Add("Заводской район"); NeighborhoodList.Add("Ленинский район"); NeighborhoodList.Add("Московский район"); NeighborhoodList.Add("Октябрьский район"); NeighborhoodList.Add("Партизанский район"); NeighborhoodList.Add("Первомайский район"); NeighborhoodList.Add("Советский район"); NeighborhoodList.Add("Фрунзенский район"); NeighborhoodList.Add("Центральный район"); } break; } }); SaveCommand = new RelayCommand(() => { try { EmergencySituation.EditLog = $"{DateTime.Now.ToShortDateString()} {DateTime.Now.ToString("HH:mm:ss")} зарегистрировал {DutyOfficer.NameDutyOfficer}"; emergencySituationRepositiry.AddNewEmergency(EmergencySituation, SuperiorOfficers, Vechicle2Emergency, ReceivedMessage, Victim, DutyOfficer); DialogWindowVM.CloseDialogWindow(); } catch (Exception) { MyMessageBox _myMessageBox = new MyMessageBox(); Messenger.Default.Send("Данные о технике,\nвведеные некорректно,\nне сохранены"); _myMessageBox.Show(); DialogWindowVM.CloseDialogWindow(); } }); UnLoadedCommand = new RelayCommand(() => { ViewModelLocator.Cleanup(); }); CancelCommand = new RelayCommand(() => { DialogWindowVM.CloseWindow(); }); AddRowCommand = new RelayCommand(() => { Vechicle2Emergency.Add(new Model.Vechicle2Emergency()); IsButtonMinusEnable = true; }); AddSpecialReportCommand = new RelayCommand(() => { OpenFileDialog saveFileDialog = new OpenFileDialog(); saveFileDialog.Filter = "Text files (*.doc,*.docx)|*.doc;*.docx|All files (*.*)|*.*"; if (saveFileDialog.ShowDialog() == true) { PathSpecialReport = Path.GetFileName(saveFileDialog.FileName); IsButtonDeleteReportEnable = true; EmergencySituation.SpecialReport = File.ReadAllBytes(saveFileDialog.FileName); } }); DeleteRowCommand = new RelayCommand(() => { Vechicle2Emergency.Remove(CurrentVechicle2Emergency); if (Vechicle2Emergency.Count == 0) { IsButtonMinusEnable = false; } }); CheckedSuperiorOfficerCommand = new RelayCommand(() => { CurrentSuperiorOfficer.StatusOfReport = true; string timeReport = DateTime.Now.ToString("HH:mm:ss"); CurrentSuperiorOfficer.TimeReport = new TimeSpan(int.Parse(timeReport.Split(':')[0]), // hours int.Parse(timeReport.Split(':')[1]), int.Parse(timeReport.Split(':')[2])); }); UnCheckedSuperiorOfficerCommand = new RelayCommand(() => { CurrentSuperiorOfficer.StatusOfReport = false; CurrentSuperiorOfficer.TimeReport = null; }); OpenSpecialReportCommand = new RelayCommand(() => { if (PathSpecialReport != "Ссылка на документ отсутствует") { string fileName = PathSpecialReport; var bytes = EmergencySituation.SpecialReport; try { using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None)) { foreach (var b in bytes) { fs.WriteByte(b); } } Process prc = new Process(); prc.StartInfo.FileName = fileName; //prc.EnableRaisingEvents = true; //prc.Exited += Prc_Exited; prc.Start(); } catch (Exception) { MyMessageBox _myMessageBox = new MyMessageBox(); Messenger.Default.Send("Данный файл уже открыт"); _myMessageBox.Show(); // MessageBox.Show("Данный файл уже открыт"); } } }); DeleteSpecialReportCommand = new RelayCommand(() => { PathSpecialReport = "Ссылка на документ отсутствует"; IsButtonDeleteReportEnable = false; EmergencySituation.SpecialReport = null; }); }
/// <summary> /// /// </summary> /// <param name="flag"></param> private void OpenCommandDialog(int flag) { try { foreach (RecordModel re in listAll) { if (re.Index == this.tabControl.SelectedTabPageIndex) { MedicalRecordBrowse mf = re.MyControl; DevExpress.XtraGrid.Views.Grid.GridView dbGridView = mf.dbGridView; if (dbGridView.RowCount > 0) { int refresh = 0; int tabIndex = 0; int StatusCount = 0; if (flag < 0) { MedicalRecordApply medicalRecordApply = new MedicalRecordApply(); medicalRecordApply.ShowDialog(); refresh = medicalRecordApply.m_iCommandFlag; tabIndex = medicalRecordApply.m_iTabIndex; //2是提交,0是草稿 } else { InitializeApplyList(dbGridView); if (this.m_listObject.Count > 0) { CApplyObject obj = (CApplyObject)m_listObject[0]; MedicalRecordEditAndDelay medicalRecordApply = new MedicalRecordEditAndDelay(obj, flag); medicalRecordApply.ShowDialog(); refresh = medicalRecordApply.m_iCommandFlag; tabIndex = medicalRecordApply.m_iTabIndex; } } //刷新数据 if (refresh > 0) { if (tabIndex == 2) { int[] list = dbGridView.GetSelectedRows(); dbGridView.DeleteRow(list[0]); StatusCount++; } switch (flag) { case -1: //申请 foreach (RecordModel rd in listAll) { if (rd.Index == 2) { if (rd.MyControl == null) { UserControlDB(rd.Index); } rd.MyControl.GetInitDB(true); rd.MyDataTable = rd.MyControl.User_Table; rd.Count = rd.MyControl.User_Table.Rows.Count; RefreshInformation(rd.Index, rd.Count); } } break; case 0: //编辑 foreach (RecordModel rd in listAll) { if (rd.Index == 2) { if (rd.MyControl == null) { UserControlDB(rd.Index); } rd.MyControl.GetInitDB(true); rd.MyDataTable = rd.MyControl.User_Table; rd.Count = rd.MyControl.User_Table.Rows.Count; RefreshInformation(rd.Index, rd.Count); } } break; case 1: foreach (RecordModel rd in listAll) { if (rd.Index == 0) { if (rd.MyControl == null) { UserControlDB(rd.Index); } rd.MyControl.GetInitDB(true); rd.MyDataTable = rd.MyControl.User_Table; rd.Count = rd.MyControl.User_Table.Rows.Count; RefreshInformation(rd.Index, rd.Count); } else if (rd.Index == 3) { if (rd.MyControl == null) { UserControlDB(rd.Index); } rd.MyControl.GetInitDB(true); rd.MyDataTable = rd.MyControl.User_Table; rd.Count = rd.MyControl.User_Table.Rows.Count; RefreshInformation(rd.Index, rd.Count); } } break; //申请延期事件 } re.MyControl.GetInitDB(true); re.Count = re.Count - StatusCount; re.MyControl.dbGridView = dbGridView; RefreshInformation(re.Index, re.Count); break; } } break; } } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 检查病程时间 /// </summary> /// <returns></returns> private bool CheckDailyEmr() { //获取数据库中的首次病程 string displayDateTime = GetFirstDailyEmrCaptionDateTime(m_CurrentUCEmrInput.CurrentInpatient.NoOfFirstPage.ToString()); //获取内存中的首次病程 EmrModel firstDailyEmrModel = Util.GetFirstDailyEmrModel(m_CurrentUCEmrInput.CurrentInputBody.CurrentTreeList); if (displayDateTime == "" && firstDailyEmrModel != null) { displayDateTime = firstDailyEmrModel.DisplayTime.ToString("yyyy-MM-dd HH:mm:ss"); } DataTable dt = gridControlDailyEmr.DataSource as DataTable; //获取Grid中首次病程的数量 List <DataRow> firstDailyEmrCaptionDateTime = dt.Rows.Cast <DataRow>().Where(dr => { if (dr["FIRSTDAILYFLAG"].ToString() == "1") { return(true); } return(false); }).ToList(); if (displayDateTime != "") //内存或数据库中已经存在首次病程 { if (firstDailyEmrCaptionDateTime.Count() > 0) //Grid中也存在首次病程 { MyMessageBox.Show("已经存在首次病程,不能重复增加。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); return(false); } } else { if (firstDailyEmrCaptionDateTime.Count() == 0)//Grid中不存在首次病程 { MyMessageBox.Show("导入的病程需要包括首次病程。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); return(false); } else { //displayDateTime = firstDailyEmrCaptionDateTime[0]["captiondatetime"].ToString(); displayDateTime = firstDailyEmrCaptionDateTime[0]["EMRDATE"].ToString() + " " + firstDailyEmrCaptionDateTime[0]["EMRTIME"].ToString(); } } if (displayDateTime == "") { MyMessageBox.Show("首次病程不存在,需要导入。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); return(false); } else { int errorCnt = dt.Rows.Cast <DataRow>().Where(dr => { if (dr["FIRSTDAILYFLAG"].ToString() != "1") //排除首程 { DateTime displayDateTimeInGrid = Convert.ToDateTime(dr["EMRDATE"] + " " + dr["EMRTIME"]); DateTime firstDisplayDateTime = Convert.ToDateTime(displayDateTime); if ((firstDisplayDateTime - displayDateTimeInGrid).TotalSeconds >= 0) { return(true); } } return(false); }).Count(); if (errorCnt > 0) { MyMessageBox.Show("病程时间应该大于首次病程的时间 首次病程时间:【" + displayDateTime + "】", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); return(false); } } return(true); }
private void btnChat_Click(object sender, EventArgs e) { MyMessageBox.Show("Tính năng này hiện còn đang phát triển!", MessageBoxButtons.OK); }
public MainWindow() { InitializeComponent(); MyMessageBox.Show("aaa"); }
private void CardControl_Saving(Object sender, CancelEventArgs e) { try { /* Переформирование файлов */ for (Int32 i = 0; i < Table_Service.RowCount; i++) { BaseCardProperty Row = Table_Service[i]; ServiceTableChange Change = Dic_Changes.Find(Row[RefApplicationCard.Service.Id].ToGuid()); if (Change.FileIsChanged || Row[RefApplicationCard.Service.PackedListID].ToGuid().IsEmpty()) { Guid FileId = Row[RefApplicationCard.Service.PackedListID].ToGuid(); AccountCard.FillPackFile(Context, UniversalCard.GetItemName(Row[RefApplicationCard.Service.DeviceID].ToGuid()), Row[RefApplicationCard.Service.PackedListData] as String, ref FileId); Row[RefApplicationCard.Service.PackedListID] = FileId; Table_Service.RefreshRow(i); } if (Change.DeviceNumberId.IsChanged) { if (!Change.DeviceNumberId.OldValue.IsEmpty()) { UniversalCard.GetItemRow(Change.DeviceNumberId.OldValue).SetDeviceState(DeviceState.Operating); } if (!Change.DeviceNumberId.NewValue.IsEmpty()) { UniversalCard.GetItemRow(Change.DeviceNumberId.NewValue).SetDeviceState(DeviceState.OnTheWay); } } if (Change.Sensors.IsChanged) { if (!String.IsNullOrEmpty(Change.Sensors.OldValue)) { foreach (String Sensor in Change.Sensors.OldValue.Split(';')) { UniversalCard.GetSensorRow(Sensor).SetDeviceState(DeviceState.Operating); } } if (!String.IsNullOrEmpty(Change.Sensors.NewValue)) { foreach (String Sensor in Change.Sensors.NewValue.Split(';')) { UniversalCard.GetSensorRow(Sensor).SetDeviceState(DeviceState.OnTheWay); } } } } /* Синхронизация */ if (Dic_Changes.IsChanged()) { ReferenceList RefList = Context.GetObject <ReferenceList>(GetControlValue(RefApplicationCard.MainInfo.Links).ToGuid()); List <CardData> AccountCards = new List <CardData>(); /* Получение карточек */ foreach (ReferenceListReference Link in RefList.References) { if (Link.CardType.Equals(RefAccountCard.ID)) { CardData AccountCard = CardScript.Session.CardManager.GetCardData(Link.Card); CardLock CardLock = CardScript.GetCardLock(AccountCard); if (!CardLock.IsFree) { throw new MyException("Договор/счет «" + CardLock.CardDescription + "» заблокирован " + (CardLock.IsMine ? "вами!" : "пользователем «" + CardLock.AccountName + "»!")); } AccountCards.Add(AccountCard); } } for (Int32 i = 0; i < AccountCards.Count; i++) { RefList = Context.GetObject <ReferenceList>(AccountCards[i].Sections[RefAccountCard.MainInfo.ID].FirstRow.GetGuid(RefAccountCard.MainInfo.LinkListId)); List <CardData> ShipmentTasks = new List <CardData>(), CompleteTasks = new List <CardData>(); /* Получение карточек */ foreach (ReferenceListReference Link in RefList.References) { if (Link.CardType.Equals(RefShipmentCard.ID)) { CardData ShipmentTask = CardScript.Session.CardManager.GetCardData(Link.Card); CardLock CardLock = CardScript.GetCardLock(ShipmentTask); if (!CardLock.IsFree) { throw new MyException("Задание на отгрузку «" + CardLock.CardDescription + "» заблокировано " + (CardLock.IsMine ? "вами!" : "пользователем «" + CardLock.AccountName + "»!")); } ShipmentTasks.Add(ShipmentTask); CardData CompleteTask = CardScript.Session.CardManager.GetCardData(ShipmentTask.Sections[RefShipmentCard.MainInfo.ID].FirstRow.GetGuid(RefShipmentCard.MainInfo.CompleteTaskId).ToGuid()); CardLock = CardScript.GetCardLock(CompleteTask); if (!CardLock.IsFree) { throw new MyException("Задание на комплектацию «" + CardLock.CardDescription + "» заблокировано " + (CardLock.IsMine ? "вами!" : "пользователем «" + CardLock.AccountName + "»!")); } CompleteTasks.Add(CompleteTask); } } if (AccountCards[i].InUpdate) { AccountCards[i].CancelUpdate(); } RowDataCollection AccountServiceRows = AccountCards[i].Sections[RefAccountCard.Service.ID].Rows; RowDataCollection AccountAddCompleteRows = AccountCards[i].Sections[RefAccountCard.AddComplete.ID].Rows; for (Int32 j = 0; j < Table_Service.RowCount; j++) { BaseCardProperty Row = Table_Service[i]; ServiceTableChange Change = Dic_Changes.Find(Row[RefApplicationCard.Service.Id].ToGuid()); RowData ServiceRow = AccountServiceRows.Find(RefAccountCard.Service.Id, Change.RowId); if (Change.IsChanged && !ServiceRow.IsNull()) { if (Change.Warranty.IsChanged) { ServiceRow.SetBoolean(RefAccountCard.Service.Warranty, Change.Warranty.NewValue); } if (Change.DeviceId.IsChanged) { ServiceRow.SetGuid(RefAccountCard.Service.DeviceId, Change.DeviceId.NewValue); } if (Change.AC.IsChanged) { ServiceRow.SetBoolean(RefAccountCard.Service.AC, Change.AC.NewValue); } if (Change.FileIsChanged) { ServiceRow.SetString(RefAccountCard.Service.ACList, Row[RefApplicationCard.Service.ACList] as String); ServiceRow.SetString(RefAccountCard.Service.PackedListData, Row[RefApplicationCard.Service.PackedListData] as String); ServiceRow.SetGuid(RefAccountCard.Service.PackedListId, Row[RefApplicationCard.Service.PackedListData].ToGuid()); RowDataCollection AddCompleteRows = AccountAddCompleteRows.Filter("@" + RefAccountCard.AddComplete.ParentTableRowId + " = '" + Change.RowId.ToString().ToUpper() + "'"); List <String> AccountComlete = AddCompleteRows.Select(r => r.GetString(RefAccountCard.AddComplete.Name)).ToList(); List <String> ApplicationComlete = new List <String>(); for (Int32 k = 0; k < Table_AddComplete.RowCount; k++) { if (Table_AddComplete[k][RefApplicationCard.AddComplete.ParentTableRowId].ToGuid().Equals(Change.RowId)) { ApplicationComlete.Add(Table_AddComplete[k][RefApplicationCard.AddComplete.Name] as String); } } for (Int32 k = 0; k < AddCompleteRows.Count; k++) { if (!ApplicationComlete.Contains(AddCompleteRows[k].GetString(RefAccountCard.AddComplete.Name))) { AccountCards[i].Sections[RefAccountCard.AddComplete.ID].DeleteRow(AddCompleteRows[k].Id); } } for (Int32 k = 0; k < Table_AddComplete.RowCount; k++) { if (Table_AddComplete[k][RefApplicationCard.AddComplete.ParentTableRowId].ToGuid().Equals(Change.RowId)) { RowData AddCompleteRow = AddCompleteRows.Find(RefAccountCard.AddComplete.Name, Table_AddComplete[k][RefApplicationCard.AddComplete.Name] as String); if (AddCompleteRow.IsNull()) { AddCompleteRow = AccountCards[i].Sections[RefAccountCard.AddComplete.ID].Rows.AddNew(); AddCompleteRow.SetInt32(RefAccountCard.AddComplete.Ordered, 0); } AddCompleteRow.SetInt32(RefAccountCard.AddComplete.Count, (Int32?)Table_AddComplete[k][RefApplicationCard.AddComplete.Count]); AddCompleteRow.SetGuid(RefAccountCard.AddComplete.Id, Table_AddComplete[k][RefApplicationCard.AddComplete.Id].ToGuid()); AddCompleteRow.SetString(RefAccountCard.AddComplete.Name, Table_AddComplete[k][RefApplicationCard.AddComplete.Name] as String); AddCompleteRow.SetString(RefAccountCard.AddComplete.Code, Table_AddComplete[k][RefApplicationCard.AddComplete.Code] as String); } } } } } for (Int32 j = 0; j < ShipmentTasks.Count; j++) { if (ShipmentTasks[j].LockStatus == LockStatus.Free && CompleteTasks[j].LockStatus == LockStatus.Free) { if (ShipmentTasks[j].InUpdate) { ShipmentTasks[j].CancelUpdate(); } if (CompleteTasks[j].InUpdate) { CompleteTasks[j].CancelUpdate(); } RowDataCollection ShipmentDevicesRows = ShipmentTasks[j].Sections[RefShipmentCard.Devices.ID].Rows; RowDataCollection CompleteDevicesRows = CompleteTasks[j].Sections[RefCompleteCard.Devices.ID].Rows; foreach (RowData DevicesRow in ShipmentDevicesRows) { ServiceTableChange Change = Dic_Changes.Find(DevicesRow.GetGuid(RefShipmentCard.Devices.AccountCardRowId).ToGuid()); if (!Change.IsNull() && Change.IsChanged) { RowDataCollection CompleteRows = CompleteDevicesRows.Filter("@" + RefCompleteCard.Devices.ShipmentTaskRowId + " = '" + DevicesRow.GetGuid(RefShipmentCard.Devices.Id).ToString().ToUpper() + "'"); /* Изменение связных полей */ if (Change.Warranty.IsChanged) { DevicesRow.SetBoolean(RefShipmentCard.Devices.Warranty, Change.Warranty.NewValue); foreach (RowData CompleteRow in CompleteRows) { CompleteRow.SetBoolean(RefCompleteCard.Devices.Warranty, Change.Warranty.NewValue); } } if (Change.AC.IsChanged) { DevicesRow.SetBoolean(RefShipmentCard.Devices.AC, Change.AC.NewValue); foreach (RowData CompleteRow in CompleteRows) { CompleteRow.SetBoolean(RefCompleteCard.Devices.AC, Change.AC.NewValue); } } if (Change.DeviceId.IsChanged) { DevicesRow.SetGuid(RefShipmentCard.Devices.DeviceId, Change.DeviceId.NewValue); foreach (RowData CompleteRow in CompleteRows) { CompleteRow.SetGuid(RefCompleteCard.Devices.DeviceId, Change.DeviceId.NewValue); } } if (Change.FileIsChanged) { DevicesRow.SetBoolean(RefShipmentCard.Devices.IsChanged, Change.FileIsChanged); for (Int32 k = 0; k < Table_Service.RowCount; k++) { if (Table_Service[k][RefApplicationCard.Service.Id].ToGuid().Equals(Change.RowId)) { DevicesRow.SetGuid(RefShipmentCard.Devices.TemplatePackListId, Table_Service[k][RefApplicationCard.Service.PackedListID].ToGuid()); } } } /* Очистка связных полей */ if (Change.DeviceId.IsChanged || Change.AC.IsChanged) { DevicesRow.SetString(RefShipmentCard.Devices.DeviceNumbers, null); DevicesRow.SetString(RefShipmentCard.Devices.PartyNumbers, null); DevicesRow.SetString(RefShipmentCard.Devices.Coupons, null); foreach (RowData CompleteRow in CompleteRows) { try { Guid DeviceNumberId = CompleteRow.GetObject(RefCompleteCard.Devices.DeviceNumberId).ToGuid(); /* Очистка приборов */ if (!DeviceNumberId.IsEmpty()) { try { UniversalCard.GetItemRow(DeviceNumberId).UpdateDeviceInformation(UniversalCard, CompleteRow.GetBoolean(RefCompleteCard.Devices.AS)); } catch (MyException Ex) { switch (Ex.ErrorCode) { case -1: WriteLog("Ошибка: предвиденное исключение" + "\r\n" + Ex.Message + "\r\n" + Ex.StackTrace); WriteLog("Ошибка: предвиденное исключение" + "\r\n" + Ex.InnerException.Message + "\r\n" + Ex.InnerException.StackTrace); break; case 0: WriteLog("Ошибка: предвиденное исключение" + "\r\n" + Ex.Message + "\r\n" + Ex.StackTrace); break; case 1: String[] ss = Ex.Message.Split('\t'); WriteLog("Ошибка: предвиденное исключение" + "\r\n" + (ss.Length >= 2 ? "В карточке " + ss[1] + " отсутствует поле: " + ss[0] : Ex.Message) + "\r\n" + Ex.StackTrace); WriteLog("Ошибка: предвиденное исключение" + "\r\n" + Ex.InnerException.Message + "\r\n" + Ex.InnerException.StackTrace); break; } } } CompleteRow.SetGuid(RefCompleteCard.Devices.DeviceNumberId, Guid.Empty); CompleteRow.SetString(RefCompleteCard.Devices.DeviceNumber, null); CompleteRow.SetGuid(RefCompleteCard.Devices.CouponId, Guid.Empty); } catch (Exception Ex) { WriteLog("Ошибка: непредвиденное исключение" + "\r\n" + Ex.Message + "\r\n" + Ex.StackTrace); } } } } } } } } } } catch (ArgumentNullException Ex) { MyMessageBox.Show("Поле \"" + Ex.ParamName + "\" обязательно к заполнению!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; } catch (MyException Ex) { MyMessageBox.Show(Ex.Message + Environment.NewLine + "Синхронизация связных карточек не произойдет.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; } catch (Exception Ex) { CallError(Ex); } }
private new void Button_Upload_Click(Object sender, EventArgs e) { try { DirectoryInfo ArchiveTempFolder = new DirectoryInfo(ArchiveTempPath); if (Check()) { OpenFileDialog FileDialog = new OpenFileDialog(); FileDialog.CheckFileExists = true; FileDialog.CheckPathExists = true; FileDialog.Multiselect = true; FileDialog.Title = "Выберите файлы для загрузки..."; FileDialog.ValidateNames = true; switch (FileDialog.ShowDialog()) { case DialogResult.OK: if (FileDialog.FileNames.Length > 0) { String TempFolderName = Path.GetRandomFileName(); String TempFolderPath = Path.Combine(ArchiveTempPath, TempFolderName); String Folder = FolderPath; if (String.IsNullOrWhiteSpace(Folder)) { String Name = (GetControlValue(RefMarketingFilesCard.MainInfo.Name) ?? String.Empty).ToString(); while (CardScript.Session.CheckDuplication(FolderName)) { Name += " 1"; } SetControlValue(RefMarketingFilesCard.MainInfo.Name, Name); Changes[RefMarketingFilesCard.MainInfo.Name].NewValue = Name; Folder = Path.Combine(CardScript.Session.GetArchivePath(), ArchiveSection, ArchiveSubSection, FolderName) + @"\"; if (FileDialog.SafeFileNames.Any(file => (Path.Combine(Folder, file).Length + 1) > MyHelper.PathMaxLenght)) { WriteLog("Длинный путь: " + Folder); throw new MyException(2, (MyHelper.PathMaxLenght - Folder.Length - 1).ToString()); } ArchiveTempFolder.CreateSubdirectory(TempFolderName); foreach (String FileName in FileDialog.FileNames) { File.Copy(FileName, Path.Combine(TempFolderPath, Path.GetFileName(FileName))); } Folder = CardScript.Session.PlaceFiles(TempFolderPath, Folder); if (Folder != Boolean.FalseString) { SetControlValue(RefMarketingFilesCard.MainInfo.Files, FileDialog.SafeFileNames.OrderBy(s => s).Aggregate("; ")); FolderPath = Folder; } else { throw new MyException(1); } FastSaving = true; } else { if (FileDialog.SafeFileNames.Any(file => (Path.Combine(Folder, file).Length + 1) > MyHelper.PathMaxLenght)) { WriteLog("Длинный путь: " + Folder); throw new MyException(2, (MyHelper.PathMaxLenght - Folder.Length - 1).ToString()); } ArchiveTempFolder.CreateSubdirectory(TempFolderName); foreach (String FileName in FileDialog.FileNames) { File.Copy(FileName, Path.Combine(TempFolderPath, Path.GetFileName(FileName))); } if ((Folder = CardScript.Session.AddFiles(TempFolderName, Folder)) != Boolean.FalseString) { SetControlValue(RefMarketingFilesCard.MainInfo.Files, (GetControlValue(RefMarketingFilesCard.MainInfo.Files) ?? String.Empty).ToString().Split(';').Select(s => s.Trim()) .ToList().Union(FileDialog.SafeFileNames).OrderBy(s => s).Aggregate("; ")); FolderPath = Folder; } else { throw new MyException(1); } } CardScript.SaveCard(); FastSaving = false; } break; } } } catch (MyException Ex) { switch (Ex.ErrorCode) { case 1: MyMessageBox.Show("Не удалось загрузить файлы." + Environment.NewLine + "Обратитесь к администратору.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case 2: MyMessageBox.Show("Название файла не должно превышать " + Ex.Message + " символов.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } } catch (Exception Ex) { CallError(Ex); } }
private void CreateAccountCard_ItemClick(Object sender, ItemClickEventArgs e) { try { IReferenceListService ReferenceListService = Context.GetService <IReferenceListService>(); ReferenceList RefList = Context.GetObject <ReferenceList>(Control_Links.ReferenceListID); if (RefList.References.Any(r => r.CardType.Equals(RefAccountCard.ID))) { CardScript.CardFrame.CardHost.ShowCardModal(RefList.References.First(r => r.CardType.Equals(RefAccountCard.ID)).Card, ActivateMode.Edit); } if (Table_Service.RowCount > 0) { throw new MyException(1); } if (!CardScript.SaveCard()) { throw new MyException(0); } /* Формирование задания на отгрузку */ CardData AccountData = Context.CreateCard(RefAccountCard.ID); AccountData.BeginUpdate(); RowData MainInfoRow = AccountData.Sections[RefAccountCard.MainInfo.ID].FirstRow; SectionData Service = AccountData.Sections[RefAccountCard.Service.ID]; MainInfoRow.SetGuid(RefAccountCard.MainInfo.RegisterId, Context.GetCurrentUser()); MainInfoRow.SetGuid(RefAccountCard.MainInfo.ContractSubjectId, AccountCard.Item_Subject_Service.ToGuid()); MainInfoRow.SetGuid(RefAccountCard.MainInfo.ClientId, GetControlValue(RefApplicationCard.MainInfo.Client).ToGuid()); Guid?RefListId = MainInfoRow.GetGuid(RefAccountCard.MainInfo.LinkListId); RefList = RefListId.HasValue ? Context.GetObject <ReferenceList>(RefListId.Value) : ReferenceListService.CreateReferenceList(); if (!RefList.References.Any(RefRef => RefRef.Card.Equals(CardScript.CardData.Id))) { ReferenceListService.CreateReference(RefList, null, CardScript.CardData.Id, RefApplicationCard.ID, false); MainInfoRow.SetGuid(RefAccountCard.MainInfo.LinkListId, Context.GetObjectRef <ReferenceList>(RefList).Id); } RefList.References.First(RefRef => RefRef.Card.Equals(CardScript.CardData.Id)).LinkDescription = DateTime.Now.ToString("Создано dd.MM.yyyy HH:mm"); Context.SaveObject(RefList); for (Int32 i = 0; i < Table_Service.RowCount; i++) { BaseCardProperty Row = Table_Service[i]; RowData ServiceRow = Service.Rows.AddNew(); ServiceRow.SetGuid(RefAccountCard.Service.Id, Row[RefApplicationCard.Service.Id].ToGuid()); ServiceRow.SetGuid(RefAccountCard.Service.DeviceId, Row[RefApplicationCard.Service.DeviceID].ToGuid()); ServiceRow.SetBoolean(RefAccountCard.Service.AC, (Boolean)Row[RefApplicationCard.Service.Verify]); ServiceRow.SetBoolean(RefAccountCard.Service.Verify, (Boolean)Row[RefApplicationCard.Service.Verify]); ServiceRow.SetBoolean(RefAccountCard.Service.Repair, (Boolean)Row[RefApplicationCard.Service.Repair]); ServiceRow.SetBoolean(RefAccountCard.Service.Calibrate, (Boolean)Row[RefApplicationCard.Service.Calibrate]); ServiceRow.SetBoolean(RefAccountCard.Service.Delivery, false); ServiceRow.SetInt32(RefAccountCard.Service.Count, 1); ServiceRow.SetInt32(RefAccountCard.Service.Shipped, 0); ServiceRow.SetInt32(RefAccountCard.Service.ToShip, 1); ServiceRow.SetString(RefAccountCard.Service.ACList, Row[RefApplicationCard.Service.ACList]); ServiceRow.SetString(RefAccountCard.Service.PackedListData, Row[RefApplicationCard.Service.PackedListData]); ServiceRow.SetGuid(RefAccountCard.Service.PackedListId, Row[RefApplicationCard.Service.PackedListID].ToGuid()); ServiceRow.SetBoolean(RefAccountCard.Service.Warranty, (Boolean)Row[RefApplicationCard.Service.WarrantyServices]); } AccountData.EndUpdate(); if (CardScript.CardFrame.CardHost.ShowCardModal(AccountData.Id, ActivateMode.Edit, ActivateFlags.New)) { Control_Links.AddRef(AccountData.Id, DateTime.Now.ToString("Создано dd.MM.yyyy HH:mm"), true, false); MyHelper.SaveCard(CardScript); } else { AccountData.ForceUnlock(); CardScript.Session.CardManager.DeleteCard(AccountData.Id, true); } } catch (MyException Ex) { switch (Ex.ErrorCode) { case 1: MyMessageBox.Show("Таблица «Сервисное обслуживание» не заполнена!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } } catch (Exception Ex) { CallError(Ex); } }
public MainViewModel(Model.IDutyOfficerRepository _dutyOfficerRepository, Model.IReportRepository _reportRepository, Model.IEmergencySituationRepositiry _emergencySituationRepositiry) { int i = 0; emergencySituationRepositiry = _emergencySituationRepositiry; ValueKey = new ObservableCollection <KeyValuePair <string, int> >(); EmergencySituations = new ObservableCollection <Model.EmergencySituation>(); EmergenciesInfoByRegionList = new ObservableCollection <KeyValuePair <string, int> >(); FillOutEmergencySituationsCollection(); FillOutEmergenciesInfoByRegionList(); FillOutStatusBarInfo(); reportRepository = _reportRepository; IsEditEmergencyEnable = false; if ((Report = reportRepository.GetByDate(selectedDate)) != null) { IsAddReportEnable = false; IsDeleteReportEnable = true; } else { IsAddReportEnable = true; IsDeleteReportEnable = false; } Messenger.Default.Register <Model.DutyOfficer>(this, HandleDutyOfficer); dutyOfficerRepository = _dutyOfficerRepository; timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(1.0); Task taskShowTime = new Task( () => { timer.Start(); timer.Tick += (s, e) => { i++; if (i % 180 == 0) //каждые 3 минуты обновляются данные из бд { EmergencySituations.Clear(); FillOutEmergencySituationsCollection(); } DateTime datetime = DateTime.Now; Time = datetime.ToString("HH:mm:ss"); }; }); taskShowTime.Start(); ChangeUserCommand = new RelayCommand(() => { AuthenticationControl _authenticationControl = new AuthenticationControl(); DialogWindow _dialogWindow = new DialogWindow(_authenticationControl); foreach (Window window in Application.Current.Windows) { if ((window as MainWindow) != null) { window.Close(); } } _dialogWindow.Show(); }); UserSettingCommand = new RelayCommand(() => { UserSettingControl _userSettingControl = new UserSettingControl(); DialogWindow _dialogWindow = new DialogWindow(_userSettingControl); Messenger.Default.Send(CurrentDutyOfficer); _dialogWindow.ShowDialog(); }); AddEmergencyCommand = new RelayCommand(() => { EmergencySituationControl _emergencySituationControl = new EmergencySituationControl(); DialogWindow _dialogWindow = new DialogWindow(_emergencySituationControl); Messenger.Default.Send(CurrentDutyOfficer); Messenger.Default.Send(SelectedDate); if ((_dialogWindow.ShowDialog()) == true) { EmergencySituations.Clear(); FillOutEmergencySituationsCollection(); } }); EditEmergencyCommand = new RelayCommand(() => { EditEmergencySituationControl _editEmergencySituationControl = new EditEmergencySituationControl(); DialogWindow _dialogWindow = new DialogWindow(_editEmergencySituationControl); Messenger.Default.Send(CurrentDutyOfficer); Messenger.Default.Send(CurrentEmergency.EmergencyID); if ((_dialogWindow.ShowDialog()) == true) { EmergencySituations.Clear(); FillOutEmergencySituationsCollection(); } }); AddReportCommand = new RelayCommand(() => { OpenFileDialog saveFileDialog = new OpenFileDialog(); saveFileDialog.Filter = "Text files (*.doc,*.docx)|*.doc;*.docx|All files (*.*)|*.*"; if (saveFileDialog.ShowDialog() == true) { pathReport = Path.GetFileName(saveFileDialog.FileName); Report = new Model.Report(); Report.Report1 = File.ReadAllBytes(saveFileDialog.FileName); Report.DateOfReport = SelectedDate; reportRepository.AddReport(Report); IsAddReportEnable = false; IsDeleteReportEnable = true; } }); OpenReportCommand = new RelayCommand(() => { pathReport = $"Сводка за {selectedDate.Date.ToShortDateString()} сутки.doc"; var bytes = Report.Report1; try { using (FileStream fs = new FileStream(pathReport, FileMode.Create, FileAccess.Write, FileShare.None)) { foreach (var b in bytes) { fs.WriteByte(b); } } Process prc = new Process(); prc.StartInfo.FileName = pathReport; //prc.EnableRaisingEvents = true; //prc.Exited += Prc_Exited; prc.Start(); } catch (Exception) { MyMessageBox _myMessageBox = new MyMessageBox(); Messenger.Default.Send("Данный файл уже открыт"); _myMessageBox.Show(); } }); ReadXMLDocCommand = new RelayCommand(() => { StreamWriter fs = new StreamWriter("XML документ.txt", false, Encoding.GetEncoding(1251)); fs.Write(emergencySituationRepositiry.ReadXMLDoc()); Process prc = new Process(); prc.StartInfo.FileName = "XML документ.txt"; prc.Start(); }); DeleteReportCommand = new RelayCommand(() => { reportRepository.DeleteReport(SelectedDate); IsAddReportEnable = true; IsDeleteReportEnable = false; }); SelectedDateCommand = new RelayCommand(() => { if ((Report = reportRepository.GetByDate(SelectedDate)) != null) { IsAddReportEnable = false; IsDeleteReportEnable = true; } else { IsAddReportEnable = true; IsDeleteReportEnable = false; } EmergencySituations.Clear(); FillOutEmergencySituationsCollection(); }); SelectionChangedDataGridCommand = new RelayCommand(() => { if (CurrentEmergency == null) { IsEditEmergencyEnable = false; } else { IsEditEmergencyEnable = true; } }); UnLoadedCommand = new RelayCommand(() => { string[] docList = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.doc"); foreach (var f in docList) { try { File.Delete(f); } catch (IOException) { continue; } } ViewModelLocator.Cleanup(); }); DeleteEmergencyCommand = new RelayCommand(() => { emergencySituationRepositiry.DeleteEmergencySituation(CurrentEmergency.EmergencyID); EmergencySituations.Clear(); FillOutEmergencySituationsCollection(); }); AboutProgrammCommand = new RelayCommand(() => { MyMessageBox _myMessageBox = new MyMessageBox(); Messenger.Default.Send($"Программное средство \nУчет оперативной информации \nо чрезвычайных ситуациях.\nАвтор Северина Н.И."); _myMessageBox.Show(); }); WriteXMLDocCommand = new RelayCommand(() => { emergencySituationRepositiry.WriteXMLDoc(); MyMessageBox _myMessageBox = new MyMessageBox(); Messenger.Default.Send($"Информация о ЧС записана в\nEmergencySituations.xml документ"); _myMessageBox.Show(); }); }
/// <summary> /// Инициализирует карточку по заданным данным. /// </summary> /// <param name="ClassBase">Скрипт карточки.</param> /// <param name="e">Событие открытия карточки</param> public ApplicationCard(ScriptClassBase ClassBase, CardActivatedEventArgs e) : base(ClassBase) { try { /* Получение рабочих объектов */ Table_Service = ICardControl.FindPropertyItem <ITableControl>(RefApplicationCard.Service.Alias); Table_AddComplete = ICardControl.FindPropertyItem <ITableControl>(RefApplicationCard.AddComplete.Alias); Grid_Service = ICardControl.GetGridView(RefApplicationCard.Service.Alias); Grid_AddComplete = ICardControl.GetGridView(RefApplicationCard.AddComplete.Alias); Control_Links = ICardControl.FindPropertyItem <LinksControlView>(RefApplicationCard.MainInfo.Links); /* Получение номера */ if (GetControlValue(RefApplicationCard.MainInfo.Number).ToGuid().IsEmpty()) { CurrentNumerator = CardScript.GetNumber(RefApplicationCard.NumberRuleName); CurrentNumerator.Number = Convert.ToInt32(CurrentNumerator.Number).ToString("00000"); SetControlValue(RefApplicationCard.MainInfo.Number, Context.GetObjectRef <BaseCardNumber>(CurrentNumerator).Id); WriteLog("Выдали номер: " + CurrentNumerator.Number); } else { CurrentNumerator = Context.GetObject <BaseCardNumber>(GetControlValue(RefApplicationCard.MainInfo.Number)); } /* Заполнение списка изменений */ RefreshChanges(); /* Значения по умолчанию */ if (e.ActivateFlags.HasFlag(ActivateFlags.New)) { SetControlValue(RefApplicationCard.MainInfo.Status, (Int32)RefApplicationCard.MainInfo.State.Registered); } if (GetControlValue(RefApplicationCard.MainInfo.Negotiator).ToGuid().IsEmpty()) { try { StaffEmployee Emp = Context.GetEmployeeByPosition("Начальник отдела настройки"); SetControlValue(RefApplicationCard.MainInfo.Negotiator, Context.GetObjectRef(Emp).Id); } catch { MyMessageBox.Show("Не удалось найти ответственного исполнителя!", "Предупржедение", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } /* Привязка методов */ CardScript.CardControl.CardClosed += CardControl_CardClosed; CardScript.CardControl.Saved += CardControl_Saved; CardScript.CardControl.Saving += CardControl_Saving; ICardControl.RibbonControl.Items[RefApplicationCard.RibbonItems.ShowClientInfo].ItemClick += ShowClientInfo_ItemClick; ICardControl.RibbonControl.Items[RefApplicationCard.RibbonItems.Calculation].ItemClick += Calculation_ItemClick; ICardControl.RibbonControl.Items[RefApplicationCard.RibbonItems.PrintAcceptanceAct].ItemClick += PrintAcceptanceAct_ItemClick; ICardControl.RibbonControl.Items[RefApplicationCard.RibbonItems.PrintDeliveryAct].ItemClick += PrintDeliveryAct_ItemClick; ICardControl.RibbonControl.Items[RefApplicationCard.RibbonItems.Calibrate].ItemClick += Calibrate_ItemClick; ICardControl.RibbonControl.Items[RefApplicationCard.RibbonItems.Revoke].ItemClick += Revoke_ItemClick; ICardControl.RibbonControl.Items[RefApplicationCard.RibbonItems.CreateAccountCard].ItemClick += CreateAccountCard_ItemClick; ICardControl.RibbonControl.Items[RefApplicationCard.RibbonItems.Marketing].ItemClick += Marketing_ItemClick; Grid_Service.AddDoubleClickHandler(new Service_DoubleClickDelegate(Service_DoubleClick)); AddTableHandler(RefApplicationCard.Service.Alias, "AddButtonClicked", "Service_AddButtonClicked"); AddTableHandler(RefApplicationCard.Service.Alias, "RemoveButtonClicked", "Service_RemoveButtonClicked"); /* Настройка */ Customize(); } catch (Exception Ex) { CallError(Ex); } }
public LoginWindowViewModel() { TabControlChanged = new RelayCommand <Window>((p) => { return(p != null); }, (p) => { var tabControl = p.FindName("tabControl") as TabablzControl; var gridSignUp = p.FindName("gridSignUp") as Grid; var gridLogin = p.FindName("gridLogin") as Grid; if (tabControl.SelectedIndex == 0) { gridLogin.Margin = new Thickness(0, 0, 0, 0); gridSignUp.Margin = new Thickness(0, 0, 500, 0); } if (tabControl.SelectedIndex == 1) { gridLogin.Margin = new Thickness(0, 0, 500, 0); gridSignUp.Margin = new Thickness(0, 0, 0, 0); } }); LoginCommand = new RelayCommand <Window>((p) => { return(p != null); }, (p) => { var txtUsername = p.FindName("txtUsername") as TextBox; var txtPassword = p.FindName("txtPassword") as PasswordBox; var txtPasswordShow = p.FindName("txtPasswordShow") as TextBox; var icoEye = p.FindName("icoEye") as PackIcon; var passwordInput = (icoEye.Kind == PackIconKind.Visibility) ? txtPassword.Password : txtPasswordShow.Text; var accountLogin = AccountDAL.Instance.Login(txtUsername.Text, passwordInput); if (accountLogin == null) { var tblLoginFail = p.FindName("tblLoginFail") as TextBlock; tblLoginFail.Visibility = Visibility.Visible; return; } else { p.Hide(); switch (accountLogin.AccountType) { case 0: var mainWindow = new MainWindow(); mainWindow.Show(); break; case 1: var librarianWindow = new LibrarianWindow() { DataContext = new LibrarianWindowViewModel(accountLogin) }; librarianWindow.Show(); break; case 2: var memberWindow = new MemberWindow() { DataContext = new MemberWindowViewModel(accountLogin) }; memberWindow.Show(); break; } p.Close(); } }); SignUpCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { MyMessageBox.Show("Comming soon !", "Sorry", "OK", "", MessageBoxImage.Error); }); LostPasswordCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { MyMessageBox.Show("Comming soon !", "Sorry", "OK", "", MessageBoxImage.Error); }); ShowPasswordCommand = new RelayCommand <Window>((p) => { return(p != null); }, (p) => { var txtPassword = p.FindName("txtPassword") as PasswordBox; var txtPasswordShow = p.FindName("txtPasswordShow") as TextBox; var icoEye = p.FindName("icoEye") as PackIcon; if (icoEye.Kind == PackIconKind.Visibility) { icoEye.Kind = PackIconKind.VisibilityOff; txtPassword.Visibility = Visibility.Hidden; txtPasswordShow.Text = txtPassword.Password; txtPasswordShow.Visibility = Visibility.Visible; txtPasswordShow.Focus(); txtPasswordShow.SelectionStart = txtPasswordShow.Text.Length; } else { icoEye.Kind = PackIconKind.Visibility; txtPassword.Visibility = Visibility.Visible; txtPassword.Password = txtPasswordShow.Text; txtPasswordShow.Visibility = Visibility.Hidden; txtPassword.Focus(); } }); }
public MemberWindowViewModel(Account accountLogin) { MemberLogin = MemberDAL.Instance.GetMember(accountLogin.PersonId); MenuSelectionChangedCommand = new RelayCommand <Window>((p) => { return(p != null); }, (p) => { var gridCursor = p.FindName("gridCursor") as Grid; var listViewMenu = p.FindName("ListViewMenu") as ListView; var listViewSelectedItem = (listViewMenu).SelectedItem as ListViewItem; gridCursor.Margin = new Thickness(0, 60 * listViewMenu.SelectedIndex, 0, 0); GridMain.Children.Clear(); switch (listViewSelectedItem.Name) { case "AccountInfo": GridMain.Children.Add(this.PageAccountInfor); break; case "BorrowBookList": GridMain.Children.Add(this.PageMemberBorrowList); break; case "AboutSoftware": GridMain.Children.Add(this.PageAboutSoftware); break; case "Logout": var messageboxResult = MyMessageBox.Show("Bạn có muốn đăng xuất khỏi phần mềm ?", "Cảnh báo", "Không", "Có", MessageBoxImage.Warning); if (messageboxResult == true) { listViewMenu.SelectedIndex = 0; this.MenuSelectionChangedCommand.Execute(p); } else { System.Diagnostics.Process.Start(Application.ResourceAssembly.Location); Application.Current.Shutdown(); } break; } }); LoadedWindow = new RelayCommand <Window>((p) => { return(p != null); }, (p) => { var titleBar = p.FindName("titleBar") as TitleBar; titleBar.Tag = "Library Manager - Member:" + MemberLogin.LastName + " " + MemberLogin.FirstName; if (MemberLogin.Status != true) { MyMessageBox.Show("Tài khoản của bạn đã bị khóa!\n\rLiên hệ quản trị viên để được hỗ trợ", "Thông báo", "OK", "", MessageBoxImage.Error); p.Close(); } InitPage(accountLogin); GridMain = p.FindName("gridMain") as Grid; GridMain.Children.Add(this.PageAccountInfor); var icoAccount = p.FindName("icoAccount") as PackIcon; int firstChar = char.ToUpper(MemberLogin.FirstName[0]); if (firstChar == 'A') { icoAccount.Kind = PackIconKind.AlphaACircle; } else if (firstChar == 'B') { icoAccount.Kind = PackIconKind.AlphaBCircle; } else { icoAccount.Kind = (PackIconKind)(158 + 5 * (firstChar - (int)'A' + 2)); } }); }
/// <summary> /// 捕获异常 /// </summary> /// <param name="ex"></param> protected virtual void CatchException(Exception ex) { MyMessageBox.Show(this, "处理数据时出现错误。", ExceptionMessageHelper.Trans(ex)); }
private void rebuildFFTPackMenuItem_Click(object sender, EventArgs e) { using (Ionic.Utils.FolderBrowserDialogEx folderBrowserDialog = new Ionic.Utils.FolderBrowserDialogEx()) { DoWorkEventHandler doWork = delegate(object sender1, DoWorkEventArgs args) { FFTPack.MergeDumpedFiles(folderBrowserDialog.SelectedPath, saveFileDialog.FileName, sender1 as BackgroundWorker); }; ProgressChangedEventHandler progress = delegate(object sender2, ProgressChangedEventArgs args) { progressBar.Visible = true; progressBar.Value = args.ProgressPercentage; }; RunWorkerCompletedEventHandler completed = null; completed = delegate(object sender3, RunWorkerCompletedEventArgs args) { progressBar.Visible = false; Enabled = true; patchPsxBackgroundWorker.ProgressChanged -= progress; patchPsxBackgroundWorker.RunWorkerCompleted -= completed; patchPsxBackgroundWorker.DoWork -= doWork; if (args.Error is Exception) { MyMessageBox.Show(this, "Could not merge files.\n" + "Make sure you chose the correct file and that there is\n" + "enough room in the destination directory.", "Error", MessageBoxButtons.OK); } }; saveFileDialog.OverwritePrompt = true; saveFileDialog.Filter = "fftpack.bin|fftpack.bin|All Files (*.*)|*.*"; saveFileDialog.FilterIndex = 0; folderBrowserDialog.Description = "Where are the extracted files?"; folderBrowserDialog.NewStyle = true; folderBrowserDialog.RootFolder = Environment.SpecialFolder.Desktop; folderBrowserDialog.SelectedPath = Environment.CurrentDirectory; folderBrowserDialog.ShowBothFilesAndFolders = false; folderBrowserDialog.ShowEditBox = true; folderBrowserDialog.ShowFullPathInEditBox = false; folderBrowserDialog.ShowNewFolderButton = false; if ((folderBrowserDialog.ShowDialog(this) == DialogResult.OK) && (saveFileDialog.ShowDialog(this) == DialogResult.OK)) { patchPsxBackgroundWorker.ProgressChanged += progress; patchPsxBackgroundWorker.RunWorkerCompleted += completed; patchPsxBackgroundWorker.DoWork += doWork; Environment.CurrentDirectory = folderBrowserDialog.SelectedPath; Enabled = false; progressBar.Value = 0; progressBar.Visible = true; progressBar.BringToFront(); patchPsxBackgroundWorker.RunWorkerAsync(); } } }
private void button1_Click(object sender, EventArgs e) { string Height = textBox1.Text; string Weight = textBox2.Text; string Neck = textBox3.Text; string BodyFat = textBox4.Text; string Shoulders = textBox6.Text; string LeftBicep = textBox5.Text; string LeftForearm = textBox7.Text; string RightBicep = textBox9.Text; string RightForearm = textBox8.Text; string Chest = textBox11.Text; string Waist = textBox10.Text; string Hips = textBox13.Text; string LeftThighs = textBox12.Text; string RightThighs = textBox15.Text; string LeftCalves = textBox14.Text; string RightCalves = textBox16.Text; try { using (SqlConnection connection2 = new SqlConnection( global::GymMembershipSystem.Properties.Settings.Default.GymMembershipSystemDatabase)) { using (SqlCommand cmd = new SqlCommand("INSERT INTO Measurement(Height, Weight, Neck, BodyFat, Shoulders," + "LeftBicep, LeftForearm, RightBicep, RightForearm, Chest, Waist, Hips," + "LeftThighs, RightThighs, LeftCalves, RightCalves, MemberId, Timestamp)" + "VALUES(@Height, @Weight, @Neck, @BodyFat, @Shoulders, @LeftBicep, @LeftForearm, @RightBicep, @RightForearm, @Chest, @Waist, @Hips," + "@LeftThighs, @RightThighs, @LeftCalves, @RightCalves, @UserId, @Timestamp)", connection2)) { cmd.Parameters.AddWithValue("@Height", textBox1.Text); cmd.Parameters.AddWithValue("@Weight", textBox2.Text); cmd.Parameters.AddWithValue("@Neck", textBox3.Text); cmd.Parameters.AddWithValue("@BodyFat", textBox4.Text); cmd.Parameters.AddWithValue("@Shoulders", textBox6.Text); cmd.Parameters.AddWithValue("@LeftBicep", textBox5.Text); cmd.Parameters.AddWithValue("@LeftForearm", textBox7.Text); cmd.Parameters.AddWithValue("@RightBicep", textBox9.Text); cmd.Parameters.AddWithValue("@RightForearm", textBox8.Text); cmd.Parameters.AddWithValue("@Chest", textBox11.Text); cmd.Parameters.AddWithValue("@Waist", textBox10.Text); cmd.Parameters.AddWithValue("@Hips", textBox13.Text); cmd.Parameters.AddWithValue("@LeftThighs", textBox12.Text); cmd.Parameters.AddWithValue("@RightThighs", textBox15.Text); cmd.Parameters.AddWithValue("@LeftCalves", textBox14.Text); cmd.Parameters.AddWithValue("@RightCalves", textBox16.Text); cmd.Parameters.AddWithValue("@UserId", comboBox1.SelectedValue); cmd.Parameters.AddWithValue("@Timestamp", DateTime.Now); cmd.Connection.Open(); if (cmd.ExecuteNonQuery().ToString() == "1") { List <Label> Labels = new List <Label>(); Labels.Add(MyLabel.SetOKLabel("Measurement Update")); Labels.Add(MyLabel.SetOKLabel("Measurement update passed")); List <Button> Buttons = new List <Button>(); Buttons.Add(MyButton.SetOKThemeButton()); MyMessageBox.Show( Labels, "", Buttons, MyImage.SetSuccess()); } else { List <Label> Labels = new List <Label>(); Labels.Add(MyLabel.SetOKLabel("Measurement Update")); Labels.Add(MyLabel.SetOKLabel("Measurement update failed")); List <Button> Buttons = new List <Button>(); Buttons.Add(MyButton.SetOKThemeButton()); MyMessageBox.Show( Labels, "", Buttons, MyImage.SetFailed()); } } connection2.Close(); } } catch (Exception ex) { List <Label> Labels = new List <Label>(); Labels.Add(MyLabel.SetOKLabel("General Error")); Labels.Add(MyLabel.SetOKLabel(ex.Message)); List <Button> Buttons = new List <Button>(); Buttons.Add(MyButton.SetOKThemeButton()); MyMessageBox.Show( Labels, "", Buttons, MyImage.SetFailed()); } }
private void checkedListBoxControlEmrNode_MouseDown(object sender, MouseEventArgs e) { try { if (e.Button != System.Windows.Forms.MouseButtons.Left) { return; } Point point = checkedListBoxControlEmrNode.PointToClient(Cursor.Position); int itemIndex = checkedListBoxControlEmrNode.IndexFromPoint(point); if (itemIndex >= 0) { CheckedListBoxItem item = (CheckedListBoxItem)checkedListBoxControlEmrNode.GetItem(itemIndex); if (point.X >= 4 && point.X <= 16) { if (m_FocusedCheckItem != item) { if (item.CheckState == CheckState.Checked) { item.CheckState = CheckState.Unchecked; } else { item.CheckState = CheckState.Checked; } } m_FocusedCheckItem = item; return; } m_CurrentEditorForm.CurrentEditorControl.EMRDoc.ClearContent(); if (item != null) { EmrNode emrNode = item.Value as EmrNode; if (emrNode != null) { if (emrNode.DataRowItem["content"].ToString() == "") { emrNode.DataRowItem["content"] = m_HistoryEmrBll.GetEmrContentByID(emrNode.ID); } string content = emrNode.DataRowItem["content"].ToString(); if (content != "") { try { XmlDocument doc = new XmlDocument(); doc.PreserveWhitespace = true; doc.LoadXml(content); m_CurrentEditorForm.CurrentEditorControl.LoadXML(doc); InitEditor(); m_CurrentEditorForm.CurrentEditorControl.EMRDoc.Content.SelectStart = 0; m_CurrentEditorForm.CurrentEditorControl.ScrollViewtopToCurrentElement(); } catch { } } } } m_FocusedCheckItem = item; } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }