public static List <SPBindMenuByUserType_Result> BindMenu(string UserTypeID) { List <SPBindMenuByUserType_Result> Data = new List <SPBindMenuByUserType_Result>(); Data = new HomeBusiness().BindMenu(UserTypeID); return(Data); }
public async Task <ActionResult> GetPersonAsync() { HomeBusiness homeBusiness = new HomeBusiness(); List <Pessoa> person = await homeBusiness.GetPersonAsync(); return(Json(new { personResult = person }, JsonRequestBehavior.AllowGet)); }
public ActionResult InitJurisdiction(string userId) { var model = new JurisdictionEditViewModel { RoleGroupList = new List <RoleGroupDic>(), }; var userinfo = HomeBusiness.GetUserById(long.Parse(EncryptHelper.DesDecrypt(userId))); if (userinfo != null) { model.UserId = userId; model.Username = userinfo.BUName; model.Jobnumber = userinfo.BUJobNumber; var relationinfo = JurisdictionBusiness.GetUserRoleRelationByUserId(long.Parse(EncryptHelper.DesDecrypt(userId))); if (relationinfo != null) { foreach (var roloGroup in relationinfo) { var roloGroupInfo = JurisdictionBusiness.GetGroupById(roloGroup.BURGroupId); if (roloGroupInfo != null) { var dic = new RoleGroupDic(); dic.RoleGroupId = EncryptHelper.DesEncrypt(roloGroup.BURGroupId.ToString()); dic.RoleGroupName = roloGroupInfo.BGName; model.RoleGroupList.Add(dic); } } } } return(Json(model, JsonRequestBehavior.AllowGet)); }
public ActionResult Login(string account, string password, int DBType) { var msg = string.Empty; var success = false; Session[SessionKey.SESSION_KEY_DBINFO] = DBType; try { var result = HomeBusiness.Login(account, password); //写入cookie string key = CommonHelper.Md5(CookieKey.COOKIE_KEY_USERINFO); string data = JsonHelper.Serializer <UserLoginInfo>(result); CookieHelper.SetCookie( key, CommonHelper.DesEncrypt(data, CookieKey.COOKIE_KEY_ENCRYPT), DateTime.Now.AddDays(1).Date, ServerInfo.GetTopDomain); success = true; } catch (Exception ex) { msg = ex.Message; } return(Json(new { Success = success, Message = msg })); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; try { if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["dbTyPe"])) { var dbtype = HttpContext.Current.Request.QueryString["dbTyPe"]; //HttpContext.Current.Session[SessionKey.SESSION_KEY_DBINFO] = dbtype; context.Session[SessionKey.SESSION_KEY_DBINFO] = dbtype; } else { context.Response.Write("Plese Check dbType"); return; } HomeBusiness.InitialManager(); context.Response.Write("Initial Success"); } catch (Exception ex) { context.Response.Write(ex.Message); } //初始化管理员账号 }
/// <summary> /// 描述:初始化用户信息 /// </summary> /// <param name="userId"></param> /// <returns></returns> public ActionResult InitAdUser(string userId) { long userIdlong = long.Parse(EncryptHelper.DesDecrypt(userId)); var userInfo = HomeBusiness.GetUserAndAccountById(userIdlong); var userView = new UserView(); if (userInfo != null) { userView.UserId = EncryptHelper.DesEncrypt(userInfo.Id.ToString()); userView.BUName = userInfo.BUName; userView.BUJobNumber = userInfo.BUJobNumber; userView.BUSex = userInfo.BUSex ?? 0; userView.BUAvatars = userInfo.BUAvatars; userView.AvatarsUrl = userInfo.AvatarsUrl; userView.BUPhoneNum = userInfo.BUPhoneNum; userView.BUEmail = userInfo.BUEmail; userView.DepartId = EncryptHelper.DesEncrypt(userInfo.BUDepartId.ToString()); userView.BUTitle = userInfo.BUTitle; userView.BUIsValid = userInfo.BUIsValid; userView.BUDepartName = userInfo.BUDepartName; userView.BUEnglishName = userInfo.BUEnglishName; userView.BUPosition = userInfo.BUPosition; userView.BUExtensionPhone = userInfo.BUExtensionPhone; userView.BUMobilePhone = userInfo.BUMobilePhone; userView.Account = userInfo.Account; userView.IsExistAccount = string.IsNullOrEmpty(userView.Account) ? false : true; } return(Json(userView, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteUser(string UserId) { var userId = Convert.ToInt32(EncryptHelper.DesDecrypt(UserId)); var result = HomeBusiness.DeleteUser(userId, this.LoginUser); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Reset(string account, string password) { var result = new ResultInfoModel { IsSuccess = false }; try { var accontInfo = HomeBusiness.RestAccount(account, password, this.LoginUser); var login = HomeBusiness.Login(account, password); //写入cookie string key = CommonHelper.Md5(CookieKey.COOKIE_KEY_USERINFO); string data = JsonHelper.Serializer <UserLoginInfo>(login); CookieHelper.SetCookie( key, CommonHelper.DesEncrypt(data, CookieKey.COOKIE_KEY_ENCRYPT), DateTime.Now.AddDays(1).Date, ServerInfo.GetTopDomain); result.IsSuccess = accontInfo.IsSuccess; result.Message = accontInfo.Message; } catch (Exception ex) { result.Message = ex.Message; } return(Json(result)); }
public ActionResult InitInitJurisdictionRoleGroup(string groupId) { var model = new JurisdictionByRoleGroupEditViewModel { UserList = new List <UserDic>(), }; var groupInfo = JurisdictionBusiness.GetGroupById(long.Parse(EncryptHelper.DesDecrypt(groupId))); if (groupInfo != null) { model.GroupId = groupId; model.GroupName = groupInfo.BGName; var relationinfo = JurisdictionBusiness.GetUserRoleRelationByGroupId(long.Parse(EncryptHelper.DesDecrypt(groupId))); if (relationinfo != null) { foreach (var rolegroup in relationinfo) { var userInfo = HomeBusiness.GetUserById(rolegroup.BURUserId); if (userInfo != null) { var dic = new UserDic(); dic.UserName = userInfo.BUName; dic.userId = EncryptHelper.DesEncrypt(userInfo.Id.ToString()); dic.JobNumber = userInfo.BUJobNumber; model.UserList.Add(dic); } } } } return(Json(model, JsonRequestBehavior.AllowGet)); }
public ActionResult GetPerson() { HomeBusiness homeBusiness = new HomeBusiness(); List <Pessoa> person = homeBusiness.GetPerson(); return(Json(new { personResult = person }, JsonRequestBehavior.AllowGet)); }
public HomeController(ILogger <HomeController> logger, ApplicationDbContext context, UserManager <IdentityUser> userManager, IConfiguration configuration) { _logger = logger; _context = context; _userManager = userManager; _homeBusiness = new HomeBusiness(context); this.configuration = configuration; }
public Data_Test() { khachHang_MotDoanDTOs = models.KhachHangs.Where(kh => kh.MaDoan.Equals("1597352230776")).Select(kh => new KhachHangDTO { ID = kh.ID, HoVaTen = kh.HoVaTen, SoDienThoai = kh.SoDienThoai, Email = kh.Email, DiaChi = kh.DiaChi, Nhom = kh.Nhom, NguoiDaiDienCuaTreEm = kh.NguoiDaiDienCuaTreEm, ThoiGianNhan = kh.ThoiGianNhan, ThoiGianTra = kh.ThoiGianTra, MaDoan = kh.MaDoan, GioiTinh = kh.GioiTinh, LoaiKhachHang = kh.LoaiKhachHang, TruongDoan = kh.TruongDoan, IsDelete = kh.IsDelete, TrangThaiDatPhong = kh.TrangThaiDatPhong, IDPhong = kh.IDPhong, TrangThaiXacNhan = kh.TrangThaiXacNhan }).ToList(); khachHangDTOs = models.KhachHangs.Where(kh => kh.TrangThaiDatPhong >= 0 && kh.IsDelete != true).Select(kh => new KhachHangDTO { ID = kh.ID, HoVaTen = kh.HoVaTen, SoDienThoai = kh.SoDienThoai, Email = kh.Email, DiaChi = kh.DiaChi, Nhom = kh.Nhom, NguoiDaiDienCuaTreEm = kh.NguoiDaiDienCuaTreEm, ThoiGianNhan = kh.ThoiGianNhan, ThoiGianTra = kh.ThoiGianTra, MaDoan = kh.MaDoan, GioiTinh = kh.GioiTinh, LoaiKhachHang = kh.LoaiKhachHang, TruongDoan = kh.TruongDoan, IsDelete = kh.IsDelete, TrangThaiDatPhong = kh.TrangThaiDatPhong, IDPhong = kh.IDPhong, TrangThaiXacNhan = kh.TrangThaiXacNhan }).ToList(); phongDTOs = models.Phongs.Where(p => p.IsDelete != true).Select(p => new PhongDTO { ID = p.ID, MaPhong = p.MaPhong, SoPhong = p.SoPhong, LoaiPhong = p.LoaiPhong, Gia = p.Gia, TrangThai = p.TrangThai, IsDelete = p.IsDelete }).ToList(); idPhong = 236; nhanvien = new NhanVienBusiness(); home = new HomeBusiness(); khachhang = new KhachHangBusiness(); }
//TODO:CPF public ActionResult AdSetDepartments() { //获取根部门 var rootDepartment = HomeBusiness.GetRootDepartment(); ViewBag.RootDepartment = rootDepartment; return(View(rootDepartment)); }
public ActionResult UpdateDepartmentValid(string Id) { var result = new ResultInfoModel(); if (!string.IsNullOrEmpty(Id)) { result = HomeBusiness.UpdateDepartmentValid(EncryptHelper.DesDecrypt(Id), this.LoginUser); } return(Json(result)); }
public ActionResult DepartmentEdit(string id) { if (!string.IsNullOrEmpty(id)) { int dpId = Convert.ToInt32(EncryptHelper.DesDecrypt(id)); var model = HomeBusiness.GetDepartById(dpId); return(Json(model, JsonRequestBehavior.AllowGet)); } return(View(new DepartmentInfo())); }
public List <SubCategoryModel> GetSubCategoryList(CategoryModel objCategoryModel) { try { using (HomeBusiness objHomeBusiness = new HomeBusiness()) { return(objHomeBusiness.GetSubCategoryListsBusiness(objCategoryModel)); } } catch (Exception ex) { throw; } }
public ActionResult UserSearch(UserSearchViewModel search) { var total = 0; var result = HomeBusiness.SearchUser(search, out total); var page = new Page(total, search.CurrentPage); var resultModel = new UserSearchRsultModel { Models = result, Page = page }; return(View(resultModel)); }
public HomeController(UserManager <ApplicationUser> userManager, IHttpContextAccessor httpContextAccessor, MardisContext mardisContext, ILogger <HomeController> logger, IMenuService menuService, IDataProtectionProvider protectorProvider ) : base(userManager, httpContextAccessor, mardisContext, logger) { _protector = protectorProvider.CreateProtector(GetType().FullName); _protectorCampaign = protectorProvider.CreateProtector("Mardis.Engine.Web.Controllers.CampaignController"); _menuBusiness = new MenuBusiness(mardisContext); _campaignBusiness = new CampaignBusiness(mardisContext); _homeBusiness = new HomeBusiness(mardisContext); }
public ActionResult DepartmentSave(DepartmentSaveModel model) { model.ParentId = EncryptHelper.DesDecrypt(model.ParentId); ResultInfoModel result; if (!string.IsNullOrEmpty(model.DepartId)) //编辑· { model.DepartId = EncryptHelper.DesDecrypt(model.DepartId); result = HomeBusiness.SaveDepartment(model, this.LoginUser);//todo } else //新增 { result = HomeBusiness.SaveNewDepartment(model, this.LoginUser); } return(Json(result)); }
/// <summary> /// 描述:重置用户密码 /// </summary> /// <param name="userid">用户Id</param> /// <returns></returns> public ActionResult RestPassByUserid(string userId) { var result = new ResultInfoModel { IsSuccess = false }; try { result = HomeBusiness.RestAccountByUserid(userId, LoginUser); } catch (Exception ex) { result.Message = ex.Message; } return(Json(result)); }
public ActionResult JurisdictionSearch(UserSearchViewModel usersearch) { //分页获取所有的用户信息 var total = 0; var result = HomeBusiness.SearchUser(usersearch, out total); var page = new Page(total, usersearch.CurrentPage); var list = new List <JurisdictionIndexViewModel>(); foreach (var item in result) { var viewModel = new JurisdictionIndexViewModel { UserId = item.UserId, Username = item.BUName, Jobnumber = item.BUJobNumber, Position = item.BUTitle, }; //根据用户id去资源权限分类表查询资源信息 var relationinfo = JurisdictionBusiness.GetUserRoleRelationByUserId(long.Parse(EncryptHelper.DesDecrypt(item.UserId.ToString()))); if (relationinfo != null) { foreach (var roloGroup in relationinfo) { var roloGroupInfo = JurisdictionBusiness.GetGroupById(roloGroup.BURGroupId); if (roloGroupInfo != null) { viewModel.RoleGroup += roloGroupInfo.BGName + ","; } } if (viewModel.RoleGroup != null && viewModel.RoleGroup.Length > 0) { viewModel.RoleGroup = viewModel.RoleGroup.Substring(0, viewModel.RoleGroup.Length - 1); } } list.Add(viewModel); } var resultModel = new JurisdictionSearchModel() { Models = list, Page = page }; return(View(resultModel)); }
public ActionResult GetRoleCode() { //判断是否是管理员 if (HomeBusiness.IsAdmin(LoginUser.UserId)) { return(Json("isadmin", JsonRequestBehavior.AllowGet)); } var list = JurisdictionBusiness.GetAllRoleCodeByUserid(LoginUser); if (list != null) { return(Json(list, JsonRequestBehavior.AllowGet)); } else { return(Json(string.Empty, JsonRequestBehavior.AllowGet)); } }
public static void Menu() { do { Console.Clear(); Console.WriteLine("###### Escolha a opção desejada #####"); Console.WriteLine(" 1 - Cadastro de Função: "); Console.WriteLine(" 2 - Cadastro de Funcionário: "); Console.WriteLine(" 3 - Listar Funcionarios "); Console.WriteLine(" 4 - Fechar"); Console.Write("Qual a opção desejada: "); HomeBusiness homeController = new HomeBusiness(); homeController.MenuSelecao(); } while (true); }
public ActionResult JurisdictionRolePackageSearch(RoleSearchViewModel rolesearch) { //分页获取所有的角色信息 var total = 0; var result = JurisdictionBusiness.SearchRole(rolesearch, out total); var page = new Page(total, rolesearch.CurrentPage); var list = new List <JurisdictionRoleGroupIndexViewModel>(); foreach (var item in result) { var viewModel = new JurisdictionRoleGroupIndexViewModel { GroupId = item.RoleId, GroupName = item.Rolename, GroupCode = item.RoleCode, }; //根据用户id去资源权限分类表查询资源信息 var relationinfo = JurisdictionBusiness.GetUserRoleRelationByGroupId(long.Parse(EncryptHelper.DesDecrypt(item.RoleId.ToString()))); if (relationinfo != null) { foreach (var roloGroup in relationinfo) { var userInfo = HomeBusiness.GetUserById(roloGroup.BURUserId); if (userInfo != null) { viewModel.UserInfo += userInfo.BUName + "(" + userInfo.BUJobNumber + ")" + ","; } } if (viewModel.UserInfo != null && viewModel.UserInfo.Length > 0) { viewModel.UserInfo = viewModel.UserInfo.Substring(0, viewModel.UserInfo.Length - 1); } } list.Add(viewModel); } var resultModel = new JurisdictionRoleGroupSearchModel() { Models = list, Page = page }; return(View(resultModel)); }
public FileResult UserExcel(UserSearchViewModel searchModel) { searchModel.PageSize = 1000; var totalCount = 0; var result = HomeBusiness.SearchUser(searchModel, out totalCount).ToList(); NPOI.HSSF.UserModel.HSSFWorkbook book = new NPOI.HSSF.UserModel.HSSFWorkbook(); NPOI.SS.UserModel.ISheet sheet1 = book.CreateSheet("Sheet1"); //给sheet1添加第一行的头部标题 NPOI.SS.UserModel.IRow row1 = sheet1.CreateRow(0); row1.CreateCell(0).SetCellValue("DepartName"); row1.CreateCell(1).SetCellValue("Position"); row1.CreateCell(2).SetCellValue("EnglishName"); row1.CreateCell(3).SetCellValue("ChineseName"); row1.CreateCell(4).SetCellValue("Account"); row1.CreateCell(5).SetCellValue("PhoneNum"); row1.CreateCell(6).SetCellValue("ExtensionPhone"); row1.CreateCell(7).SetCellValue("MobilePhone"); row1.CreateCell(8).SetCellValue("Email"); for (int i = 0; i < result.Count(); i++) { NPOI.SS.UserModel.IRow rowtemp = sheet1.CreateRow(i + 1); rowtemp.CreateCell(0).SetCellValue(result[i].BUDepartName); rowtemp.CreateCell(1).SetCellValue(result[i].BUPosition); rowtemp.CreateCell(2).SetCellValue(result[i].BUEnglishName); rowtemp.CreateCell(3).SetCellValue(result[i].BUName); rowtemp.CreateCell(4).SetCellValue(result[i].Account); rowtemp.CreateCell(5).SetCellValue(result[i].BUPhoneNum); rowtemp.CreateCell(6).SetCellValue(result[i].BUExtensionPhone); rowtemp.CreateCell(7).SetCellValue(result[i].BUMobilePhone); rowtemp.CreateCell(8).SetCellValue(result[i].BUEmail); } // 写入到客户端 System.IO.MemoryStream ms = new System.IO.MemoryStream(); book.Write(ms); ms.Seek(0, SeekOrigin.Begin); var exportFileName = string.Format("{0}{1}.xls", "UserInfo", DateTime.Now.ToString("yyyyMMddHHmmss")); return(File(ms, "application/vnd.ms-excel", exportFileName)); }
public ActionResult AdUser(string userId = "") { var dpList = new List <SelectListItem>(); var list = HomeBusiness.GetAllDepartmentName(); if (list != null & list.Count > 0) { foreach (var dp in list) { var item = new SelectListItem(); item.Text = dp.text; item.Value = dp.id; dpList.Add(item); } } ViewBag.dpList = dpList; ViewBag.userId = userId; return(View()); }
public ActionResult Login(string account, string password, string dbtype) { var msg = string.Empty; var success = false; try { if (!string.IsNullOrEmpty(dbtype)) { Session.Timeout = 1440; Session[SessionKey.SESSION_KEY_DBINFO] = dbtype; } else { return(RedirectToAction("LoginPage")); } var result = HomeBusiness.Login(account, password); //写入cookie string key = CommonHelper.Md5(CookieKey.COOKIE_KEY_USERINFO); string data = JsonHelper.Serializer <UserLoginInfo>(result); CookieHelper.SetCookie( key, CommonHelper.DesEncrypt(data, HomeContent.CookieKeyEncrypt), DateTime.Now.AddDays(1).Date, ServerInfo.GetTopDomain); //写入权限信息 var list = JurisdictionBusiness.GetAllRoleCodeByUserid(LoginUser); string roleKey = CommonHelper.Md5(CookieKey.COOKIE_KEY_ROLEINFO); string roleData = JsonHelper.Serializer <List <string> >(list); CookieHelper.SetCookie(roleKey, CommonHelper.DesEncrypt(roleData, CookieKey.COOKIE_KEY_ENCRYPT), DateTime.Now.AddDays(1).Date, ServerInfo.GetTopDomain); success = true; } catch (Exception ex) { msg = ex.Message; } return(Json(new { Success = success, Message = msg })); }
public void SendNotification(string lead_id_encrypted) { List <HomeVM> homeVMList = new List <HomeVM>(); List <HomeModel> homeModelList = new List <HomeModel>(); RealTimeNotificationBusiness realTimeNotificationBusiness = new RealTimeNotificationBusiness(unitOfWork); HomeBusiness homeBusiness = new HomeBusiness(unitOfWork); LeadAuditBusiness leadAuditBusiness = new LeadAuditBusiness(unitOfWork); int maxLeadAuditId = 0; int companyid = Convert.ToInt32(Context.User.Identity.Name.Split(new[] { '|' })[1]); int curentuserid = Convert.ToInt32(Context.User.Identity.Name.Split(new[] { '|' })[0]); List <int?> realTimeNotificationId = realTimeNotificationBusiness.GetNotifyClientByCompanyId(companyid, curentuserid, lead_id_encrypted.Decrypt(), ref maxLeadAuditId); homeModelList = homeBusiness.GetRecentActivitiesForHome(1, 1, maxLeadAuditId, false, 0, 0); AutoMapper.Mapper.Map(homeModelList, homeVMList); foreach (int userid in realTimeNotificationId) { Clients.User(userid.Encrypt()).NewNotification(new { RecentActivities = homeVMList.Select(x => new { CreatedBy = x.CreatedBy, ImageURL = x.ImageURL, LeadAuditId = x.LeadAuditId, ActivityText = x.ActivityText, ActivityCreatedTime = x.ActivityCreatedTime }), MaxLeadAuditID = maxLeadAuditId.Encrypt() }); } }
/// <summary> /// 描述:新建部门 /// </summary> /// <param name="departmentId">部门Id</param> /// <param name="level">level为1表示新建平级部门</param> /// <returns></returns> public ActionResult DepartmentCreate(string departmentId, int level) { if (!string.IsNullOrEmpty(departmentId)) { int dpId = Convert.ToInt32(EncryptHelper.DesDecrypt(departmentId)); DepartmentInfo model; if (level == 1) //1表示新建平级 { model = HomeBusiness.GetDepartById(dpId); } else { model = HomeBusiness.GetDepartById(dpId); model.ParentId = model.Id; model.ParentName = model.Name; } return(Json(model, JsonRequestBehavior.AllowGet)); } return(View()); }
/// <summary> /// 描述:初始化用户信息 /// </summary> /// <param name="userId"></param> /// <returns></returns> public ActionResult InitAdUser(string userId) { long userIdlong = long.Parse(EncryptHelper.DesDecrypt(userId)); var userInfo = HomeBusiness.GetUserById(userIdlong); var userView = new UserView(); if (userInfo != null) { userView.UserId = EncryptHelper.DesEncrypt(userInfo.Id.ToString()); userView.BUSurname = userInfo.BUSurname; userView.BUGivenname = userInfo.BUGivenname; userView.BUJobNumber = userInfo.BUJobNumber; userView.BUSex = userInfo.BUSex; userView.BUAvatars = userInfo.BUAvatars; userView.BUPhoneNum = userInfo.BUPhoneNum; userView.BUEmail = userInfo.BUEmail; userView.DepartId = EncryptHelper.DesEncrypt(userInfo.BUDepartId.ToString()); userView.BUTitle = userInfo.BUTitle; userView.BUIsValid = userInfo.BUIsValid; } return(Json(userView, JsonRequestBehavior.AllowGet)); }