Beispiel #1
0
        private void cbox_user_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                if (e.KeyChar == (char)13)
                {
                    //========二维码扫描登录 write by 张建双========================================//

                    string  str = "select * from QRcodeLog where QRcode = '" + cbox_user.Text + "' and DelDT IS NULL";
                    DataSet ds  = db.GetPIVAsDB(str);
                    if (ds == null || ds.Tables[0].Rows.Count <= 0)
                    {
                        SendKeys.Send("{Tab}");
                        return;
                    }
                    label1.BackColor = Color.FromArgb(19, 179, 253);
                    //if (cob_word.Visible)
                    //{
                    //    txt_word.Text = cob_word.Text;
                    //    txt_word.Tag = cob_word.SelectedValue;
                    //}
                    //else
                    //{

                    DataSet dss = db.GetPIVAsDB("select wardcode from dward where wardname='" + txt_word.Text + "'");
                    if (dss != null || dss.Tables[0].Rows.Count > 0)
                    {
                        txt_word.Tag = dss.Tables[0].Rows[0]["wardcode"].ToString();
                    }

                    //}
                    NurseWorkStation IForm = new NurseWorkStation();
                    IForm.Owner           = this;
                    IForm.Txt_ward.Text   = txt_word.Text;
                    IForm.Txt_ward.Tag    = txt_word.Tag;
                    IForm.Login_Name.Text = ds.Tables[0].Rows[0]["DEmployeeName"].ToString();
                    NurseFormSet();
                    EmployeeID       = ds.Tables[0].Rows[0]["DEmployeeID"].ToString();
                    IForm.EmployeeID = this.EmployeeID;
                    IForm.Show();
                    this.Hide();
                    //========二维码扫描登录 write by 张建双========================================//
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        protected void LoginProving(string user, string pwd)
        {
            if (user == "")
            {
                MessageBox.Show("请输入登录用户名");
            }
            else
            {
                DataSet ds = db.GetPIVAsDB("select top 1 DEmployeeID,AccountID,Pas,DEmployeeCode,DEmployeeName from DEmployee where AccountID='" + user + "' and Pas='******'");
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {
                    MessageBox.Show("登录失败,输入密码错误或网络错误");
                }
                else if (ds.Tables[0].Rows.Count > 0)
                {
                    label1.BackColor = Color.FromArgb(19, 179, 253);
                    if (user.Length >= 4 && user.Substring(0, 4) != "7777")//扫描二维码不保存本地
                    {
                        con.PreserveLog(cbox_user.Text, txt_pwd.Text);
                    }

                    db.IniWriteValuePivas("User", "Ward", txt_word.Text);
                    DataSet dss = db.GetPIVAsDB("select wardcode from dward where wardname ='" + txt_word.Text + "'");
                    if (dss != null && dss.Tables[0].Rows.Count > 0)
                    {
                        txt_word.Tag = dss.Tables[0].Rows[0]["wardcode"].ToString();
                    }
                    else
                    {
                        MessageBox.Show("不存在该病区");
                    }

                    NurseFormSet();
                    EmployeeID = ds.Tables[0].Rows[0]["DEmployeeID"].ToString();
                    if (GetPivasLimit.Instance.Limit(EmployeeID, "08000"))
                    {
                        NurseWorkStation IForm = new NurseWorkStation();
                        IForm.Owner           = this;
                        IForm.Txt_ward.Text   = txt_word.Text;
                        IForm.Txt_ward.Tag    = txt_word.Tag;
                        IForm.Login_Name.Text = ds.Tables[0].Rows[0]["DEmployeeName"].ToString();

                        IForm.EmployeeID = this.EmployeeID;
                        IForm.Show();
                        this.Hide();
                    }
                }
            }
        }