Ejemplo n.º 1
0
        public MessageHandler(TelegramBotClient client, MainProvider provider, CommandProvider commandProvider, AdminHandler adminHandler)
        {
            this.client          = client;
            this.provider        = provider;
            this.commandProvider = commandProvider;

            this.adminHandler = adminHandler;

            authSystem   = new AuthenticateSystem(client, provider);
            chatCommands = new ChatCommands(client, provider);
            addCash      = new AddCash(client, provider);
        }
Ejemplo n.º 2
0
        public ActionResult Index(LogOnViewModel model)
        {
            if (ModelState.IsValid)
            {
                //校验验证码
                string strIndentifyCode = string.Empty;
                if (Session["IndentifyCode"] != null)
                {
                    strIndentifyCode = Session["IndentifyCode"].ToString();
                }
                if (model.IndentifyCode.ToLower() == strIndentifyCode)
                {
                    //检查是否已用其它用户登录
                    for (int i = 0; i < Session.Keys.Count; i++)
                    {
                        if (Session.Keys[i] == "LoginAccountId")
                        {
                            return(Json(InnoSoft.LS.Resources.Strings.SystemIsInUse));
                        }
                    }

                    //校验帐户名与密码
                    string             strErrText;
                    AuthenticateSystem auth = new AuthenticateSystem();
                    Account            data = auth.StaffLogin(model.LoginAccount, model.Password, out strErrText);
                    if (data != null)
                    {
                        FormsService.SignIn(model.LoginAccount, false);

                        LoginAccountId   = data.Id;
                        LoginStaffName   = data.Name;
                        LoginAccountType = data.AccountType;
                        LoginOrganId     = data.OrganId;
                        LoginOrganName   = data.OrganFullName;
                        LoginStaffId     = data.StaffId;
                        LoginStaffName   = data.StaffName;

                        return(Json(string.Empty));
                    }
                    else
                    {
                        return(Json(strErrText));
                    }
                }
                else
                {
                    return(Json(InnoSoft.LS.Resources.Strings.WrongIndentifyCode));
                }
            }
            return(View(model));
        }
Ejemplo n.º 3
0
        public JsonResult LoadStaffAccounts()
        {
            string             strErrText;
            AuthenticateSystem auth        = new AuthenticateSystem();
            List <Account>     listAccount = auth.LoadStaffAccounts(LoginAccountId, LoginStaffName, out strErrText);

            if (listAccount == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from a in listAccount
                      select new
            {
                a.Id,
                a.StaffName
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }