Ejemplo n.º 1
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            string username = txtUserName.Text;
            string pwd = pwdPassword.Password;

            Operator op = new OperatorDAL().GetByUserName(username);
            if (op == null)
            {
                MessageBox.Show("用户名或者密码错误!");
            }
            else
            {
                string dbMd5 = op.Password; //数据库中存储的密码值
                string mymd5 = CommonHelper.GetMD5(pwd +CommonHelper.GetPasswordSalt());
                if (dbMd5 == mymd5)
                {
                    new T_OperationLogDAL().Insert(op.Id, "登录成功");
                    //MessageBox.Show("登录成功");

                    //把登录操作者的Id保存到全局的“Session”
                    //存到Application.Current.Properties里面的在程序其他地方也可以取
                    Application.Current.Properties["OperatorId"] = op.Id;
                    DialogResult = true;
                }
                else
                {
                    new T_OperationLogDAL().Insert(op.Id, "尝试登录失败");
                    MessageBox.Show("用户名或者密码错误!");
                }
            }
        }
Ejemplo n.º 2
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            Operator op = (Operator)gridOperators.SelectedItem;
            if (op == null)
            {
                MessageBox.Show("没有选中任何行!");
                return;
            }
            if (MessageBox.Show("真的要删除" + op.UserName + "吗?", "提醒",
                MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                OperatorDAL dal = new OperatorDAL();
                dal.DeleteById(op.Id);//软删除

                Guid operatorId = CommonHelper.GetOperatorId();
                new T_OperationLogDAL().Insert(operatorId, "删除管理员" + op.UserName);
                LoadData();
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            OperatorDAL dal = new OperatorDAL();
            Operator[] operators = dal.ListAll();

            ReportOperator[] rptOperators =
                new ReportOperator[operators.Length];
            for (int i = 0; i < rptOperators.Length; i++)
            {
                ReportOperator rptOp = new ReportOperator();
                rptOp.RealName = operators[i].RealName;
                rptOp.UserName = operators[i].UserName;
                rptOperators[i] = rptOp;
            }

            TestCrystalReport1 rpt = new TestCrystalReport1();
            rpt.SetDataSource(rptOperators);
            rpt.SetParameterValue("部门名称","产品开发部");

            crystalReportsViewer1.ViewerCore.ReportSource = rpt;
            //设计rpt报表,从BLL层取数据,扔给rpt实例,然后通过crystalReportsViewer展示
        }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (IsInsert)
     {
     }
     else
     {
         OperatorDAL dal = new OperatorDAL();
         Operator op = dal.GetById(EditingId);
         txtUserName.Text = op.UserName;
         txtRealName.Text = op.RealName;
     }
 }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     Operator[] operators = new OperatorDAL().ListAll();
     cmbOperator.ItemsSource = operators;
     colOperator.ItemsSource = operators;
 }
Ejemplo n.º 6
0
 private void LoadData()
 {
     OperatorDAL dal = new OperatorDAL();
     gridOperators.ItemsSource = dal.ListAll();
 }