Exemplo n.º 1
0
 public LinkCreationViewModel(long communityId, GroupLink link)
 {
     this._communityId = communityId;
     this._link        = link;
     if (link == null)
     {
         this.PageTitle         = CommonResources.LinkAdding;
         this.AddressForeground = (SolidColorBrush)Application.Current.Resources["PhoneContrastTitleBrush"];
         this.IsAddressReadOnly = false;
     }
     else
     {
         this.PageTitle         = CommonResources.LinkEditing;
         this.AddressForeground = (SolidColorBrush)Application.Current.Resources["PhoneCommunityManagementSectionIconBrush"];
         this.IsAddressReadOnly = true;
         if (link.edit_title == 1)
         {
             this.Address     = Extensions.ForUI(link.desc);
             this.Description = Extensions.ForUI(link.name);
         }
         else
         {
             this.Address     = Extensions.ForUI(link.name);
             this.Description = Extensions.ForUI(link.desc);
         }
     }
 }
Exemplo n.º 2
0
 private IEnumerable <GroupLink> GetItems()
 {
     for (GroupLink g = _firstNode._groupLink; g != null; g = g.Next)
     {
         yield return(g);
     }
 }
Exemplo n.º 3
0
    void SplitGroup()
    {
        grplist.Clear();
        bool   oneshoot    = false;
        string strleft     = txt;
        string savedstring = "";
        string wtype       = "";

        for (int i = 0; i < strleft.Length; i++)
        {
            if (oneshoot == false)
            {
                if (strleft.Substring(i, 1) == keyword)
                {
                    //
                    GroupStr grp_str = new GroupStr();
                    grp_str.txt_info = savedstring;
                    grplist.Add(grp_str);
                    savedstring = "";
                    oneshoot    = true;

                    //检查下一个字符,判断下一组是啥类型
                    i++;
                    wtype = strleft.Substring(i, 1);
                }
                else
                {
                    savedstring += strleft.Substring(i, 1);
                }
            }
            else
            {
                //等待结束符
                if (strleft.Substring(i, 1) == keyword)
                {
                    //
                    if (wtype == "P")
                    {
                        GroupIco grp_ico = new GroupIco();
                        grp_ico.txt_info = savedstring;
                        grplist.Add(grp_ico);
                    }
                    else if (wtype == "L")
                    {
                        //wtype = (int)ENUM_TPMIX_GROUPTYPE.GROUP_LINK;
                        GroupLink grp_ico = new GroupLink();
                        grplist.Add(grp_ico);
                    }
                    savedstring = "";
                    oneshoot    = false;
                }
                else
                {
                    savedstring += strleft.Substring(i, 1);
                }
            }
        }
    }
Exemplo n.º 4
0
 public LinkHeader(GroupLink link)
 {
     this.Id          = link.id;
     this.Photo       = link.photo_100;
     this.Title       = link.name.ForUI();
     this.Description = link.desc.ForUI();
     this.Link        = link;
     this.Url         = link.url;
 }
Exemplo n.º 5
0
        public void AddToLinkEntities <TOne, TTwo>(GroupLink groupLink, string groupOne, string groupTwo, string creatorPrincipalId)
            where TOne : ITaggableEntity
            where TTwo : ITaggableEntity
        {
            var entityLeftTag  = _tagBusinessLogic.GetTags <TOne>().FirstOrDefault(tag => tag.Id == Guid.Parse(groupOne));
            var entityRightTag = _tagBusinessLogic.GetTags <TTwo>().FirstOrDefault(tag => tag.Id == Guid.Parse(groupTwo));

            _tagBusinessLogic.AddToLinkEntities(groupLink.Name, entityLeftTag, entityRightTag, creatorPrincipalId);
        }
        protected void Button_MakeGroup_Click(object sender, EventArgs e)
        {
            string  s = TextBox_GroupName.Text;
            Utility u = new Utility();
            //string s1 = u.GetStaffCodefromContext(this.Context);
            string s1 = u.GetsStaffCodefromRequest(Request);
            Guid   g  = new Guid(u.Get_StaffID(s1));

            GroupList gl1 = new GroupList();

            gl1.LoadList_StaffPrivateGroups(s1, GroupList.GroupListOrder.GroupName);

            string code = s1 + "_" + (gl1._groups.Count + 1).ToString();

            Group g1 = new Group();

            g1._CourseID = Cerval_Globals.newdawnCse;
            int y = DateTime.Now.Year;

            if (DateTime.Now.Month > 7)
            {
                y++;
            }
            g1._EndDate                    = new DateTime(y, 7, 31);
            g1._GroupCode                  = code;
            g1._GroupManagedBy             = g;
            g1._GroupName                  = s;
            g1._GroupPrimaryAdministrative = false;
            g1._StartDate                  = DateTime.Now.AddDays(-2);
            g1.Save();

            //now need to insert into New Dawn stuff....

            Group g2 = new Group(); g2.Load("StaffGps", DateTime.Now);

            if (g2._valid)
            {
                GroupLink gll1 = new GroupLink();
                gll1.ParentId = g2._GroupID;
                gll1.ChildId  = g1._GroupID;
                gll1.Save();
            }
            gl1._groups.Clear();
            //string staff_code = u.GetStaffCodefromContext(Context);
            string staff_code = u.GetsStaffCodefromRequest(Request);

            gl1.LoadList_StaffPrivateGroups(staff_code.Trim(), GroupList.GroupListOrder.GroupName);
            DropDownList_groups.Items.Clear();
            foreach (Group g3 in gl1._groups)
            {
                System.Web.UI.WebControls.ListItem l = new ListItem(g3._GroupName, g3._GroupID.ToString());
                DropDownList_groups.Items.Add(l);
            }
        }
Exemplo n.º 7
0
        protected void ProcessMakeGroup(string p)
        {
            string s = p;

            string[] parameters = new string[3];
            string[] splitchar  = new string[2];
            //parameters are students%GroupName
            splitchar[0] = "%";
            parameters   = p.Split(splitchar, StringSplitOptions.RemoveEmptyEntries);
            splitchar[0] = ":"; splitchar[1] = ",";
            parameters   = parameters[0].Split(splitchar, StringSplitOptions.RemoveEmptyEntries);
            s            = parameters[1];//has group name....

            Utility u = new Utility();
            //string s1=u.GetStaffCodefromContext(Context);
            string s1 = u.GetsStaffCodefromRequest(Request);
            Guid   g  = new Guid(u.Get_StaffID(s1));

            GroupList gl1 = new GroupList();

            gl1.LoadList_StaffPrivateGroups(s1, GroupList.GroupListOrder.GroupName);

            string code = s1 + "_" + (gl1._groups.Count + 1).ToString();

            Group g1 = new Group();

            g1._CourseID = Cerval_Globals.newdawnCse;
            int y = DateTime.Now.Year;

            if (DateTime.Now.Month > 7)
            {
                y++;
            }
            g1._EndDate                    = new DateTime(y, 7, 31);
            g1._GroupCode                  = code;
            g1._GroupManagedBy             = g;
            g1._GroupName                  = s;
            g1._GroupPrimaryAdministrative = false;
            g1._StartDate                  = DateTime.Now.AddDays(-2);
            g1.Save();

            //now need to insert into New Dawn stuff....

            Group g2 = new Group(); g2.Load("StaffGps", DateTime.Now);

            if (g2._valid)
            {
                GroupLink gll1 = new GroupLink();
                gll1.ParentId = g2._GroupID;
                gll1.ChildId  = g1._GroupID;
                gll1.Save();
            }
        }
Exemplo n.º 8
0
 public TValue this[int index]
 {
     get
     {
         GroupLink node = Get(index);
         if (node == null)
         {
             throw new IndexOutOfRangeException();
         }
         return(node.Value);
     }
 }
Exemplo n.º 9
0
 public LinkedNode(TValue value, LinkedNode previous)
 {
     _value = value;
     if ((_previous = previous) == null)
     {
         _next = null;
     }
     else if ((_next = previous._next) != null)
     {
         _next._previous = this;
     }
     _groupLink = new GroupLink(this);
 }
Exemplo n.º 10
0
 public LinkItem(GroupLink link)
     : base(ProfileInfoItemType.Full)
 {
     this.Title            = link.name.ForUI();
     this.Data             = (object)link.desc.ForUI();
     this.GroupImage       = link.photo_100;
     this.NavigationAction = (Action)(() => Navigator.Current.NavigateToWebUri(link.url, false, false));
     if (!string.IsNullOrEmpty(this.GroupImage))
     {
         this.TitleMaxWidth = 370.0;
     }
     else
     {
         this.TitleMaxWidth = 448.0;
     }
 }
Exemplo n.º 11
0
        public LinkHeader(GroupLink link)
        {
            this.IsActionButtonEnabled = true;
            this._blockVisibility      = Visibility.Visible;
            this.ActionButtonIcon      = "/Resources/WallPost/CardActions.png";
            this.ActionButtonSize      = 56.0;
            Action <FrameworkElement> arg_5E_1 = new Action <FrameworkElement>(e => { ContextMenuService.GetContextMenu(e).IsOpen = true; });

            this.ActionButtonAction = arg_5E_1;

            this.Id          = link.id;
            this.Photo       = link.photo_100;
            this.Title       = link.name.ForUI();
            this.Description = link.desc.ForUI();
            this.Link        = link;
            this.Url         = link.url;
        }
Exemplo n.º 12
0
        private void AddEditCallback(ResultCode resultCode, VKRequestsDispatcher.Error error, GroupLink resultData)
        {
            Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (resultCode == ResultCode.Succeeded)
                {
                    if (this._link != null)
                    {
                        if (this._link.edit_title == 1)
                        {
                            this._link.name = this.Description;
                        }
                        else
                        {
                            this._link.desc = this.Description;
                        }
                    }
                    EventAggregator current = EventAggregator.Current;
                    CommunityLinkAddedOrEdited linkAddedOrEdited = new CommunityLinkAddedOrEdited();
                    linkAddedOrEdited.CommunityId = this._communityId;
                    int num = this._link != null ? 1 : 0;
                    linkAddedOrEdited.IsEditing = num != 0;
                    GroupLink groupLink = this._link ?? resultData;
                    linkAddedOrEdited.Link = groupLink;
                    current.Publish((object)linkAddedOrEdited);
                    Navigator.Current.GoBack();
                }
                else
                {
                    this.SetInProgress(false, "");
                    this.IsFormEnabled = true;
                    VKRequestsDispatcher.Error error1 = error;
                    switch (error1 != null ? error1.error_text : (string)null)
                    {
                    case null:
                        GenericInfoUC.ShowBasedOnResult((int)resultCode, "", error);
                        break;

                    default:
                        error.error_text += ".";
                        goto case null;
                    }
                }
            }));
        }
Exemplo n.º 13
0
        public void LinkGroupEntities(
            string linkName,
            Tag entitiesGroupLeft,
            Tag entitiesGroupRight,
            string creatorPrincipalId,
            IDocumentSession tenantSession)
        {
            var groupLink = new GroupLink
            {
                GroupOne           = entitiesGroupLeft,
                GroupTwo           = entitiesGroupRight,
                CreateDate         = DateTime.UtcNow,
                CreatorPrincipalId = creatorPrincipalId,
                Name = linkName
            };

            tenantSession.Store(groupLink);
            tenantSession.SaveChanges();
        }
Exemplo n.º 14
0
        protected override void HandleOnNavigatedTo(NavigationEventArgs e)
        {
            base.HandleOnNavigatedTo(e);
            long                  communityId = long.Parse(((Page)this).NavigationContext.QueryString["CommunityId"]);
            GroupLink             link        = ParametersRepository.Contains("CommunityLink") ? (GroupLink)ParametersRepository.GetParameterForIdAndReset("CommunityLink") :  null;
            LinkCreationViewModel viewModel   = new LinkCreationViewModel(communityId, link);

            base.DataContext = viewModel;
            ApplicationBarIconButton applicationBarIconButton1 = new ApplicationBarIconButton();
            Uri uri1 = new Uri("/Resources/check.png", UriKind.Relative);

            applicationBarIconButton1.IconUri = uri1;
            string appBarMenuSave = CommonResources.AppBarMenu_Save;

            applicationBarIconButton1.Text = appBarMenuSave;
            int num = link != null ? 1 : 0;

            applicationBarIconButton1.IsEnabled = (num != 0);
            ApplicationBarIconButton appBarButtonSave          = applicationBarIconButton1;
            ApplicationBarIconButton applicationBarIconButton2 = new ApplicationBarIconButton();
            Uri uri2 = new Uri("/Resources/appbar.cancel.rest.png", UriKind.Relative);

            applicationBarIconButton2.IconUri = uri2;
            string appBarCancel = CommonResources.AppBar_Cancel;

            applicationBarIconButton2.Text = appBarCancel;
            ApplicationBarIconButton applicationBarIconButton3 = applicationBarIconButton2;

            appBarButtonSave.Click += ((EventHandler)((p, f) =>
            {
                ((Control)this).Focus();
                viewModel.AddEditLink();
            }));
            applicationBarIconButton3.Click += ((EventHandler)((p, f) => Navigator.Current.GoBack()));
            this.ApplicationBar              = ((IApplicationBar)ApplicationBarBuilder.Build(new Color?(), new Color?(), 0.9));
            viewModel.PropertyChanged       += (PropertyChangedEventHandler)((p, f) => appBarButtonSave.IsEnabled = (viewModel.IsFormCompleted && viewModel.IsFormEnabled));
            this.ApplicationBar.Buttons.Add(appBarButtonSave);
            this.ApplicationBar.Buttons.Add(applicationBarIconButton3);
        }
Exemplo n.º 15
0
        public ActionResult AssignGroup(GroupLink groupLink, string groupOne, string groupTwo, string type)
        {
            var user = User as ApplicationUser;

            try
            {
                _groupLinkUILogic
                .AddToLinkEntities(groupLink, groupOne, groupTwo, user.PrincipalId, type);
            }

            catch (Exception exception)
            {
                _log.ErrorFormat("Current User: {0} - An exception occurred with the following message: {1}",
                                 user.UserName, exception.Message);

                if (!ExceptionHandler.Manage(exception, this, Layer.UILogic))
                {
                    return(RedirectToAction("Error", "Errors"));
                }
            }

            return(PartialView(groupLink));
        }
Exemplo n.º 16
0
 internal void Remove(GroupLink nextInGroup)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 17
0
 /// <summary>
 /// </summary>
 /// <param name="groupLinks">Group links to be created for the host prototype.</param>
 /// <param name="ruleid">ID of the LLD rule that the host prototype belongs to.</param>
 public Create(GroupLink[] groupLinks, string ruleid)
 {
     this.groupLinks = groupLinks;
     this.ruleid = ruleid;
 }