private CEmployee GetDateFromEditors() { CEmployee employee = new CEmployee(); List <string> values = CBranch.GetEmployeeClassPropertes(employee); Dictionary <string, string> emp = new Dictionary <string, string>(); for (int i = 0; i < values.Count; i++) { TextBox tb = this.Controls.Find(values[i], true).FirstOrDefault() as TextBox; if (tb.Text != "") { employee[i] = tb.Text; } } string pattern = @"(?'date'(?:[0-9]?\d{2}\.[0-9]?\d{2}\.[0-9]?\d{4}))"; Regex newReg = new Regex(pattern); MatchCollection matches = newReg.Matches(employee.DateOfBirth); if (matches.Count == 0 && employee.DateOfBirth != "") { // throw new Exception("День рождения Должен быть в формате: дд.ММ.YYYY"); MessageBox.Show("День рождения Должен быть в формате: дд.ММ.YYYY"); employee = new CEmployee(); return(employee); } employee.SetDepartmentID(EMPOLOYEE.GetDepartmentID()); return(employee); }
private void SetTextInTextBoxes(CEmployee employee) { List <string> values = CBranch.GetEmployeeClassPropertes(employee); for (int i = 0; i < values.Count; i++) { TextBox tb = this.Controls.Find(values[i], true).FirstOrDefault() as TextBox; tb.Text = employee[i];//listViewEmployee.SelectedItems[0].SubItems[i].Text; } }
private void SetTextBoxes(CEmployee employee, int x, int y) { List <string> values = CBranch.GetEmployeeClassPropertes(employee); List <string> valuesInRus = CBranch.GetEmployeeValues(EMPLOEEYEEINRUS); int position = 0; int moveX, moveY; moveX = x; moveY = y; for (int i = 0; i < values.Count; i++) { TextBox textBoxSection = new TextBox(); textBoxSection.Location = new System.Drawing.Point(moveX, moveY); textBoxSection.Name = values[i]; textBoxSection.Size = new System.Drawing.Size(170, 23); textBoxSection.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left); splitContainer1.Panel2.Controls.Add(textBoxSection); Label Label = new Label(); Label.Location = new System.Drawing.Point(moveX, moveY - 30); Label.Name = values[i]; //Label.Text = values[i]; Label.Text = valuesInRus[i]; Label.Size = new System.Drawing.Size(105, 23); Label.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left); splitContainer1.Panel2.Controls.Add(Label); if (position != 2) { moveX = moveX + 200; position++; } else { position = 0; moveX = x; moveY = moveY + 60;; } } }