// User Is in Group private void LoadUserIsInGroupEditor(UserIsInGroup q) { List <MerchantTribe.Commerce.Contacts.PriceGroup> allGroups = MyPage.MTApp.ContactServices.PriceGroups.FindAll(); List <FriendlyBvinDisplay> displayData = new List <FriendlyBvinDisplay>(); foreach (string bvin in q.CurrentGroupIds()) { FriendlyBvinDisplay item = new FriendlyBvinDisplay(); item.bvin = bvin; item.DisplayName = bvin; var t = allGroups.Where(y => y.Bvin == bvin).FirstOrDefault(); if (t != null) { item.DisplayName = t.Name; allGroups.Remove(t); } displayData.Add(item); } this.lstUserIsInGroup.DataSource = allGroups; this.lstUserIsInGroup.DataValueField = "Bvin"; this.lstUserIsInGroup.DataTextField = "Name"; this.lstUserIsInGroup.DataBind(); this.gvUserIsInGroup.DataSource = displayData; this.gvUserIsInGroup.DataBind(); }
protected void btnAddUserIsInGroup_Click(object sender, ImageClickEventArgs e) { Promotion p = GetCurrentPromotion(); UserIsInGroup q = (UserIsInGroup)GetCurrentQualification(p); if (q == null) { return; } q.AddGroup(this.lstUserIsInGroup.SelectedValue); MyPage.MTApp.MarketingServices.Promotions.Update(p); LoadUserIsInGroupEditor(q); }
protected void gvUserIsInGroup_RowDeleting(object sender, GridViewDeleteEventArgs e) { Promotion p = GetCurrentPromotion(); UserIsInGroup q = (UserIsInGroup)GetCurrentQualification(p); if (q == null) { return; } string bvin = (string)e.Keys[0]; q.RemoveGroup(bvin); MyPage.MTApp.MarketingServices.Promotions.Update(p); LoadUserIsInGroupEditor(q); }