Пример #1
0
        private void btn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var txt = (sender as Button).Name;
                switch (txt)
                {
                case "okLogin":
                    var bSuc = AccountCtlMain.Verification(xLoginNo, txtBoxLoginPwd1.Password);
                    if (!bSuc)
                    {
                        MessageBox.Show("密码错误");
                        return;
                    }
                    MainWindow mainWindow = new MainWindow();
                    App.Current.MainWindow = mainWindow;
                    this.Close();
                    //显示主窗体
                    mainWindow.Show();
                    break;

                case "closeLogin":
                case "cancelLogin":
                    Close();
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            try
            {
                var defaultConnectionString = ConfigHelper.XmlReadConnectionString("Finance.exe.config", "default");
                DBHelper.DefaultInstance = new DBHelper(defaultConnectionString);
                Console.Write("login as : ");
                string userName = Console.ReadLine();
LOGIN_FLAG:
                Console.Write("password : "******"Incorrect user name or password.");
                    goto LOGIN_FLAG;
                }
                Console.WriteLine("Welcome to use finance.");

                while (true)
                {
                    Console.Write("$ ");
                    string commond = Console.ReadLine();
                    if (!string.IsNullOrEmpty(commond))
                    {
                        int returnCode = CommondHandler.Process(commond);
                        switch (returnCode)
                        {
                        case -1:
                            Console.WriteLine("Commond handler return code:" + returnCode + ", exit this process.");
                            return;

                        case 1:
                            Console.Clear();
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Пример #3
0
        static int usrPwd(string[] args)
        {
            if (ContainsOpt(args, "-f"))
            {
                var userName = GetParm(args, 1);
                var pwd1     = GetParm(args, 2);
                var pwd2     = GetParm(args, 3);
                if (pwd1 != pwd2)
                {
                    logger().Error("Two times input password mismatch.");
                    return(0);
                }
                AccountCtlMain.ChagePwd(userName, pwd1);
            }
            else
            {
                var userName = GetParm(args, 1);
                Console.Write("Please input user's old password : "******"Please input user's new password : "******"Confirm new password : "******"Two times input password mismatch.");
                        return(0);
                    }
                    AccountCtlMain.ChagePwd(userName, pwd1);
                }
                else
                {
                    Console.WriteLine("Incorrect user name or password.");
                }
            }

            return(0);
        }
Пример #4
0
        static int Exec(string cmd, string[] args)
        {
            switch (cmd)
            {
            case "init":
                logger.Warn("This is a dangerous command. Are you sure you want to execute it?(yes/no)");
                var sure = Console.ReadLine();
                if (sure == "yes")
                {
                    AccountCtlMain.Init();
                }
                break;

            case "act.print":
                AccountCtlMain.AccoutPrint();
                break;

            case "act.create":
                AccountCtlMain.CreateAccount(GetParm(args, 1), GetParm(args, 2));
                break;

            case "act.load":
                AccountCtlMain.LoadAccount(GetParm(args, 1), GetParm(args, 2));
                break;

            case "act.unload":
                var parm1 = GetParm(args, 1);
                logger.Warn("This is a dangerous command. Are you sure you want to execute it?(yes/no)");
                var yes = Console.ReadLine();
                if (yes == "yes")
                {
                    AccountCtlMain.UnloadAccount(parm1);
                }
                break;

            case "act.init":
                var parm2 = GetParm(args, 1);
                logger.Warn("This is a dangerous command. Are you sure you want to execute it?(yes/no)");
                var yes1 = Console.ReadLine();
                if (yes1 == "yes")
                {
                    if (args.Count() > 2)
                    {
                        AccountCtlMain.InitAccount(parm2, GetParm(args, 2));
                    }
                    else
                    {
                        AccountCtlMain.InitAccount(parm2);
                    }
                }
                break;

            case "usr.pwd":
                var userName = GetParm(args, 1);
                Console.Write("Please input user's old password : "******"Please input user's new password : "******"Confirm new password : "******"Two times input password mismatch.");
                        return(0);
                    }
                    AccountCtlMain.ChagePwd(userName, pwd1);
                }
                else
                {
                    Console.WriteLine("Incorrect user name or password.");
                }
                break;

            case "usr.add":
                var no   = GetParm(args, 1);
                var name = GetParm(args, 2);
                Console.Write("Please input user's password : "******"Confirm password : "******"Two times input password mismatch.");
                    return(0);
                }
                AccountCtlMain.AddUser(no, name, apwd1);
                break;

            case "usr.delete":
                var duserName = GetParm(args, 1);
                Console.Write("Please input user's password : "******"Incorrect user name or password.");
                }
                break;

            case "usr.print":
                AccountCtlMain.UserPrint();
                break;

            default:
                logger.Debug(string.Format("Don't has this command [{0}].", cmd));
                throw new FinanceException(FinanceResult.IMPERFECT_DATA);
            }
            logger.Info("execute success.");
            return(0);
        }