Login
Болтавня о трудности работы 09.02.2025
583 просмотров
Перейти к просмотру всей ветки
in Antwort uscheswoi_82 Gestern, 09:32
Вот код frmNeuPatient.Designer.cs:
namespace HospitalSW { partial class frmNeuPatient { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.lbGeschlecht = new System.Windows.Forms.Label(); this.cboGeschlecht = new System.Windows.Forms.ComboBox(); this.lbVorname = new System.Windows.Forms.Label(); this.txtVorname = new System.Windows.Forms.TextBox(); this.lbNachname = new System.Windows.Forms.Label(); this.txtNachname = new System.Windows.Forms.TextBox(); this.lbGeburtsdatum = new System.Windows.Forms.Label(); this.mstxtBirthday = new System.Windows.Forms.MaskedTextBox(); this.btnSelectBirthday = new System.Windows.Forms.Button(); this.lbWohnaddresseDesPatientes = new System.Windows.Forms.Label(); this.lbPersonalDatenDesPatientes = new System.Windows.Forms.Label(); this.lbStrasse = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.lbHaus = new System.Windows.Forms.Label(); this.btnSpeichern = new System.Windows.Forms.Button(); this.btnAbbrechen = new System.Windows.Forms.Button(); this.lbPLZ = new System.Windows.Forms.Label(); this.txtPLZ = new System.Windows.Forms.TextBox(); this.lbStadt = new System.Windows.Forms.Label(); this.txtStadt = new System.Windows.Forms.TextBox(); this.popupStadt = new System.Windows.Forms.ContextMenuStrip(this.components); this.cToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.btnSuchePLZ = new System.Windows.Forms.Button(); this.btnSucheStadt = new System.Windows.Forms.Button(); this.popupStadt.SuspendLayout(); this.SuspendLayout(); // // lbGeschlecht // this.lbGeschlecht.AutoSize = true; this.lbGeschlecht.Location = new System.Drawing.Point(18, 36); this.lbGeschlecht.Name = "lbGeschlecht"; this.lbGeschlecht.Size = new System.Drawing.Size(30, 13); this.lbGeschlecht.TabIndex = 1; this.lbGeschlecht.Text = "Пол:"; // // cboGeschlecht // this.cboGeschlecht.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cboGeschlecht.FormattingEnabled = true; this.cboGeschlecht.Location = new System.Drawing.Point(116, 33); this.cboGeschlecht.Name = "cboGeschlecht"; this.cboGeschlecht.Size = new System.Drawing.Size(121, 21); this.cboGeschlecht.TabIndex = 2; // // lbVorname // this.lbVorname.AutoSize = true; this.lbVorname.Location = new System.Drawing.Point(18, 70); this.lbVorname.Name = "lbVorname"; this.lbVorname.Size = new System.Drawing.Size(32, 13); this.lbVorname.TabIndex = 3; this.lbVorname.Text = "Имя:"; // // txtVorname // this.txtVorname.Location = new System.Drawing.Point(116, 67); this.txtVorname.Name = "txtVorname"; this.txtVorname.Size = new System.Drawing.Size(297, 20); this.txtVorname.TabIndex = 4; // // lbNachname // this.lbNachname.AutoSize = true; this.lbNachname.Location = new System.Drawing.Point(18, 105); this.lbNachname.Name = "lbNachname"; this.lbNachname.Size = new System.Drawing.Size(59, 13); this.lbNachname.TabIndex = 5; this.lbNachname.Text = "Фамилия:"; // // txtNachname // this.txtNachname.Location = new System.Drawing.Point(116, 102); this.txtNachname.Name = "txtNachname"; this.txtNachname.Size = new System.Drawing.Size(297, 20); this.txtNachname.TabIndex = 6; // // lbGeburtsdatum // this.lbGeburtsdatum.AutoSize = true; this.lbGeburtsdatum.Location = new System.Drawing.Point(18, 139); this.lbGeburtsdatum.Name = "lbGeburtsdatum"; this.lbGeburtsdatum.Size = new System.Drawing.Size(89, 13); this.lbGeburtsdatum.TabIndex = 7; this.lbGeburtsdatum.Text = "Дата рождения:"; // // mstxtBirthday // this.mstxtBirthday.Location = new System.Drawing.Point(116, 136); this.mstxtBirthday.Mask = "00/00/0000"; this.mstxtBirthday.Name = "mstxtBirthday"; this.mstxtBirthday.Size = new System.Drawing.Size(100, 20); this.mstxtBirthday.TabIndex = 8; this.mstxtBirthday.ValidatingType = typeof(System.DateTime); // // btnSelectBirthday // this.btnSelectBirthday.Location = new System.Drawing.Point(222, 132); this.btnSelectBirthday.Name = "btnSelectBirthday"; this.btnSelectBirthday.Size = new System.Drawing.Size(28, 26); this.btnSelectBirthday.TabIndex = 9; this.btnSelectBirthday.Text = "..."; this.btnSelectBirthday.UseVisualStyleBackColor = true; this.btnSelectBirthday.Click += new System.EventHandler(this.btnSelectBirthday_Click); // // lbWohnaddresseDesPatientes // this.lbWohnaddresseDesPatientes.AutoSize = true; this.lbWohnaddresseDesPatientes.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbWohnaddresseDesPatientes.Location = new System.Drawing.Point(13, 191); this.lbWohnaddresseDesPatientes.Name = "lbWohnaddresseDesPatientes"; this.lbWohnaddresseDesPatientes.Size = new System.Drawing.Size(182, 13); this.lbWohnaddresseDesPatientes.TabIndex = 10; this.lbWohnaddresseDesPatientes.Text = "Адрес проживания пациента:"; // // lbPersonalDatenDesPatientes // this.lbPersonalDatenDesPatientes.AutoSize = true; this.lbPersonalDatenDesPatientes.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbPersonalDatenDesPatientes.Location = new System.Drawing.Point(13, 9); this.lbPersonalDatenDesPatientes.Name = "lbPersonalDatenDesPatientes"; this.lbPersonalDatenDesPatientes.Size = new System.Drawing.Size(206, 13); this.lbPersonalDatenDesPatientes.TabIndex = 0; this.lbPersonalDatenDesPatientes.Text = "Персональные данные пациента:"; // // lbStrasse // this.lbStrasse.AutoSize = true; this.lbStrasse.Location = new System.Drawing.Point(21, 225); this.lbStrasse.Name = "lbStrasse"; this.lbStrasse.Size = new System.Drawing.Size(42, 13); this.lbStrasse.TabIndex = 11; this.lbStrasse.Text = "Улица:"; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(116, 222); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(171, 20); this.textBox1.TabIndex = 12; // // textBox2 // this.textBox2.Location = new System.Drawing.Point(332, 222); this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(81, 20); this.textBox2.TabIndex = 14; // // lbHaus // this.lbHaus.AutoSize = true; this.lbHaus.Location = new System.Drawing.Point(293, 225); this.lbHaus.Name = "lbHaus"; this.lbHaus.Size = new System.Drawing.Size(33, 13); this.lbHaus.TabIndex = 13; this.lbHaus.Text = "Дом:"; // // btnSpeichern // this.btnSpeichern.Location = new System.Drawing.Point(24, 387); this.btnSpeichern.Name = "btnSpeichern"; this.btnSpeichern.Size = new System.Drawing.Size(75, 23); this.btnSpeichern.TabIndex = 19; this.btnSpeichern.Text = "&Сохранить"; this.btnSpeichern.UseVisualStyleBackColor = true; this.btnSpeichern.Click += new System.EventHandler(this.btnSpeichern_Click); // // btnAbbrechen // this.btnAbbrechen.Location = new System.Drawing.Point(113, 387); this.btnAbbrechen.Name = "btnAbbrechen"; this.btnAbbrechen.Size = new System.Drawing.Size(75, 23); this.btnAbbrechen.TabIndex = 20; this.btnAbbrechen.Text = "&Отмена"; this.btnAbbrechen.UseVisualStyleBackColor = true; this.btnAbbrechen.Click += new System.EventHandler(this.btnAbbrechen_Click); // // lbPLZ // this.lbPLZ.AutoSize = true; this.lbPLZ.Location = new System.Drawing.Point(21, 262); this.lbPLZ.Name = "lbPLZ"; this.lbPLZ.Size = new System.Drawing.Size(81, 13); this.lbPLZ.TabIndex = 15; this.lbPLZ.Text = "Почтовый код:"; // // txtPLZ // this.txtPLZ.AutoCompleteCustomSource.AddRange(new string[] { "aa"}); this.txtPLZ.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.txtPLZ.Location = new System.Drawing.Point(116, 259); this.txtPLZ.Name = "txtPLZ"; this.txtPLZ.Size = new System.Drawing.Size(87, 20); this.txtPLZ.TabIndex = 16; this.txtPLZ.TextChanged += new System.EventHandler(this.txtPLZ_TextChanged); // // lbStadt // this.lbStadt.AutoSize = true; this.lbStadt.Location = new System.Drawing.Point(238, 262); this.lbStadt.Name = "lbStadt"; this.lbStadt.Size = new System.Drawing.Size(40, 13); this.lbStadt.TabIndex = 17; this.lbStadt.Text = "Город:"; // // txtStadt // this.txtStadt.Location = new System.Drawing.Point(281, 259); this.txtStadt.Name = "txtStadt"; this.txtStadt.Size = new System.Drawing.Size(110, 20); this.txtStadt.TabIndex = 18; this.txtStadt.TextChanged += new System.EventHandler(this.txtStadt_TextChanged); // // popupStadt // this.popupStadt.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cToolStripMenuItem}); this.popupStadt.Name = "popupStadt"; this.popupStadt.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; this.popupStadt.Size = new System.Drawing.Size(102, 28); // // cToolStripMenuItem // this.cToolStripMenuItem.Name = "cToolStripMenuItem"; this.cToolStripMenuItem.Size = new System.Drawing.Size(101, 24); this.cToolStripMenuItem.Text = "c"; // // btnSuchePLZ // this.btnSuchePLZ.Location = new System.Drawing.Point(209, 259); this.btnSuchePLZ.Name = "btnSuchePLZ"; this.btnSuchePLZ.Size = new System.Drawing.Size(28, 23); this.btnSuchePLZ.TabIndex = 21; this.btnSuchePLZ.Text = "..."; this.btnSuchePLZ.UseVisualStyleBackColor = true; this.btnSuchePLZ.Click += new System.EventHandler(this.btnSucheStadt_Click); // // btnSucheStadt // this.btnSucheStadt.Location = new System.Drawing.Point(397, 259); this.btnSucheStadt.Name = "btnSucheStadt"; this.btnSucheStadt.Size = new System.Drawing.Size(28, 23); this.btnSucheStadt.TabIndex = 22; this.btnSucheStadt.Text = "..."; this.btnSucheStadt.UseVisualStyleBackColor = true; this.btnSucheStadt.Click += new System.EventHandler(this.btnSucheStadt_Click); // // frmNeuPatient // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(438, 422); this.Controls.Add(this.btnSucheStadt); this.Controls.Add(this.btnSuchePLZ); this.Controls.Add(this.btnAbbrechen); this.Controls.Add(this.txtStadt); this.Controls.Add(this.lbStadt); this.Controls.Add(this.txtPLZ); this.Controls.Add(this.btnSpeichern); this.Controls.Add(this.lbPersonalDatenDesPatientes); this.Controls.Add(this.lbPLZ); this.Controls.Add(this.lbHaus); this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox1); this.Controls.Add(this.lbStrasse); this.Controls.Add(this.lbGeschlecht); this.Controls.Add(this.btnSelectBirthday); this.Controls.Add(this.lbWohnaddresseDesPatientes); this.Controls.Add(this.mstxtBirthday); this.Controls.Add(this.lbGeburtsdatum); this.Controls.Add(this.txtNachname); this.Controls.Add(this.lbNachname); this.Controls.Add(this.txtVorname); this.Controls.Add(this.lbVorname); this.Controls.Add(this.cboGeschlecht); this.Name = "frmNeuPatient"; this.Text = "Новый пациент"; this.Load += new System.EventHandler(this.frmNeuPatient_Load); this.popupStadt.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label lbGeschlecht; private System.Windows.Forms.ComboBox cboGeschlecht; private System.Windows.Forms.Label lbVorname; private System.Windows.Forms.TextBox txtVorname; private System.Windows.Forms.Label lbNachname; private System.Windows.Forms.TextBox txtNachname; private System.Windows.Forms.Label lbGeburtsdatum; private System.Windows.Forms.MaskedTextBox mstxtBirthday; private System.Windows.Forms.Button btnSelectBirthday; private System.Windows.Forms.Label lbWohnaddresseDesPatientes; private System.Windows.Forms.Label lbPersonalDatenDesPatientes; private System.Windows.Forms.Label lbStrasse; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Label lbHaus; private System.Windows.Forms.Button btnSpeichern; private System.Windows.Forms.Button btnAbbrechen; private System.Windows.Forms.Label lbPLZ; private System.Windows.Forms.TextBox txtPLZ; private System.Windows.Forms.Label lbStadt; private System.Windows.Forms.TextBox txtStadt; private System.Windows.Forms.ContextMenuStrip popupStadt; private System.Windows.Forms.ToolStripMenuItem cToolStripMenuItem; private System.Windows.Forms.Button btnSuchePLZ; private System.Windows.Forms.Button btnSucheStadt; } }
Вот код frmNeuPatient.cs, вот так надо комментировать каждую строчку но на немецком языке, иначе уволят с работы:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.OleDb; using System.Resources; using System.Reflection; namespace HospitalSW { public partial class frmNeuPatient : Form { private const String cAnredeSQL = "SELECT AnredeID, Bezeichnen FROM tblAnrede"; private const String cConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data Source=C:\hospital2024\hospitaldb.mdb"; private ResourceManager rm = null; /// <summary> /// Конструктор формы /// </summary> public frmNeuPatient() { InitializeComponent(); //rm = new ResourceManager("frmNeuPatient.Resource1", _currAssembly); //MessageBox.Show(rm.GetString("C_ERROR_DB")); } /// <summary> /// Выдаёт диалоговое окно с сообщением ошибки /// </summary> /// <param name="strError">Текст с ошибкой</param> /// <param name="strTitle">Заголовок окна</param> /// <returns>Ничего не возвращает</returns> private void ShowErrorMessageBox(String strError, String strTitle) { /* Отображает диалоговое сообщение с ошибкой */ MessageBox.Show(strError, strTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } /// <summary> /// Выдаёт диалоговое окно с кодом ошибки и с сообщением ошибки /// </summary> /// <param name="intErrorid">Код ошибки</param> /// <param name="strError">Текст с ошибкой</param> /// <param name="strTitle">Заголовок окна</param> /// <returns>Ничего не возвращает</returns> private void ShowErrorMessageBox(int intErrorid, String strError, String strTitle) { this.ShowErrorMessageBox("Код ошибки:" + intErrorid.ToString() + " " + strError, strTitle); } /// <summary> /// Срабаатывает при загрузки формы /// </summary> /// <param name="sender">...</param> /// <param name="e">...</param> /// <returns>Ничего не возвращает</returns> /// <exception>Если не сможет подключиться к СУБД или открыть базу данных, то произойдёт ошибка и отоброзится /// диалоговое окно с ошибкой. /// </exception> private void frmNeuPatient_Load(object sender, EventArgs e) { /* Для combobox/dropdown Пол */ try { /* Подключается к СУБД Microsoft Access и открывает базу данных hospitaldb.mdb */ OleDbConnection conAnrede = new OleDbConnection(cConnectionString); /* Открывает соединение */ conAnrede.Open(); /* Выполняет SQL-запрос */ OleDbDataAdapter daAnrede = new OleDbDataAdapter(cAnredeSQL, conAnrede); DataTable dtAnrede = new DataTable(); daAnrede.Fill(dtAnrede); /* Для значения в ComboBox */ this.cboGeschlecht.ValueMember = "AnredeID"; /* То что отображается в ComboBox */ this.cboGeschlecht.DisplayMember = "Bezeichnen"; /* Связывается с СУБД, и добавляет данные в ComboBox */ this.cboGeschlecht.DataSource = dtAnrede; } catch(Exception ex) { /* Отображает диалоговое сообщение с ошибкой */ this.ShowErrorMessageBox("Ощибка невозможно открыть базу данных!", "Ошибка"); } } private void btnSelectBirthday_Click(object sender, EventArgs e) { frmCalendar frmCalend = new frmCalendar(this.mstxtBirthday); frmCalend.Show(); } private void txtPLZ_TextChanged(object sender, EventArgs e) { this.popupStadt.Show(new Point(this.txtPLZ.Left, 200)); } private void txtStadt_TextChanged(object sender, EventArgs e) { } private void btnSpeichern_Click(object sender, EventArgs e) { try { } catch (Exception ex) { } this.Close(); } private void btnAbbrechen_Click(object sender, EventArgs e) { this.Close(); } private void btnSucheStadt_Click(object sender, EventArgs e) { frmStadtSuchen frmSS = new frmStadtSuchen(this.txtStadt, this.txtPLZ); frmSS.Show(); } } }
Если я кому-то отвечаю, это не значит что я ему симпатизирую, каждый остаётся при своём мнение