protected void btEnd_Click(object sender, EventArgs e) { ProduceTrack info = new ProduceTrack(); ProduceTrackBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <ProduceTrackBLL>(); info.PID = this.hiID.Value; info.WORKINGENDTIME = DateTime.Now; info.STATUS = "1"; info.WPID = this.hiGX.Value; info.EQUID = this.hiCB.Value; info.WSID = this.hiGW.Value; info.PRODUCTIONID = this.hiPid.Value; info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value); info.CREATEUSER = this.HiCREATEUSER.Value; bll.Update(info); ClientScript.RegisterStartupScript(this.GetType(), "myjs", "alert('完成');window.location.href='MaterialTrace.aspx';", true); } catch (Exception ex) { throw ex; } }
public JsonResult AddRole(RoleModel model) { JsonModel jm = new JsonModel(); //如果表单模型验证成功 if (ModelState.IsValid) { IPropertyRoleBLL propertyRoleBll = BLLFactory <IPropertyRoleBLL> .GetBLL("PropertyRoleBLL"); //初始化平台角色数据实体 T_PropertyRole role = new T_PropertyRole() { RoleName = model.RoleName, RoleMemo = model.RoleMemo, PropertyPlaceId = GetSessionModel().PropertyPlaceId.Value }; //保存 propertyRoleBll.Save(role); //日志记录 jm.Content = PropertyUtils.ModelToJsonString(model); } else { jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
protected void btSave_Click(object sender, EventArgs e) { InspectItemEntity info = new InspectItemEntity(); InspectItemBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <InspectItemBLL>(); if (this.hiID.Value == "") { bll.Insert(info); } else { info.Id = this.hiID.Value; bll.Update(info); } ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true); } catch (Exception ex) { throw ex; } }
protected void btDelete_Click(object sender, EventArgs e) { ArrayList pkArray = null; CheckStockBLL bll = null; try { bll = BLLFactory.CreateBLL <CheckStockBLL>(); pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0); foreach (object key in pkArray) { bll.Delete(new CheckStockBill { ID = key.ToString() }); } this.BindData(); } catch (Exception ex) { throw ex; } }
public JsonResult DeleteRole(int id) { JsonModel jm = new JsonModel(); IPropertyRoleBLL propertyRoleBll = BLLFactory <IPropertyRoleBLL> .GetBLL("PropertyRoleBLL"); //获取要删除的物业角色 T_PropertyRole role = propertyRoleBll.GetEntity(m => m.Id == id); if (role == null) { jm.Msg = "该角色不存在"; } else if (role.PropertyUserRoles.Count > 0) { jm.Msg = "有配置该角色的用户,不能删除"; } else { if (propertyRoleBll.Delete(role)) { //操作日志 jm.Content = "删除物业角色 " + role.RoleName; } else { jm.Msg = "删除失败"; } } return(Json(jm, JsonRequestBehavior.AllowGet)); }
public JsonResult ResetPassword(int id) { JsonModel jm = new JsonModel(); IShopUserBLL shopUserBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL"); // 根据指定id值获取实体对象 var shopUser = shopUserBll.GetEntity(index => index.Id == id && index.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (shopUser != null) { Random r = new Random(); int radVal = r.Next(100, 1000); shopUser.Password = PropertyUtils.GetMD5Str(shopUser.UserName + radVal); //重置密码 shopUserBll.Update(shopUser); //给门店用户发送邮件 PropertyUtils.SendEmail(shopUser.Email, shopUser.UserName, "物业生活管理系统 用户密码重置", "您的用户密码已重置为" + shopUser.UserName + radVal + ", 请及时修改密码!"); //操作日志 jm.Content = "门店用户" + shopUser.TrueName + "密码一键重置成功"; } else { jm.Msg = "该门店用户不存在"; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
protected void btDelete_Click(object sender, EventArgs e) { ArrayList pkArray = null; FactoryInfoBLL bll = null; try { bll = BLLFactory.CreateBLL <FactoryInfoBLL>(); pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0); foreach (object key in pkArray) { if (!bll.HasProductLine(key.ToString())) { bll.DeleteFactory(new FactoryInfo { PID = key.ToString() }); } else { ClientScript.RegisterStartupScript(this.GetType(), "myjs", "alert('选中的工厂有生产线,不能被删除');", true); } } this.BindData(); } catch (Exception ex) { throw ex; } }
/// <summary> /// 上报问题详情 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult QuestionDetail(int id) { WeixinApiInit(); IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); var question = questionBll.GetEntity(m => m.Id == id); var model = new QuestionDetailModel { Id = question.Id, Title = question.Title, Desc = string.IsNullOrEmpty(question.Desc) ? "" : question.Desc, Status = question.Status, UploadTime = question.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Imgs = string.IsNullOrEmpty(question.Imgs) ? new string[] { } : question.Imgs.Split(';'), AudioPath = question.AudioPath, VoiceDuration = question.VoiceDuration, PropertyName = question.PropertyPlace.Name, DisposesTime = question.Status == ConstantParam.NO_DISPOSE ? null : question.QuestionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss"), DisposeDesc = question.Status == ConstantParam.DISPOSED ? question.QuestionDisposes.FirstOrDefault().DisposeDesc : "" }; return(View(model)); }
protected void Page_Load(object sender, EventArgs e) { List <string> idCodeList = Session["idCodeList"] as List <string>; string idcodetext = Session["idcodetext"] as string; if (idCodeList != null) { PrintContent += "LODOP.SET_PRINT_PAGESIZE(1,600,400,\"\");"; for (int i = 0; i < idCodeList.Count; i++) { PrintContent += "LODOP.ADD_PRINT_TEXT(5, 20, " + System.Configuration.ConfigurationManager.AppSettings["MLabelWidth"] + ", " + System.Configuration.ConfigurationManager.AppSettings["MLabelHeight"] + ",\"" + idcodetext + "\");"; PrintContent += "LODOP.ADD_PRINT_BARCODE(30, 20, " + System.Configuration.ConfigurationManager.AppSettings["MLabelWidth"] + ", " + System.Configuration.ConfigurationManager.AppSettings["MLabelHeight"] + ", \"128A\", \"" + idCodeList[i] + "\");"; PrintContent += "LODOP.ADD_PRINT_TEXT(130, 20, " + System.Configuration.ConfigurationManager.AppSettings["MLabelWidth"] + ", " + System.Configuration.ConfigurationManager.AppSettings["MLabelHeight"] + ",\"" + System.Configuration.ConfigurationManager.AppSettings["rootOrgan"] + "\");"; PrintContent += "LODOP.NewPage();"; } WHMatBLL bll = BLLFactory.CreateBLL <WHMatBLL>(); bll.SignMatIDCodePrintCount(idCodeList); } Session["idCodeList"] = null; }
/// <summary> /// 获取仓库树数据源 /// </summary> /// <returns></returns> public string GetWHList() { List <TreeNodeResult> list = new List <TreeNodeResult>(); WarehouseBLL bll = null; List <Warehouse> array = null; try { bll = BLLFactory.CreateBLL <WarehouseBLL>(); array = bll.GetList(); TreeNodeResult rootNode = new TreeNodeResult(); rootNode.Tid = ""; rootNode.Ttext = "仓库"; foreach (Warehouse info in array) { TreeNodeResult node = new TreeNodeResult(); node.Tid = info.ID; node.Ttext = info.Code + "|" + info.Description; rootNode.AddchildNode(node); } list.Add(rootNode); return(TreeNodeResult.GetResultJosnS(list.ToArray())); } catch (Exception ex) { throw ex; } }
/// <summary> /// 上报问题Json方式获取 /// </summary> /// <param name="pageIndex"></param> /// <returns></returns> public JsonResult QuestionJsonList(int pageIndex) { //获取当前用户 var userId = GetCurrentUser().Id; var placeIds = GetVerifiedPlaceIds(); PageResultModel model = new PageResultModel(); IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); model.Total = questionBll.Count(m => m.UploadUserId == userId && placeIds.Contains(m.PropertyPlaceId)); model.Result = questionBll.GetPageList(m => m.UploadUserId == userId && placeIds.Contains(m.PropertyPlaceId), "UploadTime", false, pageIndex).Select(q => new { Id = q.Id, Title = q.Title, Desc = string.IsNullOrEmpty(q.Desc) ? "" : q.Desc, Status = q.Status, StatusImage = q.Status == 0 ? "/Images/WeiXin/unhandled.png" : "/Images/WeiXin/handled.png", UploadTime = q.UploadTime, strUploadTime = q.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Imgs = string.IsNullOrEmpty(q.Imgs) ? new string[] { } : q.Imgs.Contains(";") ? q.Imgs.Split(';') : new string[] { q.Imgs }, ImgCount = string.IsNullOrEmpty(q.Imgs) ? 0 : q.Imgs.Contains(";") ? q.Imgs.Split(';').Count() : 1, AudioPath = q.AudioPath, VoiceDuration = q.VoiceDuration, PropertyName = q.PropertyPlace.Name, DisposesTime = q.Status == ConstantParam.NO_DISPOSE ? null : q.QuestionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss") }).ToList(); return(Json(model, JsonRequestBehavior.AllowGet)); }
private void BindData() { DataPage dp = new DataPage(); ProducePlan condition = new ProducePlan(); ProducePlanBLL bll = null; try { bll = BLLFactory.CreateBLL <ProducePlanBLL>(); condition.FACTORYPID = this.FACTORYPID.SelectedValue; condition.PRID = this.PRID.SelectedValue; condition.PRODUCTIONID = this.PRODUCTIONID.SelectedValue; PagerHelper.InitPageControl(this.AspNetPager1, dp, true); dp = bll.GetList(condition, dp); List <ProducePlan> list = dp.Result as List <ProducePlan>; this.GvList.DataSource = list; this.GvList.DataBind(); for (int i = 0; i < this.GvList.Rows.Count; i++) { string click = string.Format("return edit('{0}');", this.GvList.DataKeys[i]["PID"].ToString()); (this.GvList.Rows[i].Cells[7].Controls[0] as WebControl).Attributes.Add("onclick", click); } PagerHelper.SetPageControl(AspNetPager1, dp, true); } catch (Exception ex) { throw ex; } }
private void BindData() { WHSiteBLL bll = null; DataPage dp = new DataPage(); WHSite condition = new WHSite(); string whID = Request.QueryString["whID"]; try { bll = BLLFactory.CreateBLL <WHSiteBLL>(); this.hiWHID.Value = whID; condition.Code = this.Code.Text.Trim(); condition.WHID = whID; condition.Description = this.Description.Text.Trim(); PagerHelper.InitPageControl(this.AspNetPager1, dp, true); dp = bll.GetList(condition, dp); List <WHSite> list = dp.Result as List <WHSite>; this.GvList.DataSource = list; this.GvList.DataBind(); for (int i = 0; i < this.GvList.Rows.Count; i++) { string click = string.Format("return edit('{0}');", this.GvList.DataKeys[i]["ID"].ToString()); (this.GvList.Rows[i].Cells[6].Controls[0] as WebControl).Attributes.Add("onclick", click); } PagerHelper.SetPageControl(AspNetPager1, dp, true); } catch (Exception ex) { throw ex; } }
protected void btReset_Click(object sender, EventArgs e) { ProduceTrack info = new ProduceTrack(); ProduceTrackBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <ProduceTrackBLL>(); info.PID = this.hiID.Value; info.STATUS = "0"; info.WPID = this.hiGX.Value; info.EQUID = this.hiCB.Value; info.WSID = this.hiGW.Value; info.PRODUCTIONID = this.hiPid.Value; info.WORKINGSTARTTIME = DateTime.MinValue; bll.Update(info); BindData(info.PID); } catch (Exception ex) { throw ex; } }
private void InitForm() { List <DictInfo> dicts = null; //绑定仓库 List <Warehouse> whList = BLLFactory.CreateBLL <WarehouseBLL>().GetListByUserID(this.GetLoginInfo()); dicts = whList.Select(p => new DictInfo { ID = p.ID, Des = p.Description }).ToList <DictInfo>(); Tools.BindDataToDDL(this.Warehouse, dicts, null); if (whList.Count > 0) { //绑定仓位 List <WHSite> siteList = BLLFactory.CreateBLL <WHSiteBLL>().GetList(whList[0].ID); dicts = siteList.Select(p => new DictInfo { ID = p.ID, Des = p.Description }).ToList <DictInfo>(); Tools.BindDataToDDL(this.SaveSite, dicts, null); } //出库方式 List <WHOutMode> imList = BLLFactory.CreateBLL <WHOutModeBLL>().GetList(); dicts = imList.Select(p => new DictInfo { ID = p.ID, Des = p.Description }).ToList <DictInfo>(); Tools.BindDataToDDL(this.OutStockMode, dicts, null); }
public ActionResult SetShopUserInfo() { // 获取Session Model UserSessionModel model = (UserSessionModel)Session[ConstantParam.SESSION_USERINFO]; var id = model.UserID; IShopUserBLL shopUserBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL"); var userInfo = shopUserBll.GetEntity(index => index.Id == id && index.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (userInfo != null) { LoggedInAccountModel shopUserModel = new LoggedInAccountModel(); shopUserModel.UserId = userInfo.Id; shopUserModel.UserName = userInfo.UserName; shopUserModel.TrueName = userInfo.TrueName; shopUserModel.Phone = userInfo.Phone; shopUserModel.Email = userInfo.Email; shopUserModel.Memo = userInfo.Memo; shopUserModel.HeadPath = userInfo.HeadPath; return(View(shopUserModel)); } else { return(RedirectToAction("Index", "ShopPlatform")); } }
public ActionResult EditShopUser(int id) { IShopUserBLL shopUserBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL"); //获取要编辑的门店用户 T_ShopUser shopUser = shopUserBll.GetEntity(m => m.Id == id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (shopUser != null) { //初始化返回页面的模型 ShopUserModel model = new ShopUserModel() { Id = shopUser.Id, UserName = shopUser.UserName, TrueName = shopUser.TrueName, Phone = shopUser.Phone, Gender = shopUser.Gender, GenderList = GetGenderList(), Email = shopUser.Email, Memo = shopUser.Memo }; return(View(model)); } else { return(RedirectToAction("ShopUserList")); } }
private void BindData() { string id = Request.QueryString["id"]; WorkStationBLL bll = null; WorkStation info = new WorkStation(); try { bll = BLLFactory.CreateBLL <WorkStationBLL>(); if (string.IsNullOrEmpty(id) == false) { info.PID = id; info = bll.Get(info); UIBindHelper.BindForm(this.Page, info); this.hiID.Value = info.PID; this.HiCREATEUSER.Value = info.CREATEUSER; this.HiCREATETIME.Value = info.CREATETIME.ToString(); } else { info = new WorkStation(); } } catch (Exception ex) { throw ex; } }
public JsonResult AddShopUser(ShopUserModel Model) { JsonModel jm = new JsonModel(); //如果表单验证成功 if (ModelState.IsValid) { IShopUserBLL shopUserBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL"); T_ShopUser shopUser = new T_ShopUser() { UserName = Model.UserName, TrueName = Model.TrueName, Phone = Model.Phone, Gender = Model.Gender, Email = Model.Email, Password = PropertyUtils.GetMD5Str(Model.Password), Memo = Model.Memo }; //保存到数据库 shopUserBll.Save(shopUser); //日志记录 jm.Content = PropertyUtils.ModelToJsonString(Model); } else { //保存异常日志 jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
protected void btSave_Click(object sender, EventArgs e) { WorkStation info = new WorkStation(); WorkStationBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <WorkStationBLL>(); if (this.hiID.Value == "") { bll.Insert(info); } else { info.CREATEUSER = this.HiCREATEUSER.Value; info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value); info.PID = this.hiID.Value; bll.Update(info); } ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true); } catch (Exception ex) { throw ex; } }
private void InitForm() { Tools.SetDateTimeControl(this.StartDate); Tools.SetDateTimeControl(this.EndDate); List <DictInfo> dicts = null; //工厂 List <FactoryInfo> fList = BLLFactory.CreateBLL <FactoryInfoBLL>().GetList(); dicts = fList.Select(p => new DictInfo { ID = p.PID, Des = p.PNAME }).ToList <DictInfo>(); Tools.BindDataToDDL(this.Factory, dicts, Tools.QueryDDLFirstItem); //生产线 List <ProductLine> plList = BLLFactory.CreateBLL <ProductLineBLL>().GetList(); dicts = plList.Select(p => new DictInfo { ID = p.PID, Des = p.PLNAME }).ToList <DictInfo>(); Tools.BindDataToDDL(this.ProductLine, dicts, Tools.QueryDDLFirstItem); //产品 List <ProductInfo> piList = BLLFactory.CreateBLL <ProductInfoBLL>().GetList(); dicts = piList.Select(p => new DictInfo { ID = p.PID, Des = p.PNAME }).ToList <DictInfo>(); Tools.BindDataToDDL(this.Product, dicts, Tools.QueryDDLFirstItem); }
/// <summary> /// 删除指定物业用户 /// </summary> /// <returns></returns> public ActionResult DeleteUser(int?id) { JsonModel jm = new JsonModel(); //参数校验 if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } IPropertyUserBLL propertyUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); // 根据指定id值获取实体对象 var userInfo = propertyUserBll.GetEntity(index => index.Id == id && index.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (userInfo != null) { // 修改指定用户记录中的已删除标识 userInfo.DelFlag = ConstantParam.DEL_FLAG_DELETE; propertyUserBll.Update(userInfo); //操作日志 jm.Content = "删除物业用户 " + userInfo.TrueName; } else { jm.Msg = "该用户不存在"; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
public ActionResult EditNews(CompanyNoticeModel model) { JsonModel jm = new JsonModel(); //如果表单模型验证成功 if (ModelState.IsValid) { ICompanyPostBLL postBll = BLLFactory <ICompanyPostBLL> .GetBLL("CompanyPostBLL"); T_CompanyPost newPost = postBll.GetEntity(m => m.Id == model.PostId && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (newPost != null) { newPost.Title = model.Title; newPost.Content = model.Content; newPost.PublishStatus = model.PublishedFlag ? 1 : 0; newPost.IsOpen = model.IsOpen ? 1 : 0; } ; if (model.PublishedFlag) { newPost.PublishedTime = DateTime.Now; } // 保存到数据库,如果修改成功 if (postBll.Update(newPost)) { //如果已发布并公开 if (model.PublishedFlag && model.IsOpen) { //推送给物业客户端 IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); var PropertyUserIds = userBll.GetList(u => u.PropertyPlace.CompanyId == newPost.CompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT).Select(u => u.Id); if (PropertyUserIds != null) { PropertyUserIds = PropertyUserIds.ToList(); } IPropertyUserPushBLL propertyUserPushBLL = BLLFactory <IPropertyUserPushBLL> .GetBLL("PropertyUserPushBLL"); var propertyRegistrationIds = propertyUserPushBLL.GetList(p => PropertyUserIds.Contains(p.UserId)).Select(p => p.RegistrationId).ToArray(); bool flag = PropertyUtils.SendPush("总公司新闻公告", model.Title, ConstantParam.MOBILE_TYPE_PROPERTY, propertyRegistrationIds); if (!flag) { jm.Msg = "推送发生异常"; } } //日志记录 jm.Content = PropertyUtils.ModelToJsonString(model); } else { jm.Msg = "新闻公告编辑失败"; } } else { // 保存异常日志 jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
public ActionResult ResetPassword(int?id) { JsonModel jm = new JsonModel(); //参数校验 if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } IPropertyUserBLL propertyUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); // 根据指定id值获取实体对象 var userInfo = propertyUserBll.GetEntity(index => index.Id == id && index.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (userInfo != null) { Random r = new Random(); int radVal = r.Next(100, 1000); userInfo.Password = PropertyUtils.GetMD5Str(userInfo.UserName + radVal); // 恢复初始密码值 propertyUserBll.Update(userInfo); // 给物业用户发送邮件 PropertyUtils.SendEmail(userInfo.Email, userInfo.UserName, "物业生活管理系统 用户密码重置", "您的用户密码已重置为" + userInfo.UserName + radVal + ", 请及时修改密码!"); //操作日志 jm.Content = "物业用户" + userInfo.TrueName + "密码一键重置成功"; } else { jm.Msg = "该用户不存在"; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
public ActionResult ConfigAuth(int id) { RoleAuthModel model = new RoleAuthModel(); IPropertyRoleBLL propertyRoleBll = BLLFactory <IPropertyRoleBLL> .GetBLL("PropertyRoleBLL"); //获取要分配角色的物业角色 T_PropertyRole role = propertyRoleBll.GetEntity(m => m.Id == id); IMenuBLL menuBll = BLLFactory <IMenuBLL> .GetBLL("MenuBLL"); //获取所有的菜单 var menuList = menuBll.GetList(m => m.MenuFlag == ConstantParam.MENU_LEFT && m.IsPlatform == ConstantParam.USER_TYPE_PROPERTY && m.ParentId == null).OrderBy(m => m.Order).ToList(); //Model赋值菜单列表 model.MenuList = menuList; //Model赋值要分配角色的物业角色 model.Role = new RoleModel() { RoleId = role.Id, RoleName = role.RoleName, RoleMemo = role.RoleMemo }; //获取该角色已经有的权限ID集合 model.ActionIds = role.PropertyRoleActions.Select(m => m.ActionId).ToList(); return(View(model)); }
public ActionResult ScanRole(int id) { // 创建物业用户角色模型 PropertyUserRoleModel userRoleModel = new PropertyUserRoleModel(); IPropertyUserBLL propertyUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); // 根据指定id值获取实体对象 var userInfo = propertyUserBll.GetEntity(index => index.Id == id && index.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); userRoleModel.User = new PropertyUserModel() { UserName = userInfo.UserName, UserId = userInfo.Id, TrueName = userInfo.TrueName }; // 获取用户已分配的角色id列表 var selectedRoleList = userInfo.PropertyUserRoles.Select(m => m.RoleId).ToList(); userRoleModel.RoleIds = selectedRoleList; // 获取所有物业角色 IPropertyRoleBLL propertyRoleBll = BLLFactory <IPropertyRoleBLL> .GetBLL("PropertyRoleBLL"); //排序 var sortModel = this.SettingSorting("Id", false); var roleList = propertyRoleBll.GetList(p => true, sortModel.SortName, sortModel.IsAsc).ToList(); userRoleModel.RoleList = roleList; return(View(userRoleModel)); }
private void BindData() { string Id = Request.QueryString["Id"]; InspectItemBLL bll = null; InspectItemEntity info = new InspectItemEntity(); try { bll = BLLFactory.CreateBLL <InspectItemBLL>(); if (string.IsNullOrEmpty(Id) == false) { info.Id = Id; info = bll.Get(info); UIBindHelper.BindForm(this.Page, info); this.hiID.Value = info.Id; this.ItemCode.Text = info.ItemCode; this.ItemName.Text = info.ItemName; this.Unit.Text = info.Unit; this.PointCount.Text = info.PointCount + ""; this.Remark.Text = info.Remark; this.HiCREATEUSER.Value = info.CreateUser; this.HiCREATETIME.Value = info.CreateTime.ToString(); } else { info = new InspectItemEntity(); } } catch (Exception ex) { throw ex; } }
public ActionResult AddUser(PropertyUserModel model) { JsonModel jm = new JsonModel(); //如果表单模型验证成功 if (ModelState.IsValid) { IPropertyUserBLL propertyUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); T_PropertyUser propertyUser = new T_PropertyUser() { UserName = model.UserName, TrueName = model.TrueName, Password = PropertyUtils.GetMD5Str(model.Password), Memo = model.Memo, Tel = model.Tel, Phone = model.Phone, Email = model.Email, PropertyPlaceId = GetSessionModel().PropertyPlaceId.Value }; // 保存到数据库 propertyUserBll.Save(propertyUser); //日志记录 jm.Content = PropertyUtils.ModelToJsonString(model); } else { // 保存异常日志 jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
private void BindData() { MatTypeBLL bll = null; DataPage dp = new DataPage(); MatType condition = new MatType(); try { bll = BLLFactory.CreateBLL <MatTypeBLL>(); condition.Description = this.Description.Text; PagerHelper.InitPageControl(this.AspNetPager1, dp, true); dp = bll.GetList(condition, dp); List <MatType> list = dp.Result as List <MatType>; this.GvList.DataSource = list; this.GvList.DataBind(); for (int i = 0; i < this.GvList.Rows.Count; i++) { string click = string.Format("return edit('{0}');", this.GvList.DataKeys[i]["ID"].ToString()); (this.GvList.Rows[i].Cells[3].Controls[0] as WebControl).Attributes.Add("onclick", click); } PagerHelper.SetPageControl(AspNetPager1, dp, true); } catch (Exception ex) { throw ex; } }
public ActionResult UserResetPassword(UserPassResetModel model) { //判断提交模型数据是否正确 if (!ModelState.IsValid) { return(View(model)); } IUserBLL userBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); var user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果重置密码激活码存在且未失效 if (!string.IsNullOrEmpty(user.Activecode) && model.Activecode == user.Activecode && user.ActivecodeInvalidTime != null && DateTime.Now < user.ActivecodeInvalidTime.Value) { user.Password = PropertyUtils.GetMD5Str(model.Password); //密码重置链接失效 user.Activecode = ""; user.ActivecodeInvalidTime = null; //如果修改成功 if (userBll.Update(user)) { return(RedirectToAction("ResetSuccess")); } } } return(RedirectToAction("Error500")); }