Exemplo n.º 1
0
        private void IniteData()
        {
            //权限
            btnSearch.Enabled = Information.UsePower.ContainsKey(CommonInfo.UserPowers.门诊查询.SafeDbValue <int>());

            DataTable dtTable = bllEmployee.GetEmployeeInfo(string.Empty);
            DataRow   drRow1  = dtTable.NewRow();

            drRow1["DocName"] = @"全部";
            drRow1["DocID"]   = @"-1";
            dtTable.Rows.InsertAt(drRow1, 0);
            cmbEmployees.DataSource    = dtTable;
            cmbEmployees.DisplayMember = @"DocName";
            cmbEmployees.ValueMember   = @"DocID";

            DataTable dtStyle = bllConfig.GetConfigInfo(CommonInfo.ConfigStyle.药品类别.SafeDbValue <int>()).Tables[0];
            DataRow   drRow2  = dtStyle.NewRow();

            drRow2["SignID"] = @"-1";
            drRow2["Name"]   = @"全部";
            dtStyle.Rows.InsertAt(drRow2, 0);
            cmbStyle.ValueMember   = @"SignID";
            cmbStyle.DisplayMember = @"Name";
            cmbStyle.DataSource    = dtStyle;

            DataTable dtPat  = bllPations.GetPationes(string.Empty);
            DataRow   drRow3 = dtPat.NewRow();

            drRow3["PatID"]   = @"-1";
            drRow3["PatName"] = @"全部";
            dtPat.Rows.InsertAt(drRow3, 0);
            cmbPations.DataSource    = dtPat;
            cmbPations.ValueMember   = @"PatID";
            cmbPations.DisplayMember = @"PatName";
        }
Exemplo n.º 2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dgvEmployee.DataSource          = null;
            dgvEmployee.AutoGenerateColumns = false;
            DataTable dtTable = bllEmployee.GetEmployeeInfo(txtKey.Text, 1);

            dgvEmployee.DataSource = dtTable;
        }
Exemplo n.º 3
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dgvEmployee.DataSource          = null;
            dgvEmployee.AutoGenerateColumns = false;
            DataTable dtTable = bllEmployee.GetEmployeeInfo(txtKey.Text.Trim());

            dgvEmployee.DataSource = dtTable;
            lblSum.Text            = "总数:" + dtTable.Rows.Count;
            dtTable.Dispose();
        }
Exemplo n.º 4
0
        public FrmPrescription()
        {
            InitializeComponent();
            DgvColumn();

            DataTable dtTable = bllEmployee.GetEmployeeInfo(string.Empty);
            DataRow   drRow   = dtTable.NewRow();

            drRow["DocName"] = "全部";
            drRow["DocID"]   = "0";
            dtTable.Rows.InsertAt(drRow, 0);
            cmbEmployees.DataSource    = dtTable;
            cmbEmployees.DisplayMember = @"DocName";
            cmbEmployees.ValueMember   = @"DocID";
        }
Exemplo n.º 5
0
        public FrmPlanSearch()
        {
            InitializeComponent();
            DgvColumns();
            DataTable dtTable = bllEmployee.GetEmployeeInfo(string.Empty);
            DataRow   drRow   = dtTable.NewRow();

            drRow["DocName"] = "全部";
            drRow["DocID"]   = "0";
            dtTable.Rows.InsertAt(drRow, 0);
            cmbEmployees.DataSource    = dtTable;
            cmbEmployees.DisplayMember = @"DocName";
            cmbEmployees.ValueMember   = @"DocID";

            DataTable dtUseWay = bllConfig.GetConfigInfo(CommonInfo.ConfigStyle.方案类别.SafeDbValue <int>()).Tables[0];
            DataRow   drRows   = dtUseWay.NewRow();

            drRows["Name"]   = "全部";
            drRows["SignID"] = "0";
            dtUseWay.Rows.InsertAt(drRows, 0);
            cmbPlan.DataSource    = dtUseWay;
            cmbPlan.ValueMember   = @"SignID";
            cmbPlan.DisplayMember = @"Name";
        }
