public MovieSettingsEntity GetSettings(Guid domainId, string appId) { if (String.IsNullOrEmpty(appId)) { return(null); } MovieSettingsEntity settings = new MovieSettingsEntity(); settings.Domain = domainId; settings.AppId = appId; if (_dataBase.Fill <MovieSettingsEntity>(settings) == false) { lock (_settingsLockObj) { if (_dataBase.Fill <MovieSettingsEntity>(settings) == false) { //初始化一条默认设置 _dataBase.Insert(settings); } } } return(settings); }
private void btnGet_Click(object sender, EventArgs e) { StudentEntity student = new StudentEntity(); student.Id = 1; _database.Fill <StudentEntity>(student); MessageBox.Show(JsonConvert.SerializeObject(student)); }
public NormalMaterialEntity GetNormalMaterial(Guid id) { NormalMaterialEntity normalMaterial = new NormalMaterialEntity(); normalMaterial.Id = id; if (_dataBase.Fill <NormalMaterialEntity>(normalMaterial) == false) { return(null); } return(normalMaterial); }
public DomainEntity GetDomain(Guid id) { DomainEntity domain = new DomainEntity(); domain.Id = id; if (_dataBase.Fill <DomainEntity>(domain)) { return(domain); } else { return(null); } }
public InformationEntity GetInformation(Guid id) { InformationEntity information = new InformationEntity(); information.Id = id; if (_dataBase.Fill <InformationEntity>(information)) { return(information); } else { return(null); } }
public OneDollarBuyingCommodityEntity GetCommodity(Guid id) { OneDollarBuyingCommodityEntity pointCommodity = new OneDollarBuyingCommodityEntity(); pointCommodity.Id = id; if (_dataBase.Fill <OneDollarBuyingCommodityEntity>(pointCommodity)) { return(pointCommodity); } else { return(null); } }
public PointCommodityEntity GetPointCommodity(Guid id) { PointCommodityEntity pointCommodity = new PointCommodityEntity(); pointCommodity.Id = id; if (_dataBase.Fill <PointCommodityEntity>(pointCommodity)) { return(pointCommodity); } else { return(null); } }
public UserEntity GetUser(Guid id) { UserEntity user = new UserEntity(); user.Id = id; if (_dataBase.Fill <UserEntity>(user)) { return(user); } else { return(null); } }
//TODO:增加domainId和appId参数,不是一个域的不给取,以增加安全性 public MemberEntity GetMember(Guid id) { MemberEntity member = new MemberEntity(); member.Id = id; if (_dataBase.Fill <MemberEntity>(member)) { return(member); } else { return(null); } }
public CustomFormEntity GetCustomForm(Guid id) { CustomFormEntity customForm = new CustomFormEntity(); customForm.Id = id; if (_dataBase.Fill <CustomFormEntity>(customForm)) { return(customForm); } else { return(null); } }
public CouponEntity GetCoupon(Guid id) { CouponEntity coupon = new CouponEntity(); coupon.Id = id; if (_dataBase.Fill <CouponEntity>(coupon)) { return(coupon); } else { return(null); } }
public GroupMessageEntity GetGroupMessage(Guid id) { GroupMessageEntity groupMessage = new GroupMessageEntity(); groupMessage.Id = id; if (_dataBase.Fill <GroupMessageEntity>(groupMessage)) { if (groupMessage.GroupId.HasValue) { groupMessage.FilterOption = "分组:"; MemberGroupEntity memberGroup = _memberGroupManager.GetMemberGroup(groupMessage.Domain, groupMessage.AppId, groupMessage.GroupId.Value); if (memberGroup != null) { groupMessage.FilterOption += memberGroup.Name; } } else { groupMessage.FilterOption = "全部"; } return(groupMessage); } else { return(null); } }
public PortalStyleSettingsEntity GetPortalStyleSettings(Guid domainId, string appId) { if (String.IsNullOrEmpty(appId)) { return(null); } PortalStyleSettingsEntity settings = new PortalStyleSettingsEntity(); settings.Domain = domainId; settings.AppId = appId; if (_dataBase.Fill <PortalStyleSettingsEntity>(settings) == false) { lock (_settingsLockObj) { if (_dataBase.Fill <PortalStyleSettingsEntity>(settings) == false) { //初始化一条默认设置 _dataBase.Insert(settings); } } } //不管模式是不是模版,只要有值,就取出来 //避免从自定义切回模版画面时不显示名称和说明 if (settings.PortalPresetTemplateId.HasValue) { settings.PortalPresetTemplate = _portalTemplatePool.GetPortalPresetTemplate(settings.PortalPresetTemplateId.Value); } else { if (settings.PortalMode == EnumPortalMode.Template) { settings.PortalPresetTemplate = _portalTemplatePool.GetDefaultPortalPresetTemplate(); settings.PortalPresetTemplateId = settings.PortalPresetTemplate.Id; } } return(settings); }
public PortalPresetTemplateEntity GetTemplate(Guid id) { PortalPresetTemplateEntity template = new PortalPresetTemplateEntity(); template.Id = id; if (_dataBase.Fill <PortalPresetTemplateEntity>(template)) { return(template); } else { return(null); } }
public MemberTagEntity GetMemberTag(Guid id) { MemberTagEntity memberTag = new MemberTagEntity(); memberTag.Id = id; if (_dataBase.Fill <MemberTagEntity>(memberTag)) { return(memberTag); } else { return(null); } }
public RecommendUrlEntity Get(Guid id) { RecommendUrlEntity recommendUrl = new RecommendUrlEntity(); recommendUrl.Id = id; if (_dataBase.Fill <RecommendUrlEntity>(recommendUrl)) { return(recommendUrl); } else { return(null); } }
public AdvancedArticleEntity GetAdvancedArticle(Guid id) { AdvancedArticleEntity advancedArticle = new AdvancedArticleEntity(); advancedArticle.Id = id; if (_dataBase.Fill <AdvancedArticleEntity>(advancedArticle)) { return(advancedArticle); } else { return(null); } }
public MemberGroupEntity GetMemberGroup(Guid id) { MemberGroupEntity memberGroup = new MemberGroupEntity(); memberGroup.Id = id; if (_dataBase.Fill <MemberGroupEntity>(memberGroup)) { return(memberGroup); } else { return(null); } }
public ScenicQRCodeEntity GetScenicQRCode(Guid id) { ScenicQRCodeEntity scenicQRCodeEntity = new ScenicQRCodeEntity(); scenicQRCodeEntity.Id = id; if (_dataBase.Fill <ScenicQRCodeEntity>(scenicQRCodeEntity)) { return(scenicQRCodeEntity); } else { return(null); } }
public AdvertisingEntity GetAdvertising(Guid id) { AdvertisingEntity advertising = new AdvertisingEntity(); advertising.Id = id; if (_dataBase.Fill <AdvertisingEntity>(advertising)) { return(advertising); } else { return(null); } }
public PageEntity GetPage(Guid id) { PageEntity page = new PageEntity(); page.Id = id; if (_dataBase.Fill <PageEntity>(page)) { return(page); } else { return(null); } }
public CampaignEntity GetCampaign(Guid id) { CampaignEntity campaign = new CampaignEntity(); campaign.Id = id; if (DataBase.Fill <CampaignEntity>(campaign)) { UserEntity userEntity = UserManager.GetUser(campaign.CreateUser); if (userEntity != null) { campaign.CreateUserName = userEntity.Name; } return(campaign); } else { return(null); } }
/// <summary> /// 根据授权码开始维护一个新的公众号Token /// 此方法在 Container 中调用 /// </summary> /// <param name="domainId"></param> /// <param name="authCode"></param> /// <returns></returns> public RequestApiResult <WeixinThirdPartyGetAuthorizationInfoResult> CreateAuthorizer(Guid domainId, string authCode) { RequestApiResult <WeixinThirdPartyGetAuthorizationInfoResult> authorizationInfoResult = ThirdPartyApiWrapper.GetAuthorizationInfo(authCode); if (authorizationInfoResult.Success == false) { return(authorizationInfoResult); } WeixinThirdPartyAuthorizationInfo info = authorizationInfoResult.ApiResult.AuthorizationInfo; //一个公众号不能同时授权给两个帐户,因为微信在推送数据时只带一个APPID,我无法判断其属于哪个Domain //但是允许其在解除授权后得新授权给另一个帐户 //所以首先判断有没有已经授权过的且online的domain,如果有,先解除原有授权 //解除的办法直接更新原domain的lastDockingDate,并把Online置为0, List <CommandParameter> parameterList = new List <CommandParameter>(); parameterList.Add(new CommandParameter("@domainId", domainId)); parameterList.Add(new CommandParameter("@appId", info.AppId)); DataTable dt = _dataBase.ExecuteDataSet( "SELECT [Domain] FROM [Authorizer] WHERE [Online] = 1 AND [AppId] = @appId AND [Domain] <> @domainId", parameterList, new string[] { "table" }).Tables[0]; foreach (DataRow dr in dt.Rows) { //解除授权 Unauthorized(Guid.Parse(dr["Domain"].ToString()), info.AppId); } //还有可能是同一个Domain以前授权过的,这种情况直接更新即可 AuthorizerEntity entity = new AuthorizerEntity(); entity.AppId = info.AppId; entity.Domain = domainId; bool exist = _dataBase.Fill <AuthorizerEntity>(entity); //保存RefreshToken到数据库 //非常重要,一旦丢失则需要公众号重新授权 entity.AccessToken = info.AccessToken; entity.AccessTokenExpiryTime = DateTime.Now.AddSeconds(info.ExpiresIn); entity.RefreshToken = info.RefreshToken; entity.RefreshTokenGetTime = DateTime.Now; //////////// entity.AuthorizationTime = DateTime.Now; entity.Online = true; entity.FuncScopeCategory = info.FuncScopeCategoryList.ToString(); if (exist) { _dataBase.Update(entity); } else { _dataBase.Insert(entity); } //更新LastDockingTime DomainManager.Instance.UpdateLastDockingTime(domainId); return(authorizationInfoResult); }