protected void ibtnLogin_Click(object sender, ImageClickEventArgs e) { //if (string.IsNullOrEmpty(this.txtUserName.Text.Trim()) || string.IsNullOrEmpty(this.txtPassword.Text.Trim())) //{ // this.lblError.Text = "请输入账号和密码!"; // return; //} var bll = new AccountBLL(); var user = bll.Login(txtUserName.Text.Trim(), txtPassword.Text.Trim()); if (user == null) { this.lblError.Text = "账号不存在或密码错误!"; return; } if (user.IsLockedOut) { this.lblError.Text = "您的账号已被锁定!请联系系统管理员!"; return; } PageUtility.Login(user); Response.Redirect("~/Background/Framework.aspx"); }
public ActionResult ChangePassword(ChangePasswordModel model) { string currentPerson = GetCurrentPerson(); ViewBag.PersonNamea = currentPerson; if (string.IsNullOrWhiteSpace(currentPerson)) { ModelState.AddModelError("", "对不起,请重新登陆"); return(View()); } if (ModelState.IsValid) { IAccountBLL accountBLL = new AccountBLL(); if (null != (accountBLL.ValidateUser(currentPerson, EncryptAndDecrypte.EncryptString(model.OldPassword)))) { if (accountBLL.ChangePassword(currentPerson, model.OldPassword, model.NewPassword)) { ModelState.AddModelError("", "修改密码成功"); return(View()); } } } ModelState.AddModelError("", "修改密码不成功,请核实数据"); return(View()); }
public ActionResult Index(LogOnModel model) { #region 验证码验证 if (Session["__VCode"] == null || (Session["__VCode"] != null && model.ValidateCode != Session["__VCode"].ToString())) { ModelState.AddModelError("PersonName", "验证码错误!"); //return ""; return(View()); } #endregion if (ModelState.IsValid) { SysPerson person = AccountBLL.ValidateUser(model.PersonName, model.Password); if (person != null) {//登录成功 Account account = new Account(); account.Name = person.MyName; account.PersonName = model.PersonName; account.Id = person.Id.ToString(); Session["account"] = account; return(RedirectToAction("Index", "Home")); } } ModelState.AddModelError("PersonName", "用户名或者密码出错。"); return(View()); }
private void BtnSave_Click(object sender, EventArgs e) { if (function == "add") { if (cbbTypeAccount.Text != "" && txtUsername.Text != "" && txtPassWord.Text != "") { AccountDTO accountDTO = new AccountDTO(txtUsername.Text, txtPassWord.Text, cbbTypeAccount.Text); //string password = txtPassWord.Text; //accountDTO.TypeAccount = cbbTypeAccount.Text; AccountBLL accountBLL = new AccountBLL(); accountBLL.AddAccount(accountDTO); } } else if (function == "update") { if (txtUsername.Text != "" && txtPassWord.Text != "") { if (accountBLL.UpdatePass(txtUsername.Text, txtPassWord.Text) == 1) { MessageBox.Show("update thành công"); } } } txtUsername.ReadOnly = false; FillAccountDataGridview(); pnlAadd.Visible = false; pnlBtnFuntion.Visible = true; }
public ActionResult AccountOverview() { var AccountBLL = new AccountBLL(); List <Account> allAccounts = AccountBLL.showAccounts(); return(View(allAccounts)); }
private void btn_capnhat_Click(object sender, EventArgs e) { string mk_cu = txtMatkhaucu.Text; string mk_moi = txtMatkhaumoi.Text; string nl_mk = txtNhaplaimatkhau.Text; string tendn = Properties.Settings.Default.username; AccountBLL acc = new AccountBLL(); string kiemtra_mk = acc.Account(tendn, mk_cu); if (kiemtra_mk == null) { lbTB.Text = "Mật khẩu cũ không chính xác!"; return; } if (mk_moi != nl_mk) { lbTB.Text = "Mật khẩu mới phải trùng nhau!"; return; } int ketqua = acc.DoiMatKhau(tendn, mk_moi); if (ketqua > 0) { lbTB.Text = "Đổi mật khẩu thành công!"; } else { lbTB.Text = "Đổi mật khẩu thất bại!"; } txtMatkhaucu.Text = ""; txtMatkhaumoi.Text = ""; txtNhaplaimatkhau.Text = ""; }
public ActionResult Login(string email = "", string password = "") { if (Request.HttpMethod == "GET") { return(View()); } else { var newUser = AccountBLL.Account_Login(email, password); if (newUser != null) { Account account = AccountBLL.Account_Login(email, password); FormsAuthentication.SetAuthCookie(account.AccountID.ToString(), false); HttpCookie userInfo = new HttpCookie("userInfo"); userInfo["AccountID"] = account.AccountID.ToString(); userInfo["FullName"] = Server.UrlEncode(account.LastName + " " + account.FirstName); userInfo["Email"] = account.Email; userInfo["PhotoPath"] = account.PhotoPath; userInfo.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(userInfo); return(RedirectToAction("Index", "Dashboard")); } else { ModelState.AddModelError("error", "Đăng nhập thất bại"); ViewBag.email = email; return(View()); } } }
public ActionResult Login(LoginViewModel model, string returnUrl) { if (ModelState.IsValid) { int userId = AccountBLL.ValidateAccount(model.Email, model.Password); if (userId > 0) { //验证成功,用户名密码正确,构造用户数据 var userData = new HttpUserDataPrincipal { UserId = userId, UserName = model.Email }; //保存Cookie HttpFormsAuthentication <HttpUserDataPrincipal> .SetAuthCookie(model.Email, userData, model.RememberMe); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return(Redirect(returnUrl)); } else { return(RedirectToAction("Index", "Home")); } } else { ModelState.AddModelError("", "提供的用户名或密码不正确。"); } } return(View(model)); }
public async Task <ActionResult <AccountVM> > Create([FromBody] AccountVM accountVM) { // Validation if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // Mapping Account account = this.mapper.Map <AccountVM, Account>(accountVM); // BLL User currentUser = await userManager.GetUserAsync(User); AccountBLL bll = new AccountBLL(this.unitOfWork, currentUser); // Create Account newAccount; try { newAccount = await bll.CreateAccount(account); } catch (CrmException ex) { return(BadRequest(this.mapper.Map <CrmException, CrmExceptionVM>(ex))); } // Mapping return(CreatedAtAction("GetById", new { id = newAccount.Id }, this.mapper.Map <Account, AccountVM>(newAccount))); }
public async Task <ActionResult <AccountVM> > Update(Guid id, [FromBody] AccountVM accountVM) { // Validation if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != accountVM.Id) { return(BadRequest()); } if (!this.unitOfWork.context.Accounts.Any(a => a.Id == id)) { return(NotFound()); } // Mapping Account account = this.mapper.Map <AccountVM, Account>(accountVM); // BLL User currentUser = await userManager.GetUserAsync(User); AccountBLL bll = new AccountBLL(this.unitOfWork, currentUser); // Update Account updatedAccount = await bll.UpdateAccount(account); // Mapping return(Ok(this.mapper.Map <Account, AccountVM>(updatedAccount))); }
public void start() { var accounts = AccountBLL.GetAllAccount(); AccountBLL.UpdateUseState(); var iHour = DateTime.Now.Hour; foreach (DataRow dr in accounts.Rows) { // Task.Factory.StartNew(() => // { int contentNum = 0; if (AutoWeb.isSend(dr, ref contentNum, iHour)) { string useid = dr["id"].ToString(); string webGroupId = dr["id1"].ToString(); int context = int.Parse(dr["groupCount"].ToString()); var task = AutoWeb.GetWebSiteAwaitTask(webGroupId); task.Wait(); if (task != null && task.Result != null && task.Result.Rows.Count > 0) { var hostDataTable = task.Result; AutoWeb.AutoWebSit(contentNum, useid, hostDataTable, iHour, webGroupId, context); } } // }); } //aTimer.Elapsed += new ElapsedEventHandler(TimedEvent); //aTimer.Interval = 1000; //配置文件中配置的秒数 //aTimer.Enabled = true; }
public ActionResult Index() { WebUserData userData = User.GetUserData(); Employee data = AccountBLL.GetProfile(userData.UserID); return(View(data)); }
public ActionResult ResetPassword(string email = "", string newPassword = "", string confirmPassword = "") { if (newPassword != confirmPassword) { ModelState.AddModelError("newPass", "Mật khẩu mới và nhập lại mật khẩu không khớp"); } if (!ModelState.IsValid) { ViewBag.email = email; ViewBag.newPass = newPassword; ViewBag.confirmPass = confirmPassword; return(View()); } var reset = AccountBLL.Change_Pass(email, EncodeMD5.GetMD5(newPassword)); if (reset) { return(RedirectToAction("Login")); } else { ViewBag.email = email; ViewBag.newPass = newPassword; ViewBag.confirmPass = confirmPassword; return(View()); } }
public JsonResult SaveCreate() { Stream req = Request.InputStream; req.Seek(0, System.IO.SeekOrigin.Begin); string json = new StreamReader(req).ReadToEnd(); try { // assuming JSON.net/Newtonsoft library from http://json.codeplex.com/ var info = JsonConvert.DeserializeObject <AdvanceOrders>(json); info.Time = DateTime.Now; info.Shippingstatus = "未发货"; //发货状态 if (info.Advance != null) //付款状态 { info.Paymentstatus = "已付预付款"; } else { info.Paymentstatus = "未付款"; } AccountBLL ab = new AccountBLL(); advanceorder.Create(info); return(Json(true)); } catch (Exception ex) { return(Json(false)); } }
private SaveResult SaveEdit(Account oAccount) { AccountBLL ab = new AccountBLL(); oAccount.ModifyBy = UserId; return(ab.Update(oAccount, UserId, UserName)); }
public ActionResult Register(RegisterViewModel model) { if (ModelState.IsValid) { int userId = AccountBLL.Add(model.Email, model.Password); if (userId > 0) { //注册成功,用户名密码正确,构造用户数据 var userData = new HttpUserDataPrincipal { UserId = userId, UserName = model.Email }; //保存Cookie HttpFormsAuthentication <HttpUserDataPrincipal> .SetAuthCookie(model.Email, userData, false); return(RedirectToAction("Index", "Home")); } else { ModelState.AddModelError("", "用户名已存在。"); } } return(View(model)); }
public ActionResult Edit(int AccountId) { AccountBLL ab = new AccountBLL(); List <AccountRole> list = BoDB.AccountRoleDb.GetList(); List <SelectListItem> oList = new List <SelectListItem>(); if (list != null) { foreach (var item in list) { oList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString() }); } } ViewBag.RoleList = oList; AccountViewModel account = new AccountViewModel(); account.Id = -1; if (AccountId > 0) { account = ab.GetViewAccountById(AccountId); } return(PartialView(account)); }
/// <summary> /// 登录,返回用户对象 /// </summary> /// <param name="accountName">用户名</param> /// <param name="passWord">密码</param> /// <returns></returns> public ResultModel Login(string accountName, string passWord) { try { AccountBLL bll = new AccountBLL(); ResultModel result = bll.CheckLogin(accountName, passWord); if (result.ResultStatus == 0 && result.ReturnValue != null) { int i; if (int.TryParse(result.ReturnValue.ToString(), out i) && i == 1) { //生成唯一token,写Cache string token = CreateToken(); CacheManager.CacheInsert(token, accountName); result.ReturnValue = token; //result.ReturnValue = User.UserProvider.GetUserModel(token, accountName); } } return result; } catch (Exception ex) { this.log.ErrorFormat(ex.Message); return null; } }
/// <summary> /// 登录,返回用户对象 /// </summary> /// <param name="accountName">用户名</param> /// <param name="passWord">密码</param> /// <returns></returns> public ResultModel Login(string accountName, string passWord) { try { AccountBLL bll = new AccountBLL(); ResultModel result = bll.CheckLogin(accountName, passWord); if (result.ResultStatus == 0 && result.ReturnValue != null) { int i; if (int.TryParse(result.ReturnValue.ToString(), out i) && i == 1) { //生成唯一token,写Cache string token = CreateToken(); CacheManager.CacheInsert(token, accountName); result.ReturnValue = token; //result.ReturnValue = User.UserProvider.GetUserModel(token, accountName); } } return(result); } catch (Exception ex) { this.log.ErrorFormat(ex.Message); return(null); } }
private void btnOK_Click(object sender, EventArgs e) { string messaggio = string.Empty; bool esito = true; if (string.IsNullOrEmpty(txtUser.Text)) { esito = false; messaggio = "- Specificare l'utente"; } if (string.IsNullOrEmpty(txtPassword.Text)) { esito = false; messaggio += Environment.NewLine + "- Inserire la password"; } if (!esito) { lblErrore.Text = messaggio; return; } AccountBLL bll = new AccountBLL(); if (bll.VerificaPassword(txtUser.Text.Trim().ToUpper(), txtPassword.Text.Trim().ToUpper(), out _user)) { DialogResult = DialogResult.OK; return; } lblErrore.Text = "Password errata"; }
private void btnRegister_Click(object sender, EventArgs e) { string user = txtUser.Text; string pass = txtPass.Text; string email = txtEmail.Text; string address = txtAddress.Text; string phone = txtPhone.Text; if (user.Trim() != "" && pass.Trim() != "" && email.Trim() != "" && address.Trim() != "" && phone.Trim() != "") { if (checkValidData(email, phone)) { AccountBLL bll = new AccountBLL(); string secretkey = bll.InsertAccount(user, email, pass, address, phone); if (!secretkey.Equals(""))// got SecretKey from AccountBLL { MessageBox.Show("Wellcome to join with us"); MessageBox.Show("Please prepare a note to save the Secretkey . We only provide it one time"); lblSecretKey.Text = "Your SecretKey :"; txtSecretKey.Text = secretkey; txtSecretKey.Show(); } else { MessageBox.Show("Duplicated Email"); } } } else { MessageBox.Show("Pls provide us your basic infomation!"); } }
public override string[] GetRolesForUser(string username) { AccountBLL bll = new AccountBLL(); string[] roles = { bll.GetRole(username) }; return(roles); }
private HttpResponseMessage handleJwtAuth(string jwt, string deviceID) { var response = Request.CreateResponse(HttpStatusCode.Unauthorized); string retrievedNRIC; JWTBLL jwtBll = new JWTBLL(); // Ensure jwt, deviceID exists if (!(!string.IsNullOrEmpty(jwt) && AccountBLL.IsDeviceIDValid(deviceID))) { return(response); } // Validate jwt if (!jwtBll.ValidateJWT(jwt)) { return(response); } else { retrievedNRIC = jwtBll.getNRIC(jwt); } // Authorize if the account is valid if (accountBLL.IsValid(retrievedNRIC, deviceID)) { string newJwt = jwtBll.UpdateJWT(jwt); response = Request.CreateResponse(HttpStatusCode.OK); response.Headers.Add("Authorization", "Bearer " + newJwt); return(response); } return(response); }
public ForgotAccountForm() { InitializeComponent(); m_objAccountBLL = new AccountBLL(); m_objAccountForgetModel = new AccountForgetModel(); accountForgetModelBindingSource.DataSource = m_objAccountForgetModel; }
private HttpResponseMessage handleBasicAuth(string nric, string password, string deviceID) { var response = Request.CreateResponse(HttpStatusCode.Unauthorized); JWTBLL jwtBll = new JWTBLL(); // Ensure nric, password, deviceID exists if (!(AccountBLL.IsNRICValid(nric) && AccountBLL.IsPasswordValid(password) && AccountBLL.IsDeviceIDValid(deviceID))) { return(response); } // Authorize if the account is valid Account account = accountBLL.GetStatus(nric, password, deviceID); if (account.status == 1) { string role = account.patientStatus.ToString() + account.therapistStatus.ToString(); string newJwt = accountBLL.LoginDevice(nric, role); response = Request.CreateResponse(HttpStatusCode.OK); response.Headers.Add("Authorization", "Bearer " + newJwt); return(response); } return(response); }
private void Window_Loaded(object sender, RoutedEventArgs e) { IdNameBLL idnamebll = new IdNameBLL(); Account account = new Account(); //获得用户的Id account.OperatorId = LoginWindow.GetOperatorId(); // MessageBox.Show("执行了!"); //添加 if (IsAddNew) { //设置默认值 account.Date = DateTime.Now; account.Money = 0; account.Remarks = "无"; gridEditAccount.DataContext = account; cbType.ItemsSource = idnamebll.GetByCategory("收支类型"); //cbType.SelectedIndex = 0; } //编辑 else { //拿出要编辑的对象的值 account = new AccountBLL().GetById(EditingId); gridEditAccount.DataContext = account; cbType.ItemsSource = idnamebll.GetByCategory("收支类型"); } }
public ActionResult Index(LogOnModel model) { #region 验证码验证 if (Session["__VCode"] == null || (Session["__VCode"] != null && model.ValidateCode != Session["__VCode"].ToString())) { ModelState.AddModelError("PersonName", "验证码错误!"); //return ""; return(View()); } #endregion if (ModelState.IsValid) { string accountId = AccountBLL.ValidateUser(model.PersonName, model.Password); if (!string.IsNullOrWhiteSpace(accountId)) {//登录成功 Account account = new Account(); account.PersonName = model.PersonName; account.Id = accountId; Session["account"] = account; LoginUserManage.Add(Session.SessionID, account.PersonName); return(RedirectToAction("Index", "Home")); } } ModelState.AddModelError("PersonName", "用户名或者密码出错。"); return(View()); }
public HoldingTransferedForm(GridConfig gridConfig, UFXBLLManager bLLManager) : this() { _gridConfig = gridConfig; _accountBLL = bLLManager.AccountBLL; this.LoadControl += new FormLoadHandler(Form_LoadControl); this.LoadData += new FormLoadHandler(Form_LoadData); this.srcGridView.UpdateRelatedDataGridHandler += new UpdateRelatedDataGrid(GridView_Source_UpdateRelatedDataGridHandler); this.srcGridView.MouseDown += new MouseEventHandler(GridView_MouseDown); this.destGridView.MouseDown += new MouseEventHandler(GridView_MouseDown); this.cbOpertionType.SelectedIndexChanged += new EventHandler(ComboBox_OpertionType_SelectedIndexChanged); this.cbSrcFundCode.SelectedIndexChanged += new EventHandler(ComboBox_FundCode_SelectedIndexChanged); this.cbDestFundCode.SelectedIndexChanged += new EventHandler(ComboBox_FundCode_SelectedIndexChanged); this.cbSrcPortfolio.SelectedIndexChanged += new EventHandler(ComboBox_Portfolio_SelectedIndexChanged); this.cbDestPortfolio.SelectedIndexChanged += new EventHandler(ComboBox_Portfolio_SelectedIndexChanged); this.cbSrcTradeInst.SelectedIndexChanged += new EventHandler(ComboBox_TradeInst_SelectedIndexChanged); this.cbDestTradeInst.SelectedIndexChanged += new EventHandler(ComboBox_TradeInst_SelectedIndexChanged); //this.cbSrcTradeInst.DropDownClosed += new EventHandler(ComboBox_TradeInst_DropDownClosed); //this.cbDestTradeInst.DropDownClosed += new EventHandler(ComboBox_TradeInst_DropDownClosed); //this.cbSrcTradeInst.LostFocus += new EventHandler(ComboBox_TradeInst_LostFocus); //this.cbDestTradeInst.LostFocus += new EventHandler(ComboBox_TradeInst_LostFocus); //button click this.btnTransfer.Click += new EventHandler(Button_Transfer_Click); this.btnRefresh.Click += new EventHandler(Button_Refresh_Click); this.btnCalc.Click += new EventHandler(Button_Calc_Click); }
public FormEmployee() { InitializeComponent(); control = new AccountBLL(); listAccount = new List <AccountDTO>(); SelectedAccount = new AccountDTO(); }
public void TestCreate() { TradeOrderBLL bll = new TradeOrderBLL(_unit); List <Account> aList = new AccountBLL(_unit).GetAccountListByUser("2b658482-6a38-4ed3-b356-77fe9b1569f1", null); TradeOrder a = new TradeOrder { UpdatedBy = "2b658482-6a38-4ed3-b356-77fe9b1569f1", UpdateDate = DateTime.Now, Direction = OrderDirection.Long.ToString(), LatestPrice = 5.48, LatestTradingDate = 20160802, Status = OrderStatus.Open.ToString(), ShareId = 1585, Size = 1000, OrderPrice = 5.65, OrderType = OrderType.Stop.ToString(), Note = "test order", Stop = 5.50, Limit = 5.90, AccountId = aList[0].Id }; bll.Create(a); }
public string createIDTest([PexAssumeUnderTest] AccountBLL target) { string result = target.createID(); return(result); // TODO: add assertions to method AccountBLLTest.createIDTest(AccountBLL) }