Exemplo n.º 6
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(cmbEmpID.Text.Trim()) || string.IsNullOrEmpty(txtPassword.Text))
                {
                    MessageBox.Show(@"请输入账号和密码!");
                    return;
                }
                try
                {
                    BllEmployee bllEmployee = new BllEmployee();
                    using (DataTable dsUser = bllEmployee.GetEmployeeInfo(cmbEmpID.Text.Trim()))
                    {
                        if (dsUser == null)
                        {
                            MessageBox.Show(@"工号输入错误或不存在该人员工号!");
                            cmbEmpID.Text    = string.Empty;
                            txtPassword.Text = string.Empty;
                            cmbEmpID.Focus();
                            return;
                        }
                        if (dsUser.Rows.Count == 0)
                        {
                            MessageBox.Show(@"没有创建该用户!");
                            cmbEmpID.Text    = string.Empty;
                            txtPassword.Text = string.Empty;
                            cmbEmpID.Focus();
                            return;
                        }
                        if (!dsUser.Rows[0]["DocPassword"].SafeDbValue <string>().Equals(txtPassword.Text))
                        {
                            MessageBox.Show(@"密码错误,请重新输入!");
                            txtPassword.Text = string.Empty;
                            txtPassword.Focus();
                            return;
                        }
                        //保存登录用户信息
                        Information.CurrentUser = dsUser.Rows[0];
                        dsUser.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(@"数据库无法访问!" + ex.ToString());
                    return;
                }
                empID = this.cmbEmpID.Text.Trim();
                //记住用户名
                if (chkRemenber.Checked)
                {
                    List <string> lstLoginName = new List <string>
                    {
                        empID
                    };
                    string[] registry = ResistryKey.GetRegistry(RegisterValueName);
                    if (null != registry)
                    {
                        foreach (string name in registry.TakeWhile(name => lstLoginName.Count < MaxLoginNameSaveCount).Where(name => 0 != StringComparer.CurrentCulture.Compare(empID.ToUpper(), name.ToUpper())))
                        {
                            lstLoginName.Add(name);
                        }
                    }
                    ResistryKey.SetRegistry(RegisterValueName, lstLoginName.ToArray());
                }

                //用户权限
                DataTable dtPower = bllEmpPower.GetEmpPower(empID);
                for (int i = 0; i < dtPower.Rows.Count; i++)
                {
                    Information.UsePower.Add(Convert.ToInt32(dtPower.Rows[i]["PowerID"]), dtPower.Rows[i]["DocID"].ToString());
                }

                //主界面
                FrmMain frmMain = new FrmMain();
                this.Hide();
                frmMain.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 7
0
        private void btnLogin_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(cmbEmpID.Text) || string.IsNullOrEmpty(txtPassword.Text))
            {
                MessageBox.Show(@"请输入账号和密码!");
                return;
            }
            BllServer    bllServer    = new BllServer();
            BllEmployee  bllEmployee  = new BllEmployee();
            BllEmpPowers bllEmpPowers = new BllEmpPowers();

            try
            {
                if (bllServer.TestConnection())
                {
                    using (DataTable dtUser = bllEmployee.GetEmployeeInfo(cmbEmpID.Text, 0))
                    {
                        if (dtUser == null)
                        {
                            MessageBox.Show(@"工号输入错误或不存在该人员工号!");
                            cmbEmpID.Text    = string.Empty;
                            txtPassword.Text = string.Empty;
                            cmbEmpID.Focus();
                            return;
                        }
                        if (dtUser.Rows.Count == 0)
                        {
                            MessageBox.Show(@"没有创建该工号!");
                            cmbEmpID.Text    = string.Empty;
                            txtPassword.Text = string.Empty;
                            cmbEmpID.Focus();
                            return;
                        }
                        if (!dtUser.Rows[0]["Password"].ToString().Equals(txtPassword.Text))
                        {
                            MessageBox.Show(@"密码错误,请重新输入!");
                            txtPassword.Text = string.Empty;
                            txtPassword.Focus();
                            return;
                        }
                        if (chkRemember.Checked)
                        {
                            //记住用户名
                            string        strLoginName = cmbEmpID.Text;
                            List <string> lstLoginName = new List <string>
                            {
                                strLoginName
                            };
                            string[] registry = ResistryKey.GetRegistry(RegisterValueName);
                            if (null != registry)
                            {
                                foreach (string name in registry.TakeWhile(name => lstLoginName.Count < MaxLoginNameSaveCount).Where(name => 0 != StringComparer.CurrentCulture.Compare(strLoginName.ToUpper(), name.ToUpper())))
                                {
                                    lstLoginName.Add(name);
                                }
                            }
                            ResistryKey.SetRegistry(RegisterValueName, lstLoginName.ToArray());
                        }
                        //保存用户信息
                        Employee employee = new Employee();
                        employee.EmployeeNo    = dtUser.Rows[0]["EmployeeNo"].ToString();
                        employee.EmployeeName  = dtUser.Rows[0]["EmployeeName"].ToString();
                        employee.Age           = Convert.ToInt32(dtUser.Rows[0]["Age"]);
                        employee.Gender        = dtUser.Rows[0]["Gender"].ToString();
                        employee.MoblePhone    = dtUser.Rows[0]["MoblePhone"].ToString();
                        employee.PassWord      = dtUser.Rows[0]["PassWord"].ToString();
                        CurrentInfo.currentEmp = employee;
                        dtUser.Dispose();

                        //用户权限
                        Dictionary <int, string> empPowersLst = new Dictionary <int, string>();
                        DataTable dtPower = bllEmpPowers.GetEmpPowers(cmbEmpID.Text);
                        for (int i = 0; i < dtPower.Rows.Count; i++)
                        {
                            if (!empPowersLst.ContainsKey(Convert.ToInt32(dtPower.Rows[i]["PowerNo"])))
                            {
                                empPowersLst.Add(Convert.ToInt32(dtPower.Rows[i]["PowerNo"]), dtPower.Rows[i]["EmployeeNo"].ToString());
                            }
                        }
                        CurrentInfo.currentPowers = empPowersLst;
                        dtPower.Dispose();
                        //List<EmpPowers> empPowersLst = new List<EmpPowers>();
                        //DataTable dtPower = bllEmpPowers.GetEmpPowers(cmbEmpID.Text);
                        //for (int i = 0; i < dtPower.Rows.Count; i++)
                        //{
                        //    EmpPowers empPowers = new EmpPowers();
                        //    empPowers.EmployeeNo = dtPower.Rows[0]["EmployeeNo"].ToString();
                        //    empPowers.PowerNo = dtPower.Rows[0]["PowerNo"].ToString();
                        //    empPowersLst.Add(empPowers);
                        //}


                        FrmMain frmMain = new FrmMain();
                        this.Hide();
                        frmMain.ShowDialog();
                    }
                }
                else
                {
                    MessageBox.Show(@"网络连接失败,检查网络后重试!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Application.Exit();
                Application.ExitThread();
            }
        }