public frmReLogin() { InitializeComponent(); this.FormClosing += new FormClosingEventHandler(frmReLogin_FormClosing); comboBox1.DisplayMember = "COMPANY_NAME"; comboBox1.ValueMember = "COMPANY_CODE"; comboBox2.DisplayMember = "PLINE_NAME"; comboBox2.ValueMember = "RMES_ID"; comboBox3.DisplayMember = "STATION_NAME"; comboBox3.ValueMember = "RMES_ID"; comboBox4.DisplayMember = "SHIFT_NAME"; comboBox4.ValueMember = "RMES_ID"; comboBox5.DisplayMember = "TEAM_NAME"; comboBox5.ValueMember = "RMES_ID"; comboBox1.DataSource = CompanyFactory.GetAll(); string _companycode = DB.ReadConfigLocal("COMPANY_CODE"); if (!_companycode.Equals(string.Empty)) { comboBox1.SelectedValue = _companycode; CompanyEntity company = CompanyFactory.GetByKey(_companycode); if (company != null) { LoginInfo.CompanyInfo = company; initComboBoxByCompany(); } } initing = false; }
private void txtBc_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar.ToString().Equals("\r")) { try { if (txtBc.Text == "") { txtBc.Focus(); return; } string shift = txtBc.Text.Trim().ToUpper(); switch (shift) { case "$QUIT": Process.Start("shutdown.exe", "-s -t 10"); break; case "$EXIT": this.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Close(); break; case "$CANC": txtBc.Focus(); break; default: break; } DB.WriteConfigLocal("SHIFT_CODE", shift); LoginInfo.ShiftInfo = ShiftFactory.GetBySCode(shift); List <ProductLineEntity> plines = ProductLineFactory.GetAll(); DB.WriteConfigLocal("COMPANY_CODE", LoginInfo.ShiftInfo.COMPANY_CODE); LoginInfo.CompanyInfo = CompanyFactory.GetByKey(LoginInfo.ShiftInfo.COMPANY_CODE); txtBc.Text = ""; txtBc.Text = LoginInfo.ShiftInfo.SHIFT_NAME; e.Handled = true; //if (txtBz.Text == "") { txtBz.Focus(); return; } } catch { txtBc.Text = ""; txtBc.SelectionStart = 0; txtBc.SelectionLength = txtBc.Text.Length; txtBc.Focus(); } //this.button1_Click(txtBz, null); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (initing) { return; } object val = comboBox1.SelectedValue; if (val != null) { DB.WriteConfigLocal("COMPANY_CODE", val.ToString()); LoginInfo.CompanyInfo = CompanyFactory.GetByKey(val.ToString()); initComboBoxByCompany(); } }