protected void databind() { kid = RoleID; //读取用户头像:若没有设置头像则根据性别选择默认的头像 E_User dataAvatar = new E_User(); dataAvatar.EnterpriseID = EnterpriceID; dataAvatar.UserID = UserID; dataAvatar = new T_User().GetEPModel(dataAvatar); if (dataAvatar != null) { string url = dataAvatar.Avatar == "" ? "/images/guanliyuan.jpg" : MLMGC.COMP.Config.GetEnterpriseAvatarUrl(dataAvatar.Avatar); imgAvatar.ImageUrl = url; } E_EnterpriseUser data = new E_EnterpriseUser(); data.UserID = UserID; data.EnterpriseID = EnterpriceID; data.EPUserTMRID = EPUserTMRID; //ShowReservationTip = (RoleID == ((int)EnumRole.销售人员)); DataTable dt = new T_User().GetUserSelectRole(data); if (dt != null && dt.Rows.Count >= 1) { //var v = from a in dt.Rows where a["EPUserTMRID"] = EPUserTMRID select new { Team=a["TeamName"],Role=a["RoleName"]}; DataRow[] dr = dt.Select("EPUserTMRID =" + EPUserTMRID); if (dr.Length > 0) { ltRole.Text = dr[0]["RoleName"].ToString(); //lblRole.Text = dr[0]["RoleName"].ToString(); ltTrueName.Text = dr[0]["TrueName"].ToString(); int firstlogin = Convert.ToInt32(dr[0]["FirstLogin"]); if (firstlogin == 0) { ShowTip = true; } } } //绑定菜单 //获取所有的菜单 dtMenu = new T_User().GetMenuList(new E_EnterpriseUser() { EPUserTMRID = base.EPUserTMRID, EnterpriseID = EnterpriceID, UserID = UserID }); //查找二级节点 IEnumerable <System.Data.DataRow> secondNode = from item in dtMenu.AsEnumerable() where item.Field <byte>("DeptID") == 1 select item; rpSecondMenu.DataSource = secondNode.CopyToDataTable <DataRow>(); rpSecondMenu.DataBind(); }
public ActionResult SelectTheme() { E_User eUser = HttpContext.Session["user"] as E_User; ViewBag.userinfo = eUser; ViewBag.listtheme = dTheme.GetList(); return(View("~/views/App/SelectTheme.cshtml")); }
/// <summary> /// 详情 /// </summary> public ActionResult Info(int id) { E_User model = new E_User(); model.userid = id; ViewBag.Info = daluser.GetInfoById(model); ViewBag.arealist = dalarea.GetList(); //作业区列表 return(View()); }
/// <summary> /// 保存 /// </summary> public bool Save(E_User model) { model.updatetime = DateTime.Now; if (model.userid > 0)//若存在数据,执行更新 { return(daluser.Update(model)); } return(daluser.Add(model));//若不存在数据,直接插入 }
/// <summary> /// 获取企业用户购买数量和已使用数量 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-11-30</remarks> public DataTable GetEPUserCount(E_User data) { SqlParameter[] parms = { new SqlParameter("@EnterpriseID", SqlDbType.Int) }; parms[0].Value = data.EnterpriseID; return(DbHelperSQL.RunProcedureTable("ProcB_UserS_GetEPUserCount", parms)); }
/// <summary> /// 点击确定按钮处理事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { //获取界面数据 string annTitle = txtAnnTitle.Text; string annContent = txtAnnContent.Content; if (annTitle == "" && annContent == "") { MLMGC.COMP.Jscript.ShowMsg("请输入公告标题和内容", this); return; } else if (annTitle == "") { MLMGC.COMP.Jscript.ShowMsg("请输入公告标题和内容", this); return; } else if (annContent == "") { MLMGC.COMP.Jscript.ShowMsg("请输入公告标题和内容", this); return; } //首先根据EPUserTMRID获取TeamID E_User user = new E_User(); user.EnterpriseID = EnterpriceID; user.EPUserTMRID = EPUserTMRID; DataTable dt = new T_Team().GetTeamID(user); if (dt == null || dt.Rows.Count != 1) { return; } int teamID = Convert.ToInt32(dt.Rows[0]["TeamID"]); //添加公告 E_Announcement data = new E_Announcement(); data.EnterpriseID = EnterpriceID; data.TeamID = teamID; data.AnnTitle = annTitle; data.AnnContent = annContent; bool flag = new T_Announcement().Add(data); if (flag) { new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = EnterpriceID, UserID = UserID, LogTitle = "添加公告", IP = MLMGC.COMP.Requests.GetRealIP() }); MLMGC.COMP.Jscript.AlertAndRedirect(this, "添加成功", "AnnouncementList.aspx"); } else { MLMGC.COMP.Jscript.ShowMsg("添加失败", this); } }
public string HelloWorld() { E_User usersin = new E_User();// 传入的用户 usersin.user_Account = "123456"; usersin.user_Pw = "123123"; String aa = Util.Serialize(usersin); return(aa); }
/// <summary> /// 查询 /// </summary> public E_User GetInfoById(E_User model) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from dp_user where userid=@userid"); using (IDbConnection conn = new SqlConnection(DapperHelper.GetConStr())) { model = conn.Query <E_User>(strSql.ToString(), model)?.FirstOrDefault(); } return(model); }
public bool Login(E_User users) { if (bll.login(users)) { return(true); } else { return(false); } }
public UserRemoveRoleCommand() { _conf = (IConfiguration) new ConfigurationBuilder() .AddJsonFile("clisettings.json", optional: false, reloadOnChange: true) .Build(); _map = new MapperConfiguration(x => x.AddProfile <AutoMapperProfile_EF6>()) .CreateMapper(); var env = new ContextService(InstanceContext.DeployedOrLocal); _uow = new UnitOfWork(_conf["Databases:IdentityEntities_EF6"], env); _service = new AdminService(_conf) { Grant = new ResourceOwnerGrantV2(_conf) }; IsCommand("user-remove-role", "Remove role from user"); HasRequiredOption("u|user="******"Enter existing user", arg => { if (string.IsNullOrEmpty(arg)) { throw new ConsoleHelpAsException($" *** No user given ***"); } _user = _uow.Users.Get(QueryExpressionFactory.GetQueryExpression <E_User>() .Where(x => x.UserName == arg).ToLambda()) .SingleOrDefault(); if (_user == null) { throw new ConsoleHelpAsException($" *** No user '{arg}' ***"); } }); HasRequiredOption("r|role=", "Enter existing role", arg => { if (string.IsNullOrEmpty(arg)) { throw new ConsoleHelpAsException($" *** No role given ***"); } _role = _uow.Roles.Get(QueryExpressionFactory.GetQueryExpression <E_Role>() .Where(x => x.Name == arg).ToLambda()) .SingleOrDefault(); if (_role == null) { throw new ConsoleHelpAsException($" *** No role '{arg}' ***"); } }); }
/// <summary> /// 获取团队用户角色信息 /// </summary> /// <param name="data"></param> /// <returns></returns> public DataTable GetTeamUserRole(E_User data) { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@UserID", SqlDbType.Int) }; parms[0].Value = data.EnterpriseID; parms[1].Value = data.UserID; return(DbHelperSQL.RunProcedureTable("ProcEP_R_EPUserTMRS_Select", parms)); }
/// <summary> /// 数据绑定 /// </summary> protected void databind() { //------绑定用户列表------ E_User data = new E_User(); data.EnterpriseID = EnterpriceID; data.Page = new MLMGC.DataEntity.E_Page(); data.Page.PageIndex = 1; data.Page.PageSize = 1000; DataTable dt = new T_User().GetEPList(data).Tables[0]; ddlObject.Items.Add(new ListItem("", "")); foreach (DataRow dr in dt.Rows) { ddlObject.Items.Add(new ListItem(string.Format("{0}", dr["TrueName"]), dr["UserID"].ToString())); } //---------绑定数据列表----------- string start = Requests.GetQueryString("start"); string end = Requests.GetQueryString("end"); int userid = Requests.GetQueryInt("userid", 0); ddlObject.SelectedValue = userid.ToString(); E_Log log = new E_Log(); log.EnterpriseID = EnterpriceID; log.UserID = userid; log.Page = new MLMGC.DataEntity.E_Page(); log.Page.PageIndex = pageIndex; log.Page.PageSize = pageSize; if (start != "") { log.Page.StartDate = Convert.ToDateTime(start); txtStartDate.Text = start; } if (end != "") { log.Page.EndDate = Convert.ToDateTime(end); txtEndDate.Text = end; } DataTable dtList = new T_Log().GetList(log); rpList.DataSource = dtList; rpList.DataBind(); //设置分页样式 pageList1.PageSize = pageSize; pageList1.CurrentPageIndex = pageIndex; pageList1.RecordCount = log.Page.TotalCount; pageList1.CustomInfoHTML = string.Format("共有记录 <span class='red_font'>{0}</span> 条", pageList1.RecordCount); pageList1.TextAfterPageIndexBox = " 页/" + pageList1.PageCount + " "; }
/// <summary> /// 数据绑定 /// </summary> protected void databind() { E_User data = new E_User(); data.EnterpriseID = EnterpriceID; data.UserID = UserID; data = new T_User().GetEPModel(data); if (data != null) { string url = data.Avatar == "" ? "/images/guanliyuan.jpg" : MLMGC.COMP.Config.GetEnterpriseAvatarUrl(data.Avatar); imgAvatar.ImageUrl = url; } }
/// <summary> /// 删除企业用户 /// </summary> /// <param name="data"></param> /// <returns>0=删除失败,1=删除成功,-1=用户数据未清空</returns> /// <remarks>tianzhenyun 2011-12-19</remarks> public int EPUserDelete(E_User data) { SqlParameter[] parms = { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@UserID", SqlDbType.Int) }; parms[0].Value = data.EnterpriseID; parms[1].Value = data.UserID; int ReturnValue; DbHelperSQL.RunProcedures("ProcB_UserS_EPDelete", parms, out ReturnValue); return(ReturnValue); }
public ActionResult UserService() { user = HttpContext.Session["user_pc"] as E_User; int total = 0; var list = dPerson.GetList(new E_Person() { classinfoid = user.classinfoid, areaid = user.areaid, PageSize = 10000 }, ref total); ViewBag.list = list; return(View()); }
/// <summary> /// 查询 /// </summary> public E_User GetInfoByName(E_User model) { StringBuilder strSql = new StringBuilder(); strSql.Append(@"select *,Name as areaname,CName as classinfoname from ( select * from dp_user where username =@username and password=@password) a left join dbo.Area b on a.areaid = b.id left join dbo.ClassInfo c on a.classinfoid = c.id"); using (IDbConnection conn = new SqlConnection(DapperHelper.GetConStr())) { model = conn.Query <E_User>(strSql.ToString(), model)?.FirstOrDefault(); } return(model); }
public String FoodLikeAjax() { user = HttpContext.Session["user_pc"] as E_User; int total = 0; var list = dFood.GetList(new E_Food() { classinfoid = user.classinfoid, areaid = user.areaid, PageSize = 10000, startaddtime = Convert.ToDateTime(DateTime.Now.ToString("D")) }, ref total); return(JsonConvert.SerializeObject(list)); }
/// <summary> /// 根据 账号 查找 通知集合 2017年6月27日21:12:04 /// </summary> /// <param name="find"></param> /// <returns></returns> public List <HS_Inform> FindHS_Inform_ByAccount(E_User find) { string ss = ""; ss = @"select * from HS_Inform where ( inform_Message_Time < inform_Message_Total_Time )"; if (!string.IsNullOrWhiteSpace(find.user_Account)) { ss += " and inform_User_Account = '" + find.user_Account + "'"; } str = ss + " order by inform_Id desc "; DataTable table = sql.FillDt(str); List <HS_Inform> list = HS_Inform.DataTable2HS_Inform(table); return(list); }
public ActionResult FoodLike() { user = HttpContext.Session["user_pc"] as E_User; int total = 0; var list = dFood.GetList(new E_Food() { classinfoid = user.classinfoid, areaid = user.areaid, PageSize = 10000, startaddtime = Convert.ToDateTime(DateTime.Now.ToString("D")) }, ref total); ViewBag.list = list; return(View()); }
/// <summary> /// 判断企业用户是否存在 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-12-01</remarks> public bool EPUserExist(E_User data) { SqlParameter[] parms = { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@UserID", SqlDbType.Int), new SqlParameter("@UserName", SqlDbType.VarChar, 128) }; parms[0].Value = data.EnterpriseID; parms[1].Value = data.UserID; parms[2].Value = data.UserName; int ReturnValue; DbHelperSQL.RunProcedures("ProcEP_UserS_EPExisit", parms, out ReturnValue); return(ReturnValue > 0); }
/// <summary> /// 企业用户修改头像 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-12-09</remarks> public bool UpdateAvatar(E_User data) { SqlParameter [] parms = { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@UserID", SqlDbType.Int), new SqlParameter("@Avatar", SqlDbType.VarChar, 128) }; parms[0].Value = data.EnterpriseID; parms[1].Value = data.UserID; parms[2].Value = data.Avatar; int ReturnValue; DbHelperSQL.RunProcedures("ProcB_User_EPUpdateAvatar", parms, out ReturnValue); return(ReturnValue > 0); }
/// <summary> /// 设置团队用户角色信息 /// </summary> /// <param name="data"></param> public int SetTeamUserRole(E_User data) { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@UserID", SqlDbType.Int), new SqlParameter("@Settings", SqlDbType.NVarChar) }; parms[0].Value = data.EnterpriseID; parms[1].Value = data.UserID; parms[2].Value = data.RoleSetting; int ReturnValue = 0; DbHelperSQL.RunProcedures("ProcEP_R_EPUserTMRS_Update", parms, out ReturnValue); return(ReturnValue); }
/// <summary> /// 重置密码 /// </summary> /// <param name="data"></param> /// <returns></returns> public bool ResetPassword(E_User data) { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@UserID", SqlDbType.Int), new SqlParameter("@Password", SqlDbType.VarChar, 128) }; parms[0].Value = data.EnterpriseID; parms[1].Value = data.UserID; parms[2].Value = data.Password; int ReturnValue = 0; DbHelperSQL.RunProcedures("ProcB_UserS_ResetPassword", parms, out ReturnValue); return(ReturnValue > 0); }
/// <summary> /// 更改用户状态(启用、禁用) /// </summary> /// <param name="data"></param> /// <returns></returns> public bool UserStatus(E_User data) { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@EnterpriseID", SqlDbType.Int), new SqlParameter("@UserID", SqlDbType.Int), new SqlParameter("@Status", SqlDbType.TinyInt) }; parms[0].Value = data.EnterpriseID; parms[1].Value = data.UserID; parms[2].Value = data.Status; int ReturnValue = 0; DbHelperSQL.RunProcedures("ProcB_UserS_StatusUpdate", parms, out ReturnValue); return(ReturnValue > 0); }
public ActionResult List() { int pageIndex = Utils.GetInt(Request["page"]); E_User searchmodel = new E_User(); searchmodel.pagesize = 15; searchmodel.pageindex = pageIndex; ViewBag.userlist = daluser.GetList(searchmodel); //用户列表 int count = daluser.GetCount(); ViewBag.page = Utils.ShowPage(count, searchmodel.pagesize, pageIndex, 5); return(View()); }
public ActionResult CommentContent(E_Comment eComment) { E_User eUser = HttpContext.Session["user"] as E_User; ViewBag.userinfo = eUser; ViewBag.listCommentType = dCommentType.GetListByThemeid(new E_CommentType() { themeid = eComment.themeid }); ViewBag.listCommentItem = dCommentItem.GetCommentItemByThemeID(eComment.themeid); ViewBag.listopinion = dOpinion.GetList(new E_Opinion() { themeid = eComment.themeid }); ViewBag.CommentInfo = eComment; return(View("~/views/App/CommentContent.cshtml")); }
/// <summary> /// 查询 /// </summary> public List <E_User> GetList(E_User model) { List <E_User> list; StringBuilder strSql = new StringBuilder(); strSql.Append(@"select * from ( select row_number()over(order by userid asc) as rowid, dp_user.*, Area.Name as areaname, ClassInfo.CName as classinfoname from dp_user with (nolock) left join dbo.Area on dp_user.areaid = dbo.Area.id left join dbo.ClassInfo on dp_user.classinfoid = dbo.ClassInfo.id ) as T where t.rowid between @pageindex*@pagesize and (@pageindex+1)*@pagesize"); using (IDbConnection conn = new SqlConnection(DapperHelper.GetConStr())) { list = conn.Query <E_User>(strSql.ToString(), model)?.ToList(); } return(list); }
protected void btnSubmit_Click(object sender, EventArgs e) { E_User data = new E_User(); T_User bll = new T_User(); //检测数据合法 if (!string.IsNullOrEmpty(hdRoleInfo.Value) && !new System.Text.RegularExpressions.Regex("^\\d+:\\d+(,\\d+:\\d+)*$").IsMatch(hdRoleInfo.Value)) { MLMGC.COMP.Jscript.ShowMsg("数据错误,无法完成操作", this); return; } data.UserName = txtUserName.Text.Trim(); string password = txtPassword.Text.Trim(); if (type == "add" && string.IsNullOrEmpty(password)) { MLMGC.COMP.Jscript.ShowMsg("您第一次操作,请输入密码!", this); return; } data.Password = string.IsNullOrEmpty(password)?"":MLMGC.COMP.EncryptString.EncryptPassword(password); data.UserType = (int)UserType.企业用户; data.EnterpriseID = EnterpriceID; data.TrueName = txtTrueName.Text.Trim(); data.UserID = userid; data.RoleSetting = hdRoleInfo.Value; int result = bll.AddEnterpriseUser(data); if (result >= 1) { //添加操作日志 new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = EnterpriceID, UserID = UserID, LogTitle = "管理员添加企业用户", IP = MLMGC.COMP.Requests.GetRealIP() }); MLMGC.COMP.Jscript.AlertAndRedirect(this, "保存成功", "userlist.aspx"); } else if (result == -2) { MLMGC.COMP.Jscript.ShowMsg("您选择的角色已经有相关人员,请去掉该角色之前的相关人员", this); } else { MLMGC.COMP.Jscript.ShowMsg("操作失败", this); } }
/// <summary> /// 查看个人登录详细信息记录列表 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-11-10</remarks> public DataTable GetLoginInfoList(E_User data) { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@LoginInfoID", SqlDbType.Int), new SqlParameter("@PageIndex", SqlDbType.Int), new SqlParameter("@PageSize", SqlDbType.Int), new SqlParameter("@TotalCount", SqlDbType.Int) }; parms[0].Value = data.LoginInfoID; parms[1].Value = data.Page.PageIndex; parms[2].Value = data.Page.PageSize; parms[3].Direction = ParameterDirection.Output; DataTable dt = DbHelperSQL.RunProcedureTable("ProcPI_B_LoginInfo_Select", parms); data.Page.TotalCount = parms[3].Value == DBNull.Value ? 0 : Convert.ToInt32(parms[3].Value); return(dt); }
/// <summary> /// 个人用户登录日志 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-11-09</remarks> public bool AddLoginInfo(E_User data) { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@LoginIP", SqlDbType.VarChar, 32), new SqlParameter("@UserID", SqlDbType.Int), new SqlParameter("@Browser", SqlDbType.VarChar, 64), new SqlParameter("@Resolution", SqlDbType.VarChar, 64) }; parms[0].Value = data.LoginIP; parms[1].Value = data.UserID; parms[2].Value = data.Browser; parms[3].Value = data.Resolution; int ReturnValue = 0; DbHelperSQL.RunProcedures("ProcPI_B_LoginInfoS_Insert", parms, out ReturnValue); return(ReturnValue > 0); }