public static Boolean InsertUsers(Users users) { var g = Guid.NewGuid(); users.UserCode = g.ToString(); return(UserDA.InsertUsers(users)); }
public int SavePassword(UserEntity user, string loginName) { UserDA da = new UserDA(); var result = da.SavePassword(user, loginName); return(result); }
protected void Page_Load(object sender, EventArgs e) { //retrieve cart object from session state on every post back cart = CartItemList.GetCart(); //on initial page load, add cart items to list control if (!IsPostBack) { this.DisplayCart(); } // if user is signed in, populate address on file in check out page for easier check out -lg if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); UserManager <IdentityUser> userManager = new UserManager <IdentityUser>(new UserStore <IdentityUser>()); string firstName = UserDA.getFirstname(userId); string lastName = UserDA.getLastname(userId); string fullname = firstName + " " + lastName; txtShipTo.Text = fullname; string address = UserDA.getAddress(userId); txtShipAddr1.Text = address; string city = UserDA.getCity(userId); txtShipCity.Text = city; string state = UserDA.getState(userId); txtShipState.Text = state; string zip = UserDA.getZip(userId); txtShipZip.Text = zip; } }
/// <summary> /// 插入数据 /// </summary> /// <param name="user">数据实体</param> public void Insert(UserEntity user, AuthUserModel authUserModel) { if (authUserModel == null) { throw new BusinessException("未获取到当前登录用户信息"); } this.CheckUserEntity(user); var hasExitsLoginName = UserDA.CheckUserLoginNameExist(user.LoginName, 0); if (hasExitsLoginName) { throw new BusinessException(string.Format("{0}用户名已存在", user.LoginName)); } using (ITransaction transaction = TransactionManager.Create()) { this.BindBasisInfo(user, authUserModel); int userId = UserDA.Insert(user); // 写入角色关联 if (user.RoleId.HasValue) { RoleUserService.Insert(new AuthCenter.Entity.Entity.RoleUserEntity() { RoleId = user.RoleId.Value, UserId = userId, Creator = authUserModel.UserSysNo }); } transaction.Complete(); } }
public int AddUser(UserEntity user, string loginName) { UserDA da = new UserDA(); var result = da.AddUser(user, loginName); return(result); }
public ActionResult SelectModule() { if (SessionHelper.SYS_USER_ID.IsNullOrEmpty()) { return(RedirectToAction("SignIn")); } if (SessionHelper.SYS_USG_LEVEL != "A" && SessionHelper.SYS_USG_LEVEL != "S") { string name = "1 Manage Issue"; return(RedirectToAction("SelectedModule", new { NAME = name })); } var da = new UserDA(); da.DTO.Execute.ExecuteType = UserExecuteType.GetConfigGeraral; da.DTO.Model.COM_CODE = SessionHelper.SYS_COM_CODE; da.DTO.Model.USG_LEVEL = SessionHelper.SYS_USG_LEVEL; //da.DTO.Model.SYS_GROUP_NAME = SessionHelper.SYS_SYS_GROUP_NAME; //da.DTO.Model.SYS_GROUP_NAME = "SEC01"; da.Select(da.DTO); SessionHelper.SYS_IsMultipleGroup = (da.DTO.ConfigGerarals.Count > 1); return(View(da.DTO.ConfigGerarals)); }
private void buttonResetPassword_Click(object sender, EventArgs e) { if (textBoxUserName.Text == "") { MessageBox.Show("You must fill out all of the boxes, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { Users user = UserDA.Search(textBoxUserName.Text); string textUser = textBoxUserName.Text; if (user == null) { MessageBox.Show("Wrong Information, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxUserName.Clear(); textBoxPassword.Clear(); textBoxUserName.Focus(); } else { user.Password = textBoxPassword.Text; UserDA.Update(user); MessageBox.Show("User Password has been updated successfully", "Confirmation"); } this.Hide(); Login form = new Login(); form.Show(); } }
public ResultLogin Login(Model.DB.User model) { ApiResultEnum result = UserDA.Login(ref model, platform); if (result == ApiResultEnum.Success) { string user_token = UserRA.Get(model.id.ToString(), "platform_" + platform); if (string.IsNullOrWhiteSpace(user_token)) { user_token = FuncHelper.GetUniqueString(); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("platform_" + platform, user_token); dic.Add("name", model.name); dic.Add("status_order", model.status_order.ToString()); dic.Add("role", model.role.ToString()); dic.Add("login_time_" + platform, DateTime.Now.Format()); UserRA.Set(model.id.ToString(), dic); UserRA.SetExpire(model.id.ToString()); } return(new ResultLogin(result, model, model.id + "-" + user_token)); } else { return(new ResultLogin(result, null, null)); } }
public void UpdateDelete_() { int userID; // create var userDA = new UserDA(_options); userID = userDA.CreateUser("login", "hash", "role").UserID; var user = userDA.GetUsers().FirstOrDefault(r => r.UserID == userID); user.Login = "******"; user.PasswordHash = "hash1"; user.Role = "role1"; userDA.UpdateUser(user); var user1 = userDA.GetUsers().FirstOrDefault(r => r.UserID == userID); Assert.Equal(userID, user1.UserID); Assert.Equal("login1", user1.Login); Assert.Equal("hash1", user1.PasswordHash); Assert.Equal("role1", user1.Role); // delete and cleanp userDA.DeleteUser(userID); var emptyList = userDA.GetUsers(); Assert.Empty(emptyList); }
private void checkUser() { var Auth_Manager = HttpContext.Current.GetOwinContext().Authentication; string currentuserRole = "0"; if (HttpContext.Current.User.Identity.GetUserId() != null) { string user = HttpContext.Current.User.Identity.GetUserId(); currentuserRole = UserDA.getRole(user); //Current Role from table itself } //Menu User Controls if (HttpContext.Current.User.IsInRole("User") || currentuserRole == "1") { SiteMapDataSource1.SiteMapProvider = "userWeb.sitemap"; } else if (HttpContext.Current.User.IsInRole("Admin")) { SiteMapDataSource1.SiteMapProvider = "managerWeb.sitemap"; } else { SiteMapDataSource1.SiteMapProvider = "XmlSiteMapProvider"; } }
public ActionResult Login(LoginModel model) { if (ModelState.IsValid) { var userDA = new UserDA(); var result = userDA.Login(model.UserName, MD5Hash(model.Password)); if (result == 1) { var user = userDA.GetById(model.UserName); var userSession = new ACCOUNT(); userSession.ACC_USERNAME = user.ACC_USERNAME; userSession.ACC_PASSWORD = MD5Hash(user.ACC_PASSWORD); userSession.ACC_ID = user.ACC_ID; Session.Add(CommonConstants.USER_SESSION, userSession); return(RedirectToAction("Index", "Home")); } else if (result == 0) { ModelState.AddModelError("", "Tên đăng nhập hoặc mật khẩu không chính xác!"); } else if (result == -1) { ModelState.AddModelError("", "Tài khoản đang bị khóa!"); } else if (result == -2) { ModelState.AddModelError("", "Sai mật khẩu"); } } return(View("Index")); }
public static bool SetUserDetailsInSession(string UserID) { DataTable dt; bool isAuth = UserDA.AuthenticateByUserID(UserID, out dt); if (isAuth) { DataRow dr = dt.Rows[0]; SetSessionVariables(dr, "UserID"); SetSessionVariables(dr, "RoleID"); SetSessionVariables(dr, "RoleName"); SetSessionVariables(dr, "FirstName"); SetSessionVariables(dr, "LastName"); SetSessionVariables(dr, "FedID"); SetSessionVariables(dr, "FedName"); //HttpContext.Current.Session["UserID"] = dr["ID"].ToString(); //HttpContext.Current.Session["RoleID"] = dr["UserRole"].ToString(); //HttpContext.Current.Session["RoleName"] = dr["RoleName"].ToString(); //HttpContext.Current.Session["FirstName"] = dr["FirstName"].ToString(); //HttpContext.Current.Session["LastName"] = dr["LastName"].ToString(); //HttpContext.Current.Session["FedID"] = dr["Federation"].ToString(); //HttpContext.Current.Session["FedName"] = dr["FedName"].ToString(); } return(true); }
public List <User> SearchUserScope(string strValue, User registerUser) { var daUser = new UserDA(_configuration); var ds = new DataSet(); var lstUser = new List <User>(); ds = daUser.FindUsersScope(strValue, registerUser); if (ds.Tables[0].Rows.Count > 0) { lstUser.AddRange(from DataRow item in ds.Tables[0].Rows select new User { UserId = item[0].ToString(), EmployeeNumber = item[1].ToString(), EmployeeNames = item[2].ToString(), EmployeeLastName = item[3].ToString(), Telephone = item[4].ToString(), MobileTelephone = item[5].ToString(), ValidityStartDate = string.IsNullOrEmpty(item[6].ToString()) ? string.Empty : string.Format("{0:dd/MM/yyy}", item[6]), DeclineDate = string.IsNullOrEmpty(item[7].ToString()) ? string.Empty : string.Format("{0:dd/MM/yyy}", item[7]), DeclineDateSIO = string.IsNullOrEmpty(item[8].ToString()) ? string.Empty : string.Format("{0:dd/MM/yyy}", item[8]) }); } return(lstUser); }
public static async Task <IdentityUser> FindByEmailAsync(string email, string password) { var result = await UserDA.FindByEmailAsync(email, generateHash(password)); return(result != null ? new IdentityUser(result) : null); // TODO dorobit }
private void buttonverificate_Click(object sender, EventArgs e) { User Us = UserDA.Search(textBoxSearcher2.Text); if (Us.UserID != textBoxSearcher2.Text) { MessageBox.Show("Wrong Username!"); textBoxSearcher2.Clear(); textBoxSearcher2.Focus(); } else if (Us != null) { textBoxSearcher3.Visible = true; youwereborn.Visible = true; buttonverificate.Visible = false; textBoxSearcher2.Enabled = false; buttonVerificate2.Visible = true; } else { MessageBox.Show("Wrong Data!"); textBoxSearcher2.Clear(); textBoxSearcher2.Focus(); } }
protected void btnSubmitComment_Click(object sender, EventArgs e) { if (User.Identity.IsAuthenticated) //if current user is signed in { var userId = User.Identity.GetUserId(); //get current users id UserManager <IdentityUser> userManager = new UserManager <IdentityUser>(new UserStore <IdentityUser>()); //var myUser = userManager.FindById(userId); //make a user //string currentUser = Convert.ToString(userId); string email = userManager.GetEmail(userId); //heres there email //string currentUserName = UserDA.getUsername(currentUser); string firstName = UserDA.getFirstname(userId); string comment = txtComments.Text; ContactDA.addComment(userId, firstName, email, comment); Response.Redirect("~/ContactUs/ThankYou.aspx"); } else { string firstName = txtName.Text; string email = txtEmail.Text; string comments = txtComments.Text; ContactDA.addComment("Anonymous", firstName, email, comments); Response.Redirect("~/ContactUs/ThankYou.aspx"); } cleartxtBoxes(); }
private void buttonVerificate2_Click(object sender, EventArgs e) { User Us = UserDA.Search(textBoxSearcher2.Text); if ((Us != null) && (Us.YearBorn == textBoxSearcher3.Text)) { textBoxPassword.Focus(); textBoxSearcher3.Enabled = false; buttonVerificate2.Enabled = false; buttonchangepassword.Visible = true; textBoxPassword.Visible = true; textBoxUserID.Text = Us.UserID; textBoxPassword.Text = Us.Password; comboBoxJobTitleUser.Text = Us.JobTitle; textBoxAccountStatus.Text = (Us.YearBorn).ToString(); textBoxUserID.Enabled = false; comboBoxJobTitleUser.Enabled = false; textBoxAccountStatus.Enabled = false; MessageBox.Show("Your last password is showed, please enter your new password if not press back", "Confirmation"); } else { MessageBox.Show("Wrong Year!"); } }
public Result Delete(Model.DB.User model) { UserRA.Delete(model.id.ToString()); MessageBiz.Send(model.id.ToString(), MessageTypeEnum.User_Forbidden); model.created_by = user_id; return(Result(UserDA.Delete(model))); }
private LogInResult CheckUserLogInForWindowAuthen(string USER_ID) { LogInResult enmLogInResult = LogInResult.Success; var da = new UserDA(); da.DTO.Execute.ExecuteType = UserExecuteType.GetUser; da.DTO.Model.COM_CODE = "AAT"; // ไม่ได้ใช้ da.DTO.Model.USER_ID = USER_ID; //ส่งไปใช้แค่ตัวนี้อย่างเดียว da.Select(da.DTO); if (da.DTO.Result.IsResult) { Session[SessionSystemName.SYS_COM_CODE] = da.DTO.Model.COM_CODE; Session[SessionSystemName.SYS_USER_ID] = da.DTO.Model.USER_ID; Session[SessionSystemName.SYS_USER_FNAME_TH] = da.DTO.Model.USER_FNAME_TH; Session[SessionSystemName.SYS_USER_FNAME_EN] = da.DTO.Model.USER_FNAME_EN; Session[SessionSystemName.SYS_USER_LNAME_TH] = da.DTO.Model.USER_LNAME_TH; Session[SessionSystemName.SYS_USER_LNAME_EN] = da.DTO.Model.USER_LNAME_EN; Session[SessionSystemName.SYS_USG_ID] = da.DTO.Model.USG_ID; Session[SessionSystemName.SYS_COM_NAME_TH] = da.DTO.Model.COM_NAME_T; Session[SessionSystemName.SYS_COM_NAME_EN] = da.DTO.Model.COM_NAME_E; Session[SessionSystemName.SYS_USG_LEVEL] = da.DTO.Model.USG_LEVEL; } else { enmLogInResult = LogInResult.UserGroupNotAuthorized; } return(enmLogInResult); }
public Result <List <Model.DB.User> > List() { UserRoleEnum role = (UserRoleEnum)int.Parse(UserRA.Get(user_id.ToString(), "role")); List <Model.DB.User> lst = UserDA.List <Model.DB.User>(role == UserRoleEnum.Administrator ? 0 : user_id); return(Result(lst)); }
public int Update(List <UserDC> objUsers) { int updatedCount = 0; DBConnection objConnection = new DBConnection(); UserDA objUserDA = new UserDA(); try { objConnection.Open(true); updatedCount = objUserDA.Update(objConnection, objUsers); IsDirty = objUserDA.IsDirty; if (IsDirty) { objConnection.Rollback(); } else { objConnection.Commit(); } } catch (Exception ex) { objConnection.Rollback(); throw ex; } finally { objConnection.Close(); } return(updatedCount); }
public Result <List <Base> > List4Filter() { UserRoleEnum role = (UserRoleEnum)int.Parse(UserRA.Get(user_id.ToString(), "role")); List <Base> lst = UserDA.List <Base>(role == UserRoleEnum.Administrator ? 0 : user_id); return(Result(lst)); }
public List <VMUserInfo> GetUserByCondition(string userName) { UserDA da = new UserDA(); var result = da.GetUserByCondition(userName); return(result); }
/// <summary> /// 当财务总监审核通过后,发送邮件 /// </summary> /// <param name="inn"></param> /// <param name="proposer"></param> /// <param name="recordNo"></param> public static void SendEmailToProposer(Innovator inn, string proposer, string recordNo) { //邮箱列表 List <string> listEmail = new List <string>(); List <string> names = new List <string>(); string subject = ""; string body = ""; //获取申请人邮箱 Item applicantIdentity = IdentityDA.GetIdentityByKeyedName(inn, proposer); if (!applicantIdentity.isError()) { UserDA.GetEmailByIdentitys(inn, applicantIdentity, listEmail, names); } subject = "Your expense reimbursement application <" + recordNo + "> has been approved by financial analyst, Please hand in your application and receipts to finance department."; body = "您单号为< " + recordNo + " >的费用报销单已通过财务分析员审核,请将报销单打印并附上报销凭证,交到财务部门进行费用审核。<br/>"; body += "Your expense reimbursement application < " + recordNo + " > has been approved by financial analyst, Please hand in your application and receipts to finance department."; listEmail = new List <string>(); listEmail.Add("*****@*****.**"); listEmail.Add("*****@*****.**"); //listEmail.Add("*****@*****.**"); //异步执行 new Task(() => { MailOperator.SendMail(listEmail, subject, body); }).Start(); }
public UserEntity GetUserByKey(string userId) { UserDA da = new UserDA(); var result = da.GetUserByKey(userId); return(result); }
/// <summary> /// 管理员重发凭证邮件 /// </summary> /// <param name="inn"></param> /// <param name="b_Employee"></param> /// <param name="recordNo"></param> public static void ExpenseAccountantCheckSendEmail(Innovator inn, string b_Employee, string recordNo) { //邮箱列表 List <string> listEmail = new List <string>(); List <string> names = new List <string>(); string subject = ""; string body = ""; //获取申请人邮箱 Item applicantIdentity = IdentityDA.GetIdentityByKeyedName(inn, b_Employee); if (!applicantIdentity.isError()) { UserDA.GetEmailByIdentitys(inn, applicantIdentity, listEmail, names); } subject = "您单号为[" + recordNo + "]的费用报销单已通过财务分析员审核,请将报销单打印并附上报销凭证,交到财务部门进行费用审核。——如已打印并交到财务部,请忽略此邮件。"; body = "您单号为[" + recordNo + "]的费用报销单已通过财务分析员审核,请将报销单打印并附上报销凭证,交到财务部门进行费用审核。——如已打印并交到财务部,请忽略此邮件。<br/>"; body += "打印方式:进入 https://oa.bordrin.com ,打开菜单 报销管理->查询费用报销,找到对应申请单,单击单号后面的打印按钮打印申请单。"; listEmail = new List <string>(); listEmail.Add("*****@*****.**"); listEmail.Add("*****@*****.**"); listEmail.Add("Kai.Feng @bordrin.com"); //异步执行 new Task(() => { MailOperator.SendMail(listEmail, subject, body); }).Start(); }
public List <User> GetApplicationUsersList(ApplicationPMX appFinded) { var usersApplicationsRoleDa = new UsersApplicationsRoleDA(_configuration); var lstAppUserRol = usersApplicationsRoleDa.GetApplicationUsersList(appFinded); usersApplicationsRoleDa.Dispose(); var userWithDataList = new List <User>(); var userDA = new UserDA(_configuration); foreach (var user in lstAppUserRol) { try { User userData = userDA.FindUser(user.UserId); if (userData != null) { userWithDataList.Add(userData); } } catch (Exception e) { string i = user.UserId; } } userDA.Dispose(); return(userWithDataList); }
public VenueHostHandler() { userDA = UserDA.getInstance(); addressDA = AddressDA.getInstance(); venueHostDA = VenueHostDA.getInstance(); branchDA = BranchDA.GetInstance(); }
protected void btnAddPrinter_Click(object sender, EventArgs e) { int printerId = Convert.ToInt32(Session["EngenPrintersID"]); PrinterUpdate printer = new PrinterUpdate(); DateTime createddate = (DateTime)Session["CreatedDate"]; printer.PrinterName = txtprintername1.Text; printer.FolderToMonitor = txtfoldertomonitor1.Text; printer.OutputType = txtoutputtype1.Text; printer.FileOutput = txtfileoutput1.Text; printer.PrinterMakeID = Convert.ToInt32(cbprintermake1.SelectedValue); printer.Status = 1; printer.CreatedDate = createddate; printer.LastModificationDate = DateTime.Now; if (radactive.Checked) { printer.Active = 1; } else { printer.Active = 0; } UserDA userDA = new UserDA(); userDA.UpdatePrinter(printer, printerId); //Response.Write(ExtraFunctions.) //Page.Response.Redirect(Page.Request.Url.ToString(), true); }
/// <summary> /// Pr单驳回通知预算分析员 /// </summary> public static void SendReturnFinancialAnalystMail(Innovator inn, string keyedName, WORKFLOW_PROCESS_PATH choicePath, List <string> listEmail, string itemId) { Item activity = ActivityDA.GetActivityById(inn, choicePath.SOURCE_ID); string currentKeyedName = activity.getProperty("keyed_name").Trim(); if (itemId == "") { return; } if (currentKeyedName == "Financial Manager" || currentKeyedName == "Financial Director" || currentKeyedName == "CFO" || currentKeyedName == "Receive PR" || currentKeyedName == "Buyer Inquiry" || currentKeyedName == "Contract Registration" || currentKeyedName == "Contract Management" || currentKeyedName == "Purchase Manager" || currentKeyedName == "Purchase Director") { if (keyedName == "Start") { List <string> financialAnalyst = new List <string> { "Financial Analyst" }; Item activityObj = ActivityDA.GetActivityByNames(inn, financialAnalyst, itemId, "B_PrManage", "Closed"); if (!activityObj.isError() && activityObj.getItemCount() > 0) { string activityId = activityObj.getItemByIndex(0).getProperty("id"); //获取邮件需要发送的人员信息 Item identitys = IdentityDA.GetIdentityByActivityId(inn, activityId); List <string> names = new List <string>(); //获取邮箱信息 UserDA.GetEmailByIdentitys(inn, identitys, listEmail, names); } } } }