| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- using Org.BouncyCastle.Asn1;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Text.Json;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace ddq
- {
- public partial class PersonnelQ : Form
- {
- private string personnelId;
- private string companyId;
- private int userId;
- public PersonnelQ(string personnelId, string companyId, int userId)
- {
- InitializeComponent();
- this.personnelId = personnelId;
- this.companyId = companyId;
- this.userId = userId;
- InitializeData();
-
- }
- private void InitializeData()
- {
- //int role_type;
- BindingSource bs = new BindingSource();
- Dictionary<int, string> d = new Dictionary<int, string>(Utility.RoleType);
- bs.DataSource = d;
- this.cmbRole.DataSource = bs;
- this.cmbRole.DisplayMember = "Value";
- this.cmbRole.ValueMember = "Key";
- this.cmbRole.SelectedValue = 1;
- if (personnelId != null)
- {
- DataTable dt = DataAccess.Get_dd_personnel_info(personnelId, companyId);
- if (dt != null && dt.Rows.Count > 0)
- {
- this.txtName.Text = dt.Rows[0]["name"].ToString();
- this.txtTitle.Text = dt.Rows[0]["title"].ToString();
- this.txtIndustryStartYear.Text = dt.Rows[0]["industry_start_year"].ToString();
- this.txtCompanyStartYear.Text = dt.Rows[0]["company_start_year"].ToString();
- this.txtBio.Text = dt.Rows[0]["bio"].ToString();
- string strRole = dt.Rows[0]["role"].ToString();
- int.TryParse(strRole, out int role);
- this.cmbRole.SelectedValue = role;
- }
- }
- }
- private void btnSavePersonnel_Click(object sender, EventArgs e)
- {
- int? companyStartYear = null;
- int? industryStartYear = null;
- if (int.TryParse(this.txtCompanyStartYear.Text, out int newYear)) { companyStartYear = newYear; }
- if (int.TryParse(this.txtIndustryStartYear.Text, out int newYear2)) { industryStartYear = newYear2; }
- DataAccess.Set_dd_personnel_info(personnelId, DateTime.Today, companyId,
- this.txtName.Text.Trim(),
- int.Parse(this.cmbRole.SelectedValue.ToString()),
- this.txtTitle.Text.Trim(),
- companyStartYear,
- industryStartYear,
- this.txtBio.Text.Trim(),
- 1, 1, userId, out string personnel_id);
- this.DialogResult = DialogResult.OK;
- }
- }
- }
|