//public WxApp GetEntityByAppId(string appId) //{ // var specification = new Specification<WxApp>(p => p.AppId == appId); // WxApp wxApp = wxAppRepository.Find(specification); // return wxApp; //} public void SubmitForm(WxImageInputDto wxImageInputDto, string keyValue) { WxImage wxImage = new WxImage(); string appId = WxOperatorProvider.Provider.GetCurrent().AppId; if (!string.IsNullOrEmpty(keyValue)) { var id = Convert.ToInt64(keyValue); wxImage = wxImageRepository.Get(id); //AutoMapper.Mapper.Map<WxImageInputDto, WxImage>(wxImageInputDto, wxImage); wxImage.FileName = wxImageInputDto.FileName; wxImage.LastModificationTime = DateTime.Now; wxImageRepository.Update(wxImage); } else { AutoMapper.Mapper.Map <WxImageInputDto, WxImage>(wxImageInputDto, wxImage); wxImage.Id = IdWorkerHelper.GenId64(); wxImage.AppId = appId; wxImage.DeletedMark = false; wxImage.CreationTime = DateTime.Now; wxImage.CreatorUserId = 1; wxImageRepository.Add(wxImage); } }
public void Subscribe(string toUserName, string fromUserName, DateTime subscribeTime) { var wxOfficialSpecification = new Specification <WxOfficial>(p => p.Account == toUserName); WxOfficial wxOfficial = wxOfficialRepository.Find(wxOfficialSpecification); var wxUserSpecification = new Specification <WxUser>(p => p.AppId == wxOfficial.AppId && p.OpenId == fromUserName); WxUser wxUser = wxUserRepository.Find(wxUserSpecification); if (wxUser == null) { wxUser = new WxUser(); wxUser.Id = IdWorkerHelper.GenId64(); wxUser.AppId = wxOfficial.AppId; wxUser.OpenId = fromUserName; wxUser.SubscribeTime = subscribeTime; wxUser.SubscribeStatus = 1; wxUserRepository.Add(wxUser); } else { wxUser.SubscribeStatus = 1; wxUser.SubscribeTime = subscribeTime; wxUserRepository.Update(wxUser); } }
//public List<AreaGridDto> GetList() //{ // var specification = new Specification<Area>(u => u.DeletedMark == false); // var sortingOtopns = new SortingOptions<Area, int?>(x => x.SortCode, isDescending: false); // var list = areaRepository.FindAll(specification, sortingOtopns).ToList(); // return Mapper.Map<List<AreaGridDto>>(list); //} //public AreaOutputDto GetForm(string keyValue) //{ // var id = Convert.ToInt64(keyValue); // AreaOutputDto areaOutputDto = new AreaOutputDto(); // Area area = areaRepository.Get(id); // AutoMapper.Mapper.Map<Area, AreaOutputDto>(area, areaOutputDto); // return areaOutputDto; //} public void SubmitForm(AttachInputDto attachInputDto, string keyValue) { Attach attach = new Attach(); if (!string.IsNullOrEmpty(keyValue)) { //var id = Convert.ToInt64(keyValue); //area = areaRepository.Get(id); //AutoMapper.Mapper.Map<AreaInputDto, Area>(areaInputDto, area); //area.LastModificationTime = DateTime.Now; //areaRepository.Update(area); } else { try { AutoMapper.Mapper.Map <AttachInputDto, Attach>(attachInputDto, attach); attach.Id = IdWorkerHelper.GenId64(); attach.CreationTime = DateTime.Now; attach.CreatorUserId = 1; attachRepository.Add(attach); } catch { AutoMapper.Mapper.Map <AttachInputDto, Attach>(attachInputDto, attach); attach.Id = IdWorkerHelper.GenId64(); attach.CreationTime = DateTime.Now; attach.CreatorUserId = 1; attachRepository.Add(attach); } } }
public void SubmitForm(string menuData) { string appId = WxOperatorProvider.Provider.GetCurrent().AppId; var specification = new Specification <WxMenu>(obj => obj.AppId == appId); WxMenu wxMenu = wxMenuRepository.Find(specification); if (wxMenu == null) { wxMenu = new WxMenu(); wxMenu.Id = IdWorkerHelper.GenId64(); wxMenu.AppId = appId; wxMenu.MenuData = menuData; wxMenu.CreationTime = System.DateTime.Now; wxMenu.DeletedMark = false; wxMenuRepository.Add(wxMenu); } else { wxMenu.MenuData = menuData; wxMenu.LastModificationTime = System.DateTime.Now; wxMenuRepository.Update(wxMenu); } JObject jo = (JObject)JsonConvert.DeserializeObject(menuData); JObject menu = (JObject)jo["menu"]; JArray button = (JArray)menu["button"]; Debug.WriteLine(menu.ToString()); AccessTokenResult accessTokenResult = AccessTokenContainer.GetAccessTokenResult(appId); WxJsonResult wxJsonResult = CommonApi.CreateMenu(accessTokenResult.access_token, menu); }
public void TestAsync4() { OperateLog operateLog = new OperateLog(); operateLog.Area = "hangfire"; operateLog.Controller = "OperateLog"; operateLog.Action = "TaskTest4"; operateLog.Method = "Task"; operateLog.UserId = 1035359633864265728; operateLog.UserName = "******"; operateLog.Id = IdWorkerHelper.GenId64(); operateLog.DeletedMark = false; operateLog.CreationTime = DateTime.Now; operateLogRepository.Add(operateLog); }
public void SubmitForm(LoginLogInputDto loginLogInputDto, string keyValue) { LoginLog loginLog = new LoginLog(); if (!string.IsNullOrEmpty(keyValue)) { } else { AutoMapper.Mapper.Map <LoginLogInputDto, LoginLog>(loginLogInputDto, loginLog); loginLog.Id = IdWorkerHelper.GenId64(); loginLog.DeletedMark = false; loginLog.CreationTime = DateTime.Now; loginLogRepository.Add(loginLog); } }
public void SubmitForm(OperateLogInputDto operateLogInputDto, string keyValue) { OperateLog operateLog = new OperateLog(); if (!string.IsNullOrEmpty(keyValue)) { } else { AutoMapper.Mapper.Map <OperateLogInputDto, OperateLog>(operateLogInputDto, operateLog); operateLog.Id = IdWorkerHelper.GenId64(); operateLog.DeletedMark = false; operateLog.CreationTime = DateTime.Now; operateLogRepository.Add(operateLog); } }
public void SubmitForm(DictItemInputDto dictItemInputDto, string keyValue) { DictItem dictItem = new DictItem(); if (!string.IsNullOrEmpty(keyValue)) { var id = Convert.ToInt64(keyValue); dictItem = dictItemRepository.Get(id); AutoMapper.Mapper.Map <DictItemInputDto, DictItem>(dictItemInputDto, dictItem); dictItemRepository.Update(dictItem); } else { AutoMapper.Mapper.Map <DictItemInputDto, DictItem>(dictItemInputDto, dictItem); dictItem.Id = IdWorkerHelper.GenId64(); dictItem.CreationTime = DateTime.Now; dictItem.CreatorUserId = 1; dictItemRepository.Add(dictItem); } }
public void SubmitForm(DictInputDto dictInputDto, string keyValue) { Dict dict = new Dict(); if (!string.IsNullOrEmpty(keyValue)) { long id = long.Parse(keyValue); dict = dictRepository.Get(id); AutoMapper.Mapper.Map <DictInputDto, Dict>(dictInputDto, dict); dict.LastModificationTime = DateTime.Now; dictRepository.Update(dict); } else { AutoMapper.Mapper.Map <DictInputDto, Dict>(dictInputDto, dict); dict.Id = IdWorkerHelper.GenId64(); dict.CreationTime = DateTime.Now; dictRepository.Add(dict); } }
public void SubmitForm(AreaInputDto areaInputDto, string keyValue) { Area area = new Area(); if (!string.IsNullOrEmpty(keyValue)) { var id = Convert.ToInt64(keyValue); area = areaRepository.Get(id); AutoMapper.Mapper.Map <AreaInputDto, Area>(areaInputDto, area); area.LastModificationTime = DateTime.Now; areaRepository.Update(area); } else { AutoMapper.Mapper.Map <AreaInputDto, Area>(areaInputDto, area); area.Id = IdWorkerHelper.GenId64(); area.CreationTime = DateTime.Now; area.CreatorUserId = 1; areaRepository.Add(area); } }
public void SubmitForm(OrganizeInputDto organizeInputDto, string keyValue) { Organize organize = new Organize(); if (!string.IsNullOrEmpty(keyValue)) { var id = Convert.ToInt64(keyValue); organize = organizeRepository.Get(id); AutoMapper.Mapper.Map <OrganizeInputDto, Organize>(organizeInputDto, organize); organize.LastModificationTime = DateTime.Now; organizeRepository.Update(organize); } else { AutoMapper.Mapper.Map <OrganizeInputDto, Organize>(organizeInputDto, organize); organize.Id = IdWorkerHelper.GenId64(); organize.DeletedMark = false; organize.CreationTime = DateTime.Now; organizeRepository.Add(organize); } }
public void SubmitCloneButton(string menuId, string ids) { IList <Resource> resources = new List <Resource>(); string[] idsArray = ids.Split(','); foreach (string id in idsArray) { Resource resource = resourceRepository.Get(Convert.ToInt64(id)); resource.Id = IdWorkerHelper.GenId64(); resource.ParentId = Convert.ToInt64(menuId); resource.CreationTime = System.DateTime.Now; resource.DeletedMark = false; resource.EnabledMark = true; resource.LastModificationTime = null; resource.LastModifierUserId = null; resource.DeletionTime = null; resource.DeleterUserId = null; resources.Add(resource); } resourceRepository.Add(resources); }
public void SubmitForm(DutyInputDto dutyInputDto, string keyValue) { Duty duty = new Duty(); if (!string.IsNullOrEmpty(keyValue)) { var id = Convert.ToInt64(keyValue); duty = dutyRepository.Get(id); AutoMapper.Mapper.Map <DutyInputDto, Duty>(dutyInputDto, duty); duty.LastModificationTime = DateTime.Now; dutyRepository.Update(duty); } else { AutoMapper.Mapper.Map <DutyInputDto, Duty>(dutyInputDto, duty); duty.Id = IdWorkerHelper.GenId64(); duty.CreationTime = DateTime.Now; duty.CreatorUserId = 1; dutyRepository.Add(duty); } }
public void SubmitForm(PositionInputDto positionInputDto, string keyValue) { Position position = new Position(); if (!string.IsNullOrEmpty(keyValue)) { var id = Convert.ToInt64(keyValue); position = positionRepository.Get(id); AutoMapper.Mapper.Map <PositionInputDto, Position>(positionInputDto, position); position.LastModificationTime = DateTime.Now; positionRepository.Update(position); } else { AutoMapper.Mapper.Map <PositionInputDto, Position>(positionInputDto, position); position.Id = IdWorkerHelper.GenId64(); position.CreationTime = DateTime.Now; position.CreatorUserId = 1; positionRepository.Add(position); } }
public void SubmitForm(ResourceInputDto resourceInputDto, string keyValue) { Resource resource = new Resource(); if (!string.IsNullOrEmpty(keyValue)) { var id = Convert.ToInt64(keyValue); resource = resourceRepository.Get(id); AutoMapper.Mapper.Map <ResourceInputDto, Resource>(resourceInputDto, resource); resource.LastModificationTime = DateTime.Now; resourceRepository.Update(resource); } else { AutoMapper.Mapper.Map <ResourceInputDto, Resource>(resourceInputDto, resource); resource.Id = IdWorkerHelper.GenId64(); resource.CreationTime = DateTime.Now; resource.DeletedMark = false; resourceRepository.Add(resource); } }
public void SubmitForm(UserInputDto userInputDto, string[] roleIds, string keyValue) { User user = new User(); if (!string.IsNullOrEmpty(keyValue)) { var id = Convert.ToInt64(keyValue); string[] includePath = { "Company", "Department", "Duty", "UserRoles", "UserRoles.Role", "UserRoles.User" }; user = userRepository.Get(id, includePath); AutoMapper.Mapper.Map <UserInputDto, User>(userInputDto, user); user.LastModificationTime = DateTime.Now; userRepository.Update(user); } else { AutoMapper.Mapper.Map <UserInputDto, User>(userInputDto, user); user.Id = IdWorkerHelper.GenId64(); user.DeletedMark = false; user.CreationTime = DateTime.Now; user.CreatorUserId = 1; user.SecretKey = Md5.md5(Common.CreateNo(), 16).ToLower(); user.Password = Md5.md5(DESEncrypt.Encrypt(Md5.md5(userInputDto.Password, 32).ToLower(), user.SecretKey).ToLower(), 32).ToLower(); userRepository.Add(user); } #region 除用户所属角色,再添加用户角色 userRoleRepository.Delete(new Specification <UserRole>(p => p.UserId == Convert.ToInt64(keyValue))); List <UserRole> userRoles = new List <UserRole>(); for (var i = 0; i < roleIds.Length; i++) { var userRole = new UserRole(); userRole.UserId = user.Id; userRole.RoleId = Convert.ToInt64(roleIds[i]); userRole.DeletedMark = true; userRoles.Add(userRole); } userRoleRepository.Add(userRoles); #endregion }
public void SubmitForm(WxOfficialInputDto wxOfficialInputDto, string keyValue) { WxOfficial wxOfficial = new WxOfficial(); if (!string.IsNullOrEmpty(keyValue)) { var id = Convert.ToInt64(keyValue); wxOfficial = wxOfficialRepository.Get(id); AutoMapper.Mapper.Map <WxOfficialInputDto, WxOfficial>(wxOfficialInputDto, wxOfficial); wxOfficial.LastModificationTime = DateTime.Now; wxOfficialRepository.Update(wxOfficial); } else { AutoMapper.Mapper.Map <WxOfficialInputDto, WxOfficial>(wxOfficialInputDto, wxOfficial); wxOfficial.Id = IdWorkerHelper.GenId64(); wxOfficial.DeletedMark = false; wxOfficial.CreationTime = DateTime.Now; wxOfficial.CreatorUserId = 1; wxOfficialRepository.Add(wxOfficial); } }
public void SubmitForm(AttachInputDto attachInputDto, string keyValue) { Attach attach = new Attach(); if (!string.IsNullOrEmpty(keyValue)) { //var id = Convert.ToInt64(keyValue); //area = areaRepository.Get(id); //AutoMapper.Mapper.Map<AreaInputDto, Area>(areaInputDto, area); //area.LastModificationTime = DateTime.Now; //areaRepository.Update(area); } else { AutoMapper.Mapper.Map <AttachInputDto, Attach>(attachInputDto, attach); long UserId = Convert.ToInt64(OperatorProvider.Provider.GetCurrent().Id); attach.Id = IdWorkerHelper.GenId64(); attach.DeletedMark = false; attach.CreationTime = DateTime.Now; attach.CreatorUserId = UserId; attachRepository.Add(attach); } }
public void SubmitForm(WxTextInputDto wxTextInputDto, string keyValue) { string appId = WxOperatorProvider.Provider.GetCurrent().AppId; WxText wxText = new WxText(); if (!string.IsNullOrEmpty(keyValue)) { var id = Convert.ToInt64(keyValue); wxText = wxTextRepository.Get(id); AutoMapper.Mapper.Map <WxTextInputDto, WxText>(wxTextInputDto, wxText); wxText.LastModificationTime = DateTime.Now; wxTextRepository.Update(wxText); } else { AutoMapper.Mapper.Map <WxTextInputDto, WxText>(wxTextInputDto, wxText); wxText.Id = IdWorkerHelper.GenId64(); wxText.AppId = appId; wxText.DeletedMark = false; wxText.CreationTime = DateTime.Now; wxText.CreatorUserId = 1; wxTextRepository.Add(wxText); } }
public void SubmitForm(RoleInputDto roleInputDto, string[] resourceIdsArray, string keyValue) { Role role = new Role(); long id = Convert.ToInt64(keyValue); if (!string.IsNullOrEmpty(keyValue)) { role = roleRepository.Get(id); AutoMapper.Mapper.Map <RoleInputDto, Role>(roleInputDto, role); role.LastModificationTime = DateTime.Now; roleRepository.Update(role); } else { AutoMapper.Mapper.Map <RoleInputDto, Role>(roleInputDto, role); role.Id = IdWorkerHelper.GenId64(); role.CreationTime = DateTime.Now; roleRepository.Add(role); } permissionRepository.Delete(new Specification <Permission>(p => p.ObjectId.Equals(id))); List <Permission> permissionList = new List <Permission>(); foreach (var resourceId in resourceIdsArray) { Permission permission = new Permission(); permission.Id = IdWorkerHelper.GenId64(); permission.ResourceId = Convert.ToInt64(resourceId); permission.ObjectId = id; permission.ObjectType = "RolePermission"; permission.CreationTime = DateTime.Now; permission.DeletedMark = false; permissionList.Add(permission); Debug.WriteLine(permission.Id); } permissionRepository.Add(permissionList); }
public void SubmitForm(WxNewsInputDto wxNewsInputDto, string keyValue) { string appId = WxOperatorProvider.Provider.GetCurrent().AppId; WxNews wxNews = new WxNews(); if (!string.IsNullOrEmpty(keyValue)) { long newsId = Convert.ToInt64(keyValue); var genericFetchStrategy = new GenericFetchStrategy <WxNews>().Include(p => p.WxNewsItems.First().Thumb); wxNews = wxNewsRepository.Get(newsId, genericFetchStrategy); wxNews.LastModificationTime = DateTime.Now; wxNewsRepository.Update(wxNews); foreach (WxNewsItemInputDto wxNewsItemInputDto in wxNewsInputDto.WxNewsItems) { if (!string.IsNullOrEmpty(wxNewsItemInputDto.Id)) { long newsItemId = Convert.ToInt64(wxNewsItemInputDto.Id); WxNewsItem wxNewsItem = wxNewsItemRepository.Get(newsItemId); wxNewsItem.NewsId = wxNews.Id; wxNewsItem.Title = wxNewsItemInputDto.Title; wxNewsItem.Author = wxNewsItemInputDto.Author; wxNewsItem.Digest = wxNewsItemInputDto.Digest; wxNewsItem.Content = wxNewsItemInputDto.Content; wxNewsItem.ContentSourceUrl = wxNewsItemInputDto.ContentSourceUrl; wxNewsItem.ThumbId = Convert.ToInt64(wxNewsItemInputDto.Thumb.Id); if (!string.IsNullOrEmpty(wxNewsItemInputDto.Thumb.MediaId)) { wxNewsItem.ShowCoverPic = 1; } else { wxNewsItem.ShowCoverPic = 0; } wxNewsItem.Index = wxNewsItemInputDto.Index; wxNewsItem.NeedOpenComment = wxNewsItemInputDto.NeedOpenComment; wxNewsItem.OnlyFansCanComment = wxNewsItemInputDto.OnlyFansCanComment; wxNewsItem.LastModificationTime = DateTime.Now; wxNewsItemRepository.Update(wxNewsItem); } else { WxNewsItem wxNewsItem = new WxNewsItem(); wxNewsItem.Id = IdWorkerHelper.GenId64(); wxNewsItem.NewsId = wxNews.Id; wxNewsItem.Title = wxNewsItemInputDto.Title; wxNewsItem.Author = wxNewsItemInputDto.Author; wxNewsItem.Digest = wxNewsItemInputDto.Digest; wxNewsItem.Content = wxNewsItemInputDto.Content; wxNewsItem.ContentSourceUrl = wxNewsItemInputDto.ContentSourceUrl; wxNewsItem.ThumbId = Convert.ToInt64(wxNewsItemInputDto.Thumb.Id); if (!string.IsNullOrEmpty(wxNewsItemInputDto.Thumb.Id)) { wxNewsItem.ShowCoverPic = 1; } else { wxNewsItem.ShowCoverPic = 0; } wxNewsItem.Index = wxNewsItemInputDto.Index; wxNewsItem.NeedOpenComment = wxNewsItemInputDto.NeedOpenComment; wxNewsItem.OnlyFansCanComment = wxNewsItemInputDto.OnlyFansCanComment; wxNewsItem.DeletedMark = false; wxNewsItem.CreationTime = DateTime.Now; wxNewsItemRepository.Add(wxNewsItem); } } } else { wxNews.Id = IdWorkerHelper.GenId64(); wxNews.AppId = appId; wxNews.DeletedMark = false; wxNews.CreationTime = DateTime.Now; wxNews.WxNewsItems = new List <WxNewsItem>(); foreach (WxNewsItemInputDto wxNewsItemInputDto in wxNewsInputDto.WxNewsItems) { WxNewsItem wxNewsItem = new WxNewsItem(); wxNewsItem.Id = IdWorkerHelper.GenId64(); wxNewsItem.NewsId = wxNews.Id; wxNewsItem.Title = wxNewsItemInputDto.Title; wxNewsItem.Author = wxNewsItemInputDto.Author; wxNewsItem.Digest = wxNewsItemInputDto.Digest; wxNewsItem.Content = wxNewsItemInputDto.Content; wxNewsItem.ContentSourceUrl = wxNewsItemInputDto.ContentSourceUrl; wxNewsItem.ThumbId = Convert.ToInt64(wxNewsItemInputDto.Thumb.Id); if (!string.IsNullOrEmpty(wxNewsItemInputDto.Thumb.Id)) { wxNewsItem.ShowCoverPic = 1; } else { wxNewsItem.ShowCoverPic = 0; } wxNewsItem.Index = wxNewsItemInputDto.Index; wxNewsItem.NeedOpenComment = wxNewsItemInputDto.NeedOpenComment; wxNewsItem.OnlyFansCanComment = wxNewsItemInputDto.OnlyFansCanComment; wxNewsItem.DeletedMark = false; wxNewsItem.CreationTime = DateTime.Now; wxNews.WxNewsItems.Add(wxNewsItem); } wxNewsRepository.Add(wxNews); } }