/// <summary> /// Кнопка редактиировать из таблицы /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_edit_Click(object sender, RoutedEventArgs e) { var bt = e.OriginalSource as Button; var current = bt.DataContext as DB.Contragent; if (current != null) { try { text_editnamecontragent.Text = "Редактирование элемента " + current.Name; using (DB.RegistrantCoreContext ef = new DB.RegistrantCoreContext()) { var temp = ef.Contragents.FirstOrDefault(x => x.IdContragent == current.IdContragent); tb_idcontragent.Text = temp.IdContragent.ToString(); tb_edit_name.Text = temp.Name.ToString(); ContentEdit.ShowAsync(); } } catch (Exception ex) { ((MainWindow)System.Windows.Application.Current.MainWindow).ContentErrorText.ShowAsync(); ((MainWindow)System.Windows.Application.Current.MainWindow).text_debuger.Text = ex.ToString(); } } }
/// <summary> /// Кнопка редактиировать из таблицы /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_edit_Click(object sender, RoutedEventArgs e) { var bt = e.OriginalSource as Button; var current = bt?.DataContext as Contragent; if (current != null) { try { text_editnamecontragent.Text = $"Редактирование элемента {current.Name}"; using RegistrantCoreContext ef = new RegistrantCoreContext(); var contragent = ef.Contragents.FirstOrDefault(x => x.IdContragent == current.IdContragent); if (contragent != null) { tb_idcontragent.Text = contragent.IdContragent.ToString(); tb_edit_name.Text = contragent.Name; } ContentEdit.ShowAsync(); } catch (Exception ex) { MainWindow mainWindow = (MainWindow)Application.Current.MainWindow; if (mainWindow != null) { mainWindow.ContentErrorText.ShowAsync(); mainWindow.text_debuger.Text = ex.ToString(); } } } }
/// <summary> /// Кнопка сохранить изменения /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_save_edit_Click(object sender, RoutedEventArgs e) { try { using RegistrantCoreContext ef = new RegistrantCoreContext(); var contragent = ef.Contragents.FirstOrDefault(x => x.IdContragent == Convert.ToInt32(tb_idcontragent.Text)); if (contragent != null) { contragent.Name = tb_edit_name.Text; contragent.ServiceInfo = $"{contragent.ServiceInfo}\n {DateTime.Now} {App.ActiveUser} изменил название контрагента"; } ef.SaveChanges(); btn_refresh_Click(sender, e); ContentEdit.Hide(); } catch (Exception ex) { MainWindow mainWindow = (MainWindow)Application.Current.MainWindow; if (mainWindow != null) { mainWindow.ContentErrorText.ShowAsync(); mainWindow.text_debuger.Text = ex.ToString(); } } }
// Use this for initialization void Start() { jsonEdit = GameObject.Find("PanelCellWorld").GetComponent <JsonEdit>(); // xmlEdit = GameObject.Find("PanelCellWorld").GetComponent<XmlEdit>(); contentEdit = GameObject.Find("PanelCellWorld").GetComponent <ContentEdit>(); cellObj = jsonEdit.cellObj; cellBranchObj = jsonEdit.cellBranchObj; }
//Кнопка удалить private void btn_delete_Click(object sender, RoutedEventArgs e) { if (tb_idcontragent != null) { try { using RegistrantCoreContext ef = new RegistrantCoreContext(); var temp = ef.Contragents.FirstOrDefault(x => x.IdContragent == Convert.ToInt32(tb_idcontragent.Text)); if (temp != null) { temp.Active = "0"; } ef.SaveChanges(); ContentEdit.Hide(); } catch (Exception ex) { MainWindow mainWindow = (MainWindow)Application.Current.MainWindow; if (mainWindow != null) { mainWindow.ContentErrorText.ShowAsync(); mainWindow.text_debuger.Text = ex.ToString(); } } } //Кнопа перенесена в другоме место, /*var bt = e.OriginalSource as Button; * var current = bt.DataContext as DB.Contragent; * * try * { * using RegistrantCoreContext ef = new RegistrantCoreContext(); * var contragent = ef.Contragents.FirstOrDefault(x => x.IdContragent == current.IdContragent); * if (contragent != null) * { * contragent.Active = "0"; * contragent.ServiceInfo = $"{contragent.ServiceInfo}\n{DateTime.Now} {App.ActiveUser} изменил удалил"; * } * ef.SaveChanges(); * btn_refresh_Click(sender, e); * } * catch (Exception ex) * { * MainWindow mainWindow = (MainWindow) Application.Current.MainWindow; * if (mainWindow != null) * { * mainWindow.ContentErrorText.ShowAsync(); * mainWindow.text_debuger.Text = ex.ToString(); * } * } * }*/ }
// Start is called before the first frame update void Start() { ContentEdit contentEdit = FindObjectOfType <ContentEdit>(); if (contentEdit != null) { for (int i = 0; i < tiredColor.Length; i++) { tiredColor[i].material.color = contentEdit.colorTires; } bodywordColor.material.color = contentEdit.bodywork; } else { Debug.LogWarning("not instaciate contentEdit"); } }
//Кнопка удалить private void btn_delete_Click(object sender, RoutedEventArgs e) { if (tb_idcontragent != null) { try { using (DB.RegistrantCoreContext ef = new DB.RegistrantCoreContext()) { var temp = ef.Contragents.FirstOrDefault(x => x.IdContragent == Convert.ToInt64(tb_idcontragent.Text)); temp.Active = "0"; ef.SaveChanges(); ContentEdit.Hide(); } } catch (Exception ex) { ((MainWindow)System.Windows.Application.Current.MainWindow).ContentErrorText.ShowAsync(); ((MainWindow)System.Windows.Application.Current.MainWindow).text_debuger.Text = ex.ToString(); } } //Кнопа перенесена в другоме место, /*var bt = e.OriginalSource as Button; * var current = bt.DataContext as DB.Contragent; * * try * { * using (DB.RegistrantCoreContext ef = new DB.RegistrantCoreContext()) * { * var temp = ef.Contragents.FirstOrDefault(x => x.IdContragent == current.IdContragent); * temp.Active = "0"; * temp.ServiceInfo = temp.ServiceInfo + "\n" + DateTime.Now + " " + App.ActiveUser + " изменил удалил"; * ef.SaveChanges(); * btn_refresh_Click(sender, e); * * } * } * catch (Exception ex) * { * ((MainWindow)System.Windows.Application.Current.MainWindow).ContentErrorText.ShowAsync(); * ((MainWindow)System.Windows.Application.Current.MainWindow).text_debuger.Text = ex.ToString(); * }*/ }
/// <summary> /// Кнопка сохранить изменения /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_save_edit_Click(object sender, RoutedEventArgs e) { try { using (DB.RegistrantCoreContext ef = new DB.RegistrantCoreContext()) { var temp = ef.Contragents.FirstOrDefault(x => x.IdContragent == Convert.ToInt64(tb_idcontragent.Text)); temp.Name = tb_edit_name.Text; temp.ServiceInfo = temp.ServiceInfo + "\n" + DateTime.Now + " " + App.ActiveUser + " изменил название контрагента"; ef.SaveChanges(); //btn_refresh_Click(sender, e); ContentEdit.Hide(); } } catch (Exception ex) { ((MainWindow)System.Windows.Application.Current.MainWindow).ContentErrorText.ShowAsync(); ((MainWindow)System.Windows.Application.Current.MainWindow).text_debuger.Text = ex.ToString(); } }
/// <summary> /// 确定事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtITEMNAME.Text)) { MyMessageBox.Show("节点名称不能为空", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); txtITEMNAME.Focus(); return; } if (string.IsNullOrEmpty(ContentEdit.Text)) { MyMessageBox.Show("诊断内容不能为空", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); ContentEdit.Focus(); return; } if (Tool.GetByteLength(txtITEMNAME.Text) > 200) { MyMessageBox.Show("节点名称字符长度不能大于200,请重新输入。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); txtITEMNAME.Focus(); return; } if (Tool.GetByteLength(ContentEdit.Text) > 4000) { MyMessageBox.Show("内容字符长度不能大于4000,请重新输入。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); ContentEdit.Focus(); return; } PatRecUtil prUtil = new PatRecUtil(m_App, m_App.CurrentPatientInfo); prUtil.UpdateNodeContent(NID, NodeID, ParentNode, DS_Common.FilterSpecialCharacter(ContentEdit.EditValue.ToString()), DS_Common.FilterSpecialCharacter(txtITEMNAME.Text)); NodeTitle = this.txtITEMNAME.Text; NodeContent = this.ContentEdit.EditValue.ToString(); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
/// <summary> /// 确定操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtITEMNAME.Text)) { MyMessageBox.Show("节点名称不能为空", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); txtITEMNAME.Focus(); return; } if (string.IsNullOrEmpty(ContentEdit.Text)) { MyMessageBox.Show("诊断内容不能为空", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); ContentEdit.Focus(); return; } if (Tool.GetByteLength(txtITEMNAME.Text) > 200) { MyMessageBox.Show("子类名称字符长度不能大于200,请重新输入。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); txtITEMNAME.Focus(); return; } if (Tool.GetByteLength(ContentEdit.Text) > 4000) { MyMessageBox.Show("子类名称字符长度不能大于4000,请重新输入。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); ContentEdit.Focus(); return; } PatRecUtil prUtil = new PatRecUtil(m_App, m_App.CurrentPatientInfo); string m_node; string m_parentnode; prUtil.InsertChildNode(DiagID, "node", NodeID, DS_Common.FilterSpecialCharacter(this.txtITEMNAME.Text), DS_Common.FilterSpecialCharacter(this.ContentEdit.Text), "indexid", "1", out m_node, out m_parentnode); this.DialogResult = DialogResult.OK; string m_title; string m_content; SetTitleContent(out m_title, out m_content); SetNodeAndPNode(m_node, m_parentnode); this.Close(); }
//Кнопка закрыть окна редактирования private void btn_edit_close_Click(object sender, RoutedEventArgs e) { ContentEdit.Hide(); }
// Use this for initialization void Start() { imgRect = GetComponent <RectTransform>(); canvas = GameObject.Find("Canvas").GetComponent <RectTransform>(); contentEdit = GameObject.Find("PanelCellWorld").GetComponent <ContentEdit>(); }