private static void ReduceDeduct(string orderId, decimal refundAmount, Member member) { int referralDeduct = HiContext.Current.SiteSettings.ReferralDeduct; if (referralDeduct > 0 && member.ReferralUserId.HasValue && member.ReferralUserId.Value > 0) { IUser user = Users.GetUser(member.ReferralUserId.Value, false); if (user != null && user.UserRole == UserRole.Member) { Member member2 = user as Member; if (member.ParentUserId == member2.ParentUserId && member2.IsOpenBalance) { decimal balance = member2.Balance - refundAmount * referralDeduct / 100m; BalanceDetailInfo balanceDetailInfo = new BalanceDetailInfo(); balanceDetailInfo.UserId = member2.UserId; balanceDetailInfo.UserName = member2.Username; balanceDetailInfo.TradeDate = DateTime.Now; balanceDetailInfo.TradeType = TradeTypes.ReferralDeduct; balanceDetailInfo.Expenses = new decimal?(refundAmount * referralDeduct / 100m); balanceDetailInfo.Balance = balance; balanceDetailInfo.Remark = string.Format("退回提成因为{0}的订单{1}已退款", member.Username, orderId); MemberProvider.Instance().InsertBalanceDetail(balanceDetailInfo); } } } }
public static void RegisterToolbarMembers() { //Toolbar MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembers.View.MenuTemplate.Override <Toolbar>(), ToolbarMenuTemplateChanged)); MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersCompat.Toolbar.IsActionBar, ToolbarIsActionBarChanged)); }
static void ReduceDeduct(OrderInfo order, Member member) { int referralDeduct = HiContext.Current.SiteSettings.ReferralDeduct; if (((referralDeduct > 0) && member.ReferralUserId.HasValue) && (member.ReferralUserId.Value > 0)) { IUser user = Users.GetUser(member.ReferralUserId.Value, false); if ((user != null) && (user.UserRole == UserRole.Member)) { Member member2 = user as Member; if ((member.ParentUserId == member2.ParentUserId) && member2.IsOpenBalance) { decimal num2 = member2.Balance - ((order.RefundAmount * referralDeduct) / 100M); BalanceDetailInfo balanceDetail = new BalanceDetailInfo(); balanceDetail.UserId = member2.UserId; balanceDetail.UserName = member2.Username; balanceDetail.TradeDate = DateTime.Now; balanceDetail.TradeType = TradeTypes.ReferralDeduct; balanceDetail.Expenses = new decimal?((order.RefundAmount * referralDeduct) / 100M); balanceDetail.Balance = num2; balanceDetail.Remark = string.Format("退回提成因为'{0}'的订单{1}已退款", order.Username, order.OrderId); MemberProvider.Instance().InsertBalanceDetail(balanceDetail); } } } }
public override DataTable GetSubjectList(SubjectListQuery query) { StringBuilder builder = new StringBuilder(); if (HiContext.Current.User.UserRole == UserRole.Member) { Member user = HiContext.Current.User as Member; int memberDiscount = MemberProvider.Instance().GetMemberDiscount(user.GradeId); builder.AppendFormat("SELECT TOP {0} ProductId,ProductName,ProductCode,SaleCounts,ShortDescription,ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160,ThumbnailUrl180,ThumbnailUrl220,MarketPrice,SalePrice,", query.MaxNum); builder.AppendFormat(" CASE WHEN (SELECT COUNT(*) FROM Hishop_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0}) = 1 ", user.GradeId); builder.AppendFormat("THEN (SELECT MemberSalePrice FROM Hishop_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0}) ELSE SalePrice*{1}/100 END AS RankPrice", user.GradeId, memberDiscount); } else { builder.AppendFormat("SELECT TOP {0} ProductId,ProductName,ProductCode,SaleCounts,ShortDescription,ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160,ThumbnailUrl180,ThumbnailUrl220,MarketPrice,SalePrice,SalePrice AS RankPrice", query.MaxNum); } builder.Append(" FROM vw_Hishop_BrowseProductList p WHERE "); builder.Append(ProductMasterProvider.BuildProductSubjectQuerySearch(query)); if (!string.IsNullOrEmpty(query.SortBy)) { builder.AppendFormat(" ORDER BY {0} {1}", DataHelper.CleanSearchString(query.SortBy), DataHelper.CleanSearchString(query.SortOrder.ToString())); } DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString()); using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand)) { return(DataHelper.ConverDataReaderToDataTable(reader)); } }
public MandateController() { _sessionProvider = new SessionProvider(); _goCardlessProvider = new GoCardlessProvider(); _memberService = ApplicationContext.Current.Services.MemberService; _memberProvider = new MemberProvider(_memberService); _logger = ApplicationContext.Current.ProfilingLogger.Logger; }
public MemberEditController( ) { //TODO - Use IoC? _sessionProvider = new SessionProvider(); _goCardlessProvider = new GoCardlessProvider(); _emailProvider = new EmailProvider(); _memberProvider = new MemberProvider(Services); _membershipCostCalculator = new MembershipCostCalculator(); }
public EventController() { _dataTypeProvider = new DataTypeProvider(Services.DataTypeService); var dataConnection = new DataConnection(); _eventSlotRepository = new EventSlotRepository(dataConnection); _eventParticipantRepository = new EventParticipantRepository(dataConnection); _memberProvider = new MemberProvider(Services); }
public void ShowFieldsIfNoPropertyAvailalbe() { var showInfo = MemberProvider.Create(new FieldsWithUnderLines()); var value = showInfo.Value; var names = value.GetNames(); Assert.IsTrue(names.Contains("_Field")); Assert.IsTrue(names.Contains("_OtherField")); }
public static void RegisterMenuItemMembers() { MemberProvider.Register(AttachedBindingMember.CreateMember <IMenuItem, string>(AttachedMembers.MenuItem.ShowAsAction.Path, null, (info, o, value) => { if (!string.IsNullOrEmpty(value)) { o.SetShowAsActionFlags((ShowAsAction)Enum.Parse(typeof(ShowAsAction), value.Replace("|", ","), true)); } })); }
public static void RegisterSearchViewMembers() { BindingBuilderExtensions.RegisterDefaultBindingMember <SearchView>(nameof(SearchView.Query)); var queryMember = AttachedBindingMember.CreateMember <SearchView, string>(nameof(SearchView.Query), (info, searchView) => searchView.Query, (info, searchView, value) => searchView.SetQuery(value, false), nameof(SearchView.QueryTextChange)); MemberProvider.Register(queryMember); MemberProvider.Register(nameof(TextView.Text), queryMember); }
public PaymentController() { _sessionProvider = new SessionProvider(); _goCardlessProvider = new GoCardlessProvider(); _emailProvider = new EmailProvider(); _memberService = ApplicationContext.Current.Services.MemberService; _memberProvider = new MemberProvider(_memberService); _logger = ApplicationContext.Current.ProfilingLogger.Logger; _membershipCostCalculator = new MembershipCostCalculator(); }
public void MixBag() { var showInfo = MemberProvider.Create(new MixedBag()); var value = showInfo.Value; var names = value.GetNames(); Assert.IsTrue(names.Contains("_Field")); Assert.IsTrue(names.Contains("AutoProperty")); Assert.IsTrue(names.Contains("AProperty")); }
private static void UpdateUserAccount(OrderInfo order) { int num = order.UserId; if (num == 1100) { num = 0; } IUser user = Users.GetUser(num, false); if (user != null && user.UserRole == UserRole.Member) { Member member = user as Member; UserPointInfo userPointInfo = new UserPointInfo(); userPointInfo.OrderId = order.OrderId; userPointInfo.UserId = member.UserId; userPointInfo.TradeDate = DateTime.Now; userPointInfo.TradeType = UserPointTradeType.Bounty; userPointInfo.Increased = new int?(order.Points); userPointInfo.Points = order.Points + member.Points; int arg_A2_0 = userPointInfo.Points; if (userPointInfo.Points < 0) { userPointInfo.Points = 2147483647; } SalesProvider.Instance().AddMemberPoint(userPointInfo); int referralDeduct = HiContext.Current.SiteSettings.ReferralDeduct; if (referralDeduct > 0 && member.ReferralUserId.HasValue && member.ReferralUserId.Value > 0) { IUser user2 = Users.GetUser(member.ReferralUserId.Value, false); if (user2 != null && user2.UserRole == UserRole.Member) { Member member2 = user2 as Member; if (member.ParentUserId == member2.ParentUserId && member2.IsOpenBalance) { decimal balance = member2.Balance + order.GetTotal() * referralDeduct / 100m; BalanceDetailInfo balanceDetailInfo = new BalanceDetailInfo(); balanceDetailInfo.UserId = member2.UserId; balanceDetailInfo.UserName = member2.Username; balanceDetailInfo.TradeDate = DateTime.Now; balanceDetailInfo.TradeType = TradeTypes.ReferralDeduct; balanceDetailInfo.Income = new decimal?(order.GetTotal() * referralDeduct / 100m); balanceDetailInfo.Balance = balance; balanceDetailInfo.Remark = string.Format("提成来自{0}的订单{1}", order.Username, order.OrderId); MemberProvider.Instance().InsertBalanceDetail(balanceDetailInfo); } } } SalesProvider.Instance().UpdateUserAccount(order.GetTotal(), order.UserId); int historyPoint = SalesProvider.Instance().GetHistoryPoint(member.UserId); SalesProvider.Instance().ChangeMemberGrade(member.UserId, member.GradeId, historyPoint); Users.ClearUserCache(user); } }
private static IMemberProvider GetMemberProvider(Options options) { var memberProvider = new MemberProvider() { IncludeInternal = options.IncludeInternal, IncludeProperties = options.IncludeProperties, IncludeFields = options.IncludeFields, }; return(memberProvider); }
public void GetEnumMemberTest() { var provider = new MemberProvider(); var member = provider.GetMembers(typeof(EnumMemberMock)).Single(); Assert.AreEqual(typeof(EnumMemberMock).FullName, member.Type.FullName); Assert.AreEqual(nameof(EnumMemberMock.EnumMember), member.Name); Assert.AreEqual(77, Convert.ToInt32(member.Value)); Assert.AreEqual(MemberInfoType.EnumMember, member.MemberInfoType); }
static void UpdateUserAccount(OrderInfo order) { int userId = order.UserId; if (userId == 0x44c) { userId = 0; } IUser user = Users.GetUser(userId, false); if ((user != null) && (user.UserRole == UserRole.Member)) { Member member = user as Member; UserPointInfo point = new UserPointInfo(); point.OrderId = order.OrderId; point.UserId = member.UserId; point.TradeDate = DateTime.Now; point.TradeType = UserPointTradeType.Bounty; point.Increased = new int?(order.GetTotalPoints()); point.Points = order.GetTotalPoints() + member.Points; if ((point.Points > 0x7fffffff) || (point.Points < 0)) { point.Points = 0x7fffffff; } SalesProvider.Instance().AddMemberPoint(point); int referralDeduct = HiContext.Current.SiteSettings.ReferralDeduct; if (((referralDeduct > 0) && member.ReferralUserId.HasValue) && (member.ReferralUserId.Value > 0)) { IUser user2 = Users.GetUser(member.ReferralUserId.Value, false); if ((user2 != null) && (user2.UserRole == UserRole.Member)) { Member member2 = user2 as Member; if ((member.ParentUserId == member2.ParentUserId) && member2.IsOpenBalance) { decimal num3 = member2.Balance + ((order.GetTotal() * referralDeduct) / 100M); BalanceDetailInfo balanceDetail = new BalanceDetailInfo(); balanceDetail.UserId = member2.UserId; balanceDetail.UserName = member2.Username; balanceDetail.TradeDate = DateTime.Now; balanceDetail.TradeType = TradeTypes.ReferralDeduct; balanceDetail.Income = new decimal?((order.GetTotal() * referralDeduct) / 100M); balanceDetail.Balance = num3; balanceDetail.Remark = string.Format("提成来自'{0}'的订单{1}", order.Username, order.OrderId); MemberProvider.Instance().InsertBalanceDetail(balanceDetail); } } } SalesProvider.Instance().UpdateUserAccount(order.GetTotal(), order.UserId); int historyPoint = SalesProvider.Instance().GetHistoryPoint(member.UserId); SalesProvider.Instance().ChangeMemberGrade(member.UserId, member.GradeId, historyPoint); Users.ClearUserCache(user); } }
public ActionResult ConfirmPayment(RegistrationCompleteModel model) { model.PromptForConfirmation = false; RegistrationDetails registrationDetails = _sessionProvider.RegistrationDetails; if (registrationDetails == null || string.IsNullOrWhiteSpace(_sessionProvider.GoCardlessRedirectFlowId)) { TempData["Model"] = model; return(CurrentUmbracoPage()); } string mandateId = _goCardlessProvider.CompleteRedirectRequest(_sessionProvider.GoCardlessRedirectFlowId, _sessionProvider.SessionId); registrationDetails.PersonalDetails.DirectDebitMandateId = mandateId; var regDetails = registrationDetails.PersonalDetails; int costInPence = _membershipCostCalculator.Calculate(registrationDetails.MemberOptions, DateTime.Now); model.Cost = (costInPence / 100m).ToString("N2"); var paymentDescription = MemberProvider.GetPaymentDescription(registrationDetails.MemberOptions); var paymentResponse = _goCardlessProvider.CreatePayment(Logger, regDetails.DirectDebitMandateId, regDetails.Email, costInPence, paymentDescription); model.IsRegistered = paymentResponse == PaymentResponseDto.Success; if (model.IsRegistered) { var member = _memberProvider.CreateMember(regDetails, new string[] { MSTCRoles.Member }); _memberProvider.UpdateMemberDetails(member, registrationDetails.PersonalDetails, registrationDetails.MemberOptions); //Login the member FormsAuthentication.SetAuthCookie(member.Username, true); string content = GetRegEmailContent(registrationDetails, true); _emailProvider.SendEmail(EmailProvider.MembersEmail, EmailProvider.SupportEmail, "New MSTC member registration", content); _sessionProvider.RegistrationDetails = null; _sessionProvider.GoCardlessRedirectFlowId = null; TempData["Model"] = model; return(CurrentUmbracoPage()); } else { string content = GetRegEmailContent(registrationDetails, false); _emailProvider.SendEmail(EmailProvider.SupportEmail, EmailProvider.SupportEmail, "MSTC member registration problem", content); } TempData["Model"] = model; return(CurrentUmbracoPage()); }
private static IBindingMemberInfo FindUpdateEvent(Type type, string memberName) { IBindingMemberInfo member = MemberProvider.GetBindingMember(type, memberName + AttachedMemberConstants.ChangedEventPostfix, false, false); if (member == null || member.MemberType != BindingMemberType.Event) { member = MemberProvider.GetBindingMember(type, memberName + "Change", false, false); } if (member == null || member.MemberType != BindingMemberType.Event) { return(null); } return(member); }
public ActionResult MemberOptions() { var memberEditPage = CurrentPage as MemberEdit; IMember member = _memberProvider.GetLoggedInMember(); var model = new MemberOptionsModel(); if (member != null) { var memberType = member.GetValue <MembershipTypeEnum>(MemberProperty.membershipType); var isGuest = memberType == MembershipTypeEnum.Guest; var membershipExpiry = member.GetValue <DateTime>(MemberProperty.MembershipExpiry); model.MembershipExpired = membershipExpiry < DateTime.Now; model.MembershipExpiry = membershipExpiry; model.MembershipType = memberType.ToString(); model.IsBankLinked = !string.IsNullOrEmpty(member.GetValue <string>(MemberProperty.directDebitMandateId)); string swimSubs1 = member.GetValue <string>(MemberProperty.swimSubs1); model.ShowBuySwimSubs1 = !model.EnableMemberRenewal && !isGuest && _membershipCostCalculator.SwimSubs1Enabled && string.IsNullOrEmpty(swimSubs1) && DateTime.Now.Month < 10 && DateTime.Now.Month > 2; string swimSubs2 = member.GetValue <string>(MemberProperty.swimSubs2); model.ShowBuySwimSubs2 = !model.EnableMemberRenewal && !isGuest && _membershipCostCalculator.SwimSubs2Enabled && string.IsNullOrEmpty(swimSubs2); model.OptionalExtras = GetOptionalExtras(member); decimal swimSubsCost = _membershipCostCalculator.SwimsSubsCostInPence(memberType) / 100; model.BuySwimSubs1Text = string.Format("Buy {0} @ £{1:N2}", MemberProvider.GetSwimSub1Description(DateTime.Now), swimSubsCost); model.BuySwimSubs2Text = string.Format("Buy {0} @ £{1:N2}", MemberProvider.GetSwimSub2Description(DateTime.Now), swimSubsCost); model.EnableMemberRenewal = memberEditPage.RenewalsEnabled && DateTime.Now.Month > 2 && !isGuest && membershipExpiry.Year <= DateTime.Now.Year; model.ShowIceLink = Roles.IsUserInRole(MSTCRoles.Coach) || Roles.IsUserInRole(MSTCRoles.MemberAdmin); model.ShowMemberAdminLink = Roles.IsUserInRole(MSTCRoles.MemberAdmin); model.ShowEventAdminLink = Roles.IsUserInRole(MSTCRoles.EventAdminViewer); model.EnableOpenWater = memberEditPage.OWsenabled && !isGuest && !model.MembershipExpired; model.OWSNumber = member.GetValue <string>(MemberProperty.SwimAuthNumber); model.OwsIndemnityAccepted = member.GetValue <bool>(MemberProperty.OpenWaterIndemnityAcceptance); model.OwsIndemnityDocLink = memberEditPage.IndemnityWaiverDoc?.Url; model.OwsSignupFee = (decimal)_membershipCostCalculator.OwsSignupCostPence / 100; model.RenewalPageUrl = memberEditPage.RenewalPage?.Url; model.MemberAdminPageUrl = memberEditPage.MemberAdminPage?.Url; model.EventBookingPageUrl = memberEditPage.EventBookingPage?.Url; model.EventAdminPageUrl = memberEditPage.EventAdminPage?.Url; model.UnlinkBankPageUrl = memberEditPage.UnlinkBankPage?.Url; } return(PartialView("Member/EditMemberOptions", model)); }
public override OpenIdSettingsInfo GetOpenIdSettings(string openIdType) { OpenIdSettingsInfo info = null; DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM aspnet_OpenIdSettings WHERE LOWER(OpenIdType)=LOWER(@OpenIdType)"); this.database.AddInParameter(sqlStringCommand, "OpenIdType", DbType.String, openIdType.ToLower()); using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand)) { if (reader.Read()) { info = MemberProvider.PopulateOpenIdSettings(reader); } } return(info); }
public override OpenIdSettingsInfo GetOpenIdSettings(string openIdType) { OpenIdSettingsInfo result = null; System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM aspnet_OpenIdSettings WHERE LOWER(OpenIdType)=LOWER(@OpenIdType)"); this.database.AddInParameter(sqlStringCommand, "OpenIdType", System.Data.DbType.String, openIdType.ToLower()); using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { if (dataReader.Read()) { result = MemberProvider.PopulateOpenIdSettings(dataReader); } } return(result); }
public override IList <OpenIdSettingsInfo> GetConfigedItems() { IList <OpenIdSettingsInfo> list = new List <OpenIdSettingsInfo>(); DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM aspnet_OpenIdSettings"); using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand)) { while (reader.Read()) { OpenIdSettingsInfo item = MemberProvider.PopulateOpenIdSettings(reader); list.Add(item); } } return(list); }
public void GetClassPublicFieldTest() { var provider = new MemberProvider() { IncludeProperties = false, IncludeFields = true, IncludeInternal = false, }; var member = provider.GetMembers(typeof(FieldMemberClassMock)).Single(); Assert.AreEqual(typeof(string).FullName, member.Type.FullName); Assert.AreEqual(nameof(FieldMemberClassMock.PublicField), member.Name); Assert.IsNull(member.Value); Assert.AreEqual(MemberInfoType.Field, member.MemberInfoType); }
public override OpenIdSettingsInfo GetOpenIdSettings(string openIdType) { OpenIdSettingsInfo result = null; System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM distro_OpenIdSettings WHERE UserId=@UserId AND LOWER(OpenIdType)=LOWER(@OpenIdType)"); this.database.AddInParameter(sqlStringCommand, "OpenIdType", System.Data.DbType.String, openIdType.ToLower()); this.database.AddInParameter(sqlStringCommand, "UserId", System.Data.DbType.Int32, HiContext.Current.SiteSettings.UserId.Value); using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { if (dataReader.Read()) { result = MemberProvider.PopulateOpenIdSettings(dataReader); } } return(result); }
public GuestRegistrationController( ) { _sessionProvider = new SessionProvider(); _goCardlessProvider = new GoCardlessProvider(); _emailProvider = new EmailProvider(); _memberProvider = new MemberProvider(Services); _membershipCostCalculator = new MembershipCostCalculator(); UmbracoHelper umbracoHelper = new UmbracoHelper(UmbracoContext); var guestContent = umbracoHelper?.TypedContentAtRoot().DescendantsOrSelf(GuestRegistration.ModelTypeAlias).FirstOrDefault(); if (guestContent != null) { _guestRegistrationPage = new GuestRegistration(guestContent); } }
public override IList <OpenIdSettingsInfo> GetConfigedItems() { IList <OpenIdSettingsInfo> list = new List <OpenIdSettingsInfo>(); System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM distro_OpenIdSettings WHERE UserId=@UserId"); this.database.AddInParameter(sqlStringCommand, "UserId", System.Data.DbType.Int32, HiContext.Current.SiteSettings.UserId.Value); using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { while (dataReader.Read()) { OpenIdSettingsInfo item = MemberProvider.PopulateOpenIdSettings(dataReader); list.Add(item); } } return(list); }
public override DbQueryResult GetBrowseProductList(ProductBrowseQuery query) { string filter = ProductMasterProvider.BuildProductBrowseQuerySearch(query); string selectFields = "ProductId,ProductName,ProductCode, SaleCounts, ShortDescription, ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180,ThumbnailUrl220,MarketPrice, SalePrice,Stock"; if (HiContext.Current.User.UserRole == UserRole.Member) { Member user = HiContext.Current.User as Member; int memberDiscount = MemberProvider.Instance().GetMemberDiscount(user.GradeId); selectFields = selectFields + string.Format(",CASE WHEN (SELECT COUNT(*) FROM Hishop_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0}) = 1 ", user.GradeId) + string.Format("THEN (SELECT MemberSalePrice FROM Hishop_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0}) ELSE SalePrice*{1}/100 END AS RankPrice", user.GradeId, memberDiscount); } else { selectFields = selectFields + ",SalePrice as RankPrice"; } return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_Hishop_BrowseProductList p", "ProductId", filter, selectFields)); }
public override DbQueryResult GetUnSaleProductList(ProductBrowseQuery query) { int num = HiContext.Current.SiteSettings.UserId.Value; string filter = ProductSubsiteProvider.BuildUnSaleProductBrowseQuerySearch(query) + string.Format(" AND DistributorUserId = {0} ", HiContext.Current.SiteSettings.UserId.Value); string selectFields = "ProductId,ProductName,ProductCode,ShowSaleCounts AS SaleCounts, ShortDescription,MarketPrice, ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180,ThumbnailUrl220,ThumbnailUrl310,Stock"; if (HiContext.Current.User.UserRole == UserRole.Underling) { Member user = HiContext.Current.User as Member; int memberDiscount = MemberProvider.Instance().GetMemberDiscount(user.GradeId); selectFields = (selectFields + string.Format(",(SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = p.SkuId AND DistributoruserId = {0}) AS SalePrice", num) + string.Format(",CASE WHEN (SELECT COUNT(*) FROM distro_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0} AND DistributoruserId = {1}) = 1 ", user.GradeId, num)) + string.Format(" THEN (SELECT MemberSalePrice FROM distro_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0} AND DistributoruserId = {1})", user.GradeId, num) + string.Format(" ELSE (SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = p.SkuId AND DistributoruserId = {0})*{1}/100 END AS RankPrice", num, memberDiscount); } else { selectFields = selectFields + string.Format(",(SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = p.SkuId AND DistributoruserId = {0}) AS SalePrice", num) + string.Format(",(SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = p.SkuId AND DistributoruserId = {0}) AS RankPrice", num); } return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_distro_BrowseProductList p", "ProductId", filter, selectFields)); }
public static void RegisterDrawerLayoutMembers() { MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersCompat.View.DrawerIsOpened, ViewDrawerIsOpenedChanged, getDefaultValue: ViewDrawerIsOpenedGetDefaultValue)); INotifiableAttachedBindingMemberInfo <DrawerLayout, bool> actionBarDrawerToggleEnabledMember = AttachedBindingMember.CreateAutoProperty(AttachedMembersCompat.DrawerLayout.ActionBarDrawerToggleEnabled, (layout, args) => { if (!args.NewValue) { return; } Activity activity = layout.Context.GetActivity(); if (activity != null) { DrawerListenerImpl .GetOrAdd(layout) .SetListener(activity, new ActionBarDrawerToggle(activity, layout, Resource.String.Empty, Resource.String.Empty)); } }); MemberProvider.Register(actionBarDrawerToggleEnabledMember); MemberProvider.Register(typeof(DrawerLayout), "ActionBarDrawerEnabled", actionBarDrawerToggleEnabledMember, true); MemberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersCompat.DrawerLayout.DrawerListener, (layout, args) => { var listener = args.NewValue as DrawerLayout.IDrawerListener; if (listener == null) { var func = args.NewValue as Func <DrawerLayout, DrawerLayout.IDrawerListener>; if (func != null) { listener = func(layout); } } if (listener == null) { Tracer.Warn("The DrawerListener '{0}' is not supported", args.NewValue); } DrawerListenerImpl.GetOrAdd(layout).SetListener(layout.Context, listener); })); }
public static void RegisterActionBarBaseMembers() { MemberProvider.Register(AttachedBindingMember.CreateMember <ActionBar, object>(AttachedMemberConstants.ParentExplicit, (info, bar) => bar.ThemedContext.GetActivity(), null)); MemberProvider.Register(AttachedBindingMember .CreateNotifiableMember <ActionBar, string>(nameof(ActionBar.Subtitle), (info, actionBar) => actionBar.Subtitle, (info, actionBar, value) => { actionBar.Subtitle = value; return(true); })); MemberProvider.Register(AttachedBindingMember .CreateNotifiableMember <ActionBar, string>(nameof(ActionBar.Title), (info, actionBar) => actionBar.Title, (info, actionBar, value) => { actionBar.Title = value; return(true); })); MemberProvider.Register(AttachedBindingMember.CreateMember <ActionBar, HomeButtonImpl>("HomeButton", (info, bar) => HomeButtonImpl.GetOrAdd(bar), null)); MemberProvider.Register(AttachedBindingMember.CreateEvent <HomeButtonImpl>("Click", (info, homeButton, arg3) => homeButton.AddWithUnsubscriber(arg3))); }
public ActionResult Edit(Profile member) { try { MemberProvider memberProvider = new MemberProvider(); AspNetUserImagesProvider _aspNetUserImagesProvider = new AspNetUserImagesProvider(); var userId = User.Identity.GetUserId(); var user = memberProvider.Single(u => u.Id.Equals(userId, StringComparison.OrdinalIgnoreCase)); // TODO: UPDATE IMAGES HERE var images = _aspNetUserImagesProvider.List(i=>i.UserId.Equals(userId,StringComparison.OrdinalIgnoreCase)).ToList(); images.ForEach(i => i.IsInUse = false); _aspNetUserImagesProvider.Update(images.ToArray()); var newProfile = _aspNetUserImagesProvider.Single(i => i.AspNetUserImageId == member.ProfileImageId); newProfile.IsInUse = true; _aspNetUserImagesProvider.Update(newProfile); //END IMAGES HERE return RedirectToAction("Wall"); } catch { return View(); } }