123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using UAS_MES_NEW.Entity;
- using UAS_MES_NEW.PublicMethod;
- using DevExpress.XtraBars;
- using UAS_MES_NEW.PublicForm;
- namespace UAS_MES_NEW.CustomControl.TextBoxWithIcon
- {
- public partial class SnCollectionBox : EnterTextBox
- {
- public SnCollectionBox()
- {
- InitializeComponent();
- }
- public override string Text
- {
- get
- {
- if (SystemInf.UpperCollection && !base.Text.Contains("CHANGEUSER:"))
- return base.Text.ToUpper();
- else
- return base.Text;
- }
- set
- {
- base.Text = value;
- }
- }
- private void SnCollectionBox_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- this.SelectAll();
- //切换账号功能
- if (Text.Contains("CHANGEUSER:"))
- {
- string UserCode = Text.Replace("CHANGEUSER:", "").Split('|')[0];
- string Password = Text.Replace("CHANGEUSER:", "").Split('|')[1];
- string oErr = "";
- if (!LogicHandler.CheckUserLogin(UserCode, Password, "", out oErr))
- {
- SetUserChange set = new SetUserChange(oErr, Color.Red);
- BaseUtil.SetFormCenter(set);
- set.ShowDialog(); ; return;
- }
- if (!LogicHandler.CheckUserAndResourcePassed(UserCode, User.UserSourceCode, out oErr))
- {
- SetUserChange set = new SetUserChange(oErr, Color.Red);
- BaseUtil.SetFormCenter(set);
- set.ShowDialog(); ; return;
- }
- string[] field = { "em_code,em_depart,em_type,em_name,em_position,em_professname,em_type,ug_code,ug_name" };
- DataTable UserInf = SystemInf.dh.getFieldsDataByCondition("Employee left join cs$userresource on ur_emcode=em_code left join cs$usergroup on ug_code=ur_groupcode", field, "upper(em_code)='" + UserCode.ToUpper() + "' or em_mobile='" + UserCode + "'");
- //通过Source表关联岗位资源编号查询出当前的执行工序
- User.UserCode = UserInf.Rows[0]["em_code"].ToString();
- User.UserName = UserInf.Rows[0]["em_name"].ToString();
- Control ctl = BaseUtil.GetControl(this, "Main");
- if (ctl != null)
- {
- Main Main = (Main)ctl;
- Main.Inf_username_label.Caption = "姓名 : " + User.UserName;
- SetUserChange set = new SetUserChange("切换人员:" + User.UserName, Color.Green);
- BaseUtil.SetFormCenter(set);
- set.ShowDialog();
- }
- Clear();
- return;
- }
- }
- }
- }
- }
|