public static PlaylistTreeItemViewModel FromSPPlaylist(ServiceReference.Playlist playlist, IEnumerable<PlaylistTreeItemViewModel> children = null)
 {
     if (playlist.Type == ServiceReference.PlaylistType.Playlist)
         return new Playlist(playlist);
     else
         return new PlaylistFolder(playlist, children);
 }
        private void Wrapper_AgregarPeticionCompleted(object sender, ServiceReference.AgregarPeticionCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                string temp = e.Result.Substring(0, 3);
                string recievedResponce = e.Result.Substring(3);
                if (recievedResponce == "False" || recievedResponce == "")
                {
                    if (flags[2])
                    {
                        flags[2] = false;
                        MessageBox.Show("Usuario o Password Incorrecta.  Intente de nuevo");
                        App.UserIsAuthenticated = false;
                        NavigationService.Refresh();
                    }
                }
                else
                {
                    switch (temp)
                    {
                        case "p23"://Login
                            if (flags[0])
                            {
                                flags[0] = false;
                                loginDatos = MainPage.tc.getLoginDatos(e.Result.Substring(3));
                                App.Username = loginDatos[0] + " " + loginDatos[1] + " " + loginDatos[2] + " " + loginDatos[3];
                                App.Correo = login.Usuario;
                                for (int i = 4; i < loginDatos.Count - 1; i++)
                                    Permisos.Add(loginDatos[i]);
                                App.Permisos = Permisos;
                                App.UserIsAuthenticated = true;
                                App.Rol = loginDatos[loginDatos.Count - 1];
                                AppEvents.Instance.UpdateMain(sender);
                                MessageBox.Show("Login Exitoso!");
                                NavigationService.Refresh();
                            }
                            break;

                        default:
                            if (flags[2])
                            {
                                flags[2] = false;
                                MessageBox.Show("Usuario o Password Incorrecta.  Intente de nuevo");
                                App.UserIsAuthenticated = false;
                                
                            }
                            break;
                    }
                }
            }
            else
            {
                if (flags[2])
                {
                    flags[2] = false;
                    MessageBox.Show("Usuario o Password Incorrecta.  Intente de nuevo");
                    App.UserIsAuthenticated = false;
                }
            }
        }
Beispiel #3
0
 public PlaylistViewModel(ServiceReference.Playlist pl)
 {
     Id = pl.Id;
     Name = pl.Name;
     tracks = new BindingList<TrackViewModel>();
     loaded = false;
 }
		/// <summary>
		/// Instanciation du match
		/// </summary>
		/// <param name="match">Un match du web service</param>
		/// <remarks>
		/// Les jedis sont null si c'est une phase non encore jouee
		/// </remarks>
		public MatchViewModel(ServiceReference.MatchWS match) {
			this.Id = Id;
			this.Jedi1 = ((match.Jedi1 != null) ? new JediViewModel(match.Jedi1) : null);
			this.Jedi2 = ((match.Jedi2 != null) ? new JediViewModel(match.Jedi2) : null);
			this.JediVainqueur = ((match.JediVainqueur != null) ? new JediViewModel(match.JediVainqueur) : null);
			this.Stade = new StadeViewModel(match.Stade);
			this.Phase = match.Phase;
		}
		public StadeViewModel(ServiceReference.StadeWS stade) {
			this.Id = stade.Id;
			this.Planete = stade.Planete;
			this.NbPlaces = stade.NbPlaces;

			List<CaracteristiqueViewModel> tmpList = new List<CaracteristiqueViewModel>();
			foreach(var car in stade.Caracteristiques) {
				tmpList.Add(new CaracteristiqueViewModel(car));
			}
			this.Caracteristiques = new CaracteristiqueCollection(tmpList);
		}
Beispiel #6
0
		public JediViewModel(ServiceReference.JediWS jedi) {
            if(jedi != null)
            {
			    this.Id = jedi.Id;
			    this.Nom = jedi.Nom;
			    this.IsSith = jedi.IsSith;

			    List<CaracteristiqueViewModel> tmpList = new List<CaracteristiqueViewModel>();
			    foreach(var car in jedi.Caracteristiques) {
				    tmpList.Add(new CaracteristiqueViewModel(car));
			    }
			    this.Caracteristiques = new CaracteristiqueCollection(tmpList);
            }
		}
        public static List<IntermediaryResponse> SearchRegistration(ServiceReference.intermediarySearchRequest intermediarySearchRequest)
        {
            var result = new List<IntermediaryResponse>();

            HttpWebRequest request = CreateWebRequest();
            var soapRequest = GetOriasXmlRequest(intermediarySearchRequest);
            using (Stream stream = request.GetRequestStream())
            {
                soapRequest.Save(stream);
            }
            // If required by the server, set the credentials.
            request.Credentials = CredentialCache.DefaultCredentials;
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Stream dataStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(dataStream);
            string responseFromServer = reader.ReadToEnd();

            responseFromServer = RemoveAllNamespaces(responseFromServer);

            XmlDocument xmlResponse = new XmlDocument();
            xmlResponse.LoadXml(responseFromServer);

            var searchResponse = xmlResponse.GetElementsByTagName("intermediary");
            if (searchResponse != null && searchResponse.Count > 0)
            {
                //var firstNode = searchResponse[0];
                //XmlSerializer xmlser = new XmlSerializer(typeof(List<IntermediaryResponse>));
                //var xml = firstNode.InnerXml.Replace("intermediary", "IntermediaryResponse");
                //var repReader = new StringReader(xml);
                //result = (List<IntermediaryResponse>)xmlser.Deserialize(repReader);
                //repReader.Close();

                StringReader repReader = null;
                for (var i = 0; i < searchResponse.Count; i++)
                {
                    var xmlser = new XmlSerializer(typeof(IntermediaryResponse));
                    var txtXml = string.Format("<IntermediaryResponse>{0}</IntermediaryResponse>", searchResponse[i].InnerXml);
                    repReader = new StringReader(txtXml);
                    var tmp = (IntermediaryResponse)xmlser.Deserialize(repReader);
                    result.Add(tmp);
                }
                if (repReader != null) repReader.Close();
            }
            reader.Close();
            dataStream.Close();
            response.Close();

            return result;
        }
		public TournoiViewModel(ServiceReference.TournoiWS tournoi) {
			this.Id = tournoi.Id;
			this.Nom = tournoi.Nom;

            List<MatchViewModel> tmpList = new List<MatchViewModel>();
            List<JediViewModel> tmpList2 = new List<JediViewModel>();
            foreach (var mat in tournoi.Matches)
            {
                tmpList.Add(new MatchViewModel(mat));
                if(mat.Jedi1!=null)
                    tmpList2.Add(new JediViewModel(mat.Jedi1));
                if (mat.Jedi2 != null)
                    tmpList2.Add(new JediViewModel(mat.Jedi2));
            }
			this.Matches = new MatchCollection(tmpList);
            this.Jedis = new JediCollection(tmpList2);
		}
Beispiel #9
0
 public void TestMethod1()
 {
     var client = new DubboClient("net-consumer", "zookeeper", "zookeeper://192.168.10.14:2181", 2181);
     using (var reference = new ServiceReference<ShoyService>())
     {
         reference.DubboClient = client;
         reference.Registry = client.Registry;
         reference.Timeout = 1000;
         var service = reference.Get();
         var word = service.sayHello("shoy");
         Console.WriteLine(word);
         var number = service.add(4, 34);
         Console.WriteLine(number);
         var user = service.getUser();
         Console.WriteLine(user.getId());
         Console.WriteLine(JsonHelper.ToJson(user, NamingType.CamelCase, true));
         Assert.AreNotEqual(user, null);
     }
 }
        private static XmlDocument GetOriasXmlRequest(ServiceReference.intermediarySearchRequest request)
        {
            var intermediary = "";
            foreach (var r in request.intermediaries)
            {
                var key = r.ItemElementName.ToString();
                var val = r.Item;
                intermediary += string.Format("<intermediary><{0}>{1}</{0}></intermediary>", key, val);
            }

            var intermediariesNode = string.Format("<intermediaries>{0}</intermediaries>", intermediary);
            var userNode = string.Format("<user>{0}</user>", request.user);

            var nameSpace = "tns:";
            var intermediarySearchRequest = string.Format("<{0}intermediarySearchRequest>{1}{2}</{0}intermediarySearchRequest>", nameSpace, userNode, intermediariesNode);

            var soapXml = GetSoapEnvelope();
            var body = soapXml.GetElementsByTagName("soapenv:Body")[0];
            body.InnerXml = intermediarySearchRequest;

            return soapXml;
        }
Beispiel #11
0
 /// <summary>
 /// This method will be called by <see cref="Qualifies(ServiceReference, Attribute)"/>. The <paramref name="attribute"/> will be casted to <typeparamref name="TAttribute"/>.
 /// </summary>
 /// <param name="reference">The <see cref="ServiceReference"/>.</param>
 /// <param name="attribute">The qualifier attribute.</param>
 /// <returns><c>true</c> if <paramref name="reference"/> satisfies the condition of qualifier <paramref name="attribute"/>; <c>false</c> otherwise.</returns>
 protected abstract Boolean Qualifies(ServiceReference reference, TAttribute attribute);
Beispiel #12
0
 public MockServiceReferenceWrapper(ServiceReference serviceReference, bool isBroken = false) : base(serviceReference)
 {
     _isBroken = isBroken;
 }
Beispiel #13
0
 /// <summary>
 /// Checks whether given service reference has same activation status as the one specified in service qualifier attribute.
 /// </summary>
 /// <param name="reference">The <see cref="ServiceReference"/>.</param>
 /// <param name="attribute">The <see cref="ActiveAttribute"/>.</param>
 /// <returns><c>true</c> if <see cref="ServiceReference.Active"/> property for <paramref name="reference"/> has same value as <see cref="ActiveAttribute.ActiveStatus"/> property for <paramref name="attribute"/>; <c>false</c> otherwise.</returns>
 protected override Boolean Qualifies(ServiceReference reference, ActiveAttribute attribute)
 {
     return(reference.Active == attribute.ActiveStatus);
 }
Beispiel #14
0
 internal ServiceReference[] getServicesInUse()
 {
     ServiceReference[] references = new ServiceReference[bundleUsingServiceReferenceList.Count];
     bundleUsingServiceReferenceList.CopyTo(references, 0);
     return(references);
 }
 public static ServiceDiscoveryQuery Create(ServiceReference consumedService)
 {
     return(new ServiceDiscoveryQuery(consumedService));
 }
Beispiel #16
0
        /// <summary>Method inherited from interface org.osgi.framework.ServiceListener.
        /// Called when some ServiceEvent is processed - a service is registered,
        /// unregistered or modified.
        /// </summary>
        public virtual void  serviceChanged(ServiceEvent event_Renamed)
        {
            /*DO NOT CHANGE THIS CODE!!!IT'S AUTOMATICALLY GENERATED*/
            switch (event_Renamed.Type)
            {
            case ServiceEvent.REGISTERED:  {
                /*Service has been registered.*/
                /*Constructing an array to hold all names, that the registered service has been registered with.*/
                o("ServiceEvent.REGISTERED");
                System.String[] classNames = (System.String[])event_Renamed.ServiceReference.getProperty("objectClass");
                for (int k = 0; k < classNames.Length; k++)
                {
                    System.String objectClass = classNames[k];
                    /*Searching for service with name "InHausBasedriver.InHausBasedriver".*/
                    if (objectClass.Equals(SERVICE_INHAUSBASEDRIVER))
                    {
                        /*!--------------PART FOR GETTING SERVICES--------------*/
                        /*Getting ServiceReference for service with name "InHausBasedriver.InHausBasedriver" through BundleContext passed to start method.*/
                        refInHausBaseDriver = bc.getServiceReference(SERVICE_INHAUSBASEDRIVER);
                        if (refInHausBaseDriver != null)
                        {
                            /*If a service with such name is already registered in the framework.*/
                            /*Getting service object.*/
                            inHausBaseDriver = (InHausBaseDriver)bc.getService(refInHausBaseDriver);
                            o("inHausBaseDriver = (InHausBaseDriver)bc.getService(refInHausBaseDriver);");
                            lamp.setDriver(inHausBaseDriver);
                        }
                        /*!--------------END OF PART FOR GETTING SERVICES--------------*/

                        break;
                    }
                }
                break;
            }

            case ServiceEvent.UNREGISTERING:  {
                /*Service has been unregistered*/
                o("ServiceEvent.UNREGISTERING");
                /*Constructing an array to hold all names, that the registered service has been registered with.*/
                System.String[] classNames = (System.String[])event_Renamed.ServiceReference.getProperty("objectClass");
                for (int k_1 = 0; k_1 < classNames.Length; k_1++)
                {
                    System.String objectClass = classNames[k_1];
                    /*Searching for service with name "InHausBasedriver.InHausBasedriver".*/
                    if (objectClass.Equals(SERVICE_INHAUSBASEDRIVER))
                    {
                        /*!--------------PART FOR UNGETTING SERVICES--------------*/
                        if (refInHausBaseDriver != null)
                        {
                            /*Ungetting service if the ServiceReference is not null, i.e. the service has been gotten.*/
                            bc.ungetService(refInHausBaseDriver);
                            lamp.Driver = null;
                        }
                        /*!--------------END OF PART FOR UNGETTING SERVICES--------------*/

                        break;
                    }
                }
                break;
            }
            }
            /*END OF AUTOMATICALLY GENERATED CODE*/
        }
Beispiel #17
0
 public object getService(ServiceReference reference)
 {
     return(framework.getService(reference, getBundle()));
 }
Beispiel #18
0
 /// <summary>
 /// Receives the latest textual content from a document.
 /// </summary>
 /// <param name="sender">The sender of the content</param>
 /// <param name="args">The textual content of the document</param>
 public void proxy_GetLatestPureDocumentContentCompleted(Object sender, ServiceReference.GetLatestPureDocumentContentCompletedEventArgs args)
 {
     string pureContent = args.Result;
     gui.richTextBox.SelectAll();
     gui.richTextBox.Selection.Text = pureContent;
 }
Beispiel #19
0
        private void proxy_GetAllDocumentRevisionsByDocumentIdCompleted(object sender, ServiceReference.GetAllDocumentRevisionsByDocumentIdCompletedEventArgs args)
        {
            ServiceReference.ServiceDocumentrevision[] revisions = args.Result.ToArray();

            for (int i = 0; i < revisions.Length; i++)
            {
                TreeViewItem item = new TreeViewItem();
                item.Header = revisions[i].creationTime;
                item.Tag = revisions[i].id;
                item.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(item_MouseLeftButtonUp);

                session.RevisionDialog.treeViewRevisions.Items.Add(item);
            }

            session.RevisionDialog.labelDocumentName.Text = session.CurrentDocumentTitle;
            session.RevisionDialog.Show();
        }
Beispiel #20
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);
            try
            {
                ServiceReference service = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/StreamService.asmx");
                service.InlineScript = true;
                ScriptManager.GetCurrent(Page).Services.Add(service);
                imgAd.Src         = ResolveUrl("~/images/iphoneAd.png");
                imgCheck.ImageUrl = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/iCheck.png");

                if (!Page.IsPostBack && !Page.IsCallback)
                {
                    imgSearch.Src = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/iSearch.png");
                    imgCenter.Src = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/iCenter.png");
                    aqufitEntities entities = new aqufitEntities();
                    long           rId      = 0;
                    if (HttpContext.Current.Items["r"] != null)
                    {
                        rId = Convert.ToInt64(HttpContext.Current.Items["r"]);
                    }
                    else if (Request["r"] != null)
                    {
                        rId = Convert.ToInt64(Request["r"]);
                    }
                    else if (HttpContext.Current.Items["w"] != null)
                    {
                        long workoutId = Convert.ToInt64(HttpContext.Current.Items["w"]);
                        rId = entities.UserStreamSet.OfType <Workout>().Where(w => w.Id == workoutId).Select(w => w.WorkoutExtendeds.FirstOrDefault().MapRoute.Id).FirstOrDefault();
                    }
                    else if (Request["w"] != null)
                    {
                        long workoutId = Convert.ToInt64(Request["w"]);
                        rId = entities.UserStreamSet.OfType <Workout>().Where(w => w.Id == workoutId).Select(w => w.WorkoutExtendeds.FirstOrDefault().MapRoute.Id).FirstOrDefault();
                    }
                    // Are we viewing a specific route ?
                    if (rId > 0)
                    {
                        hiddenRouteKey.Value = "" + rId;

                        MapRoute route = entities.MapRoutes.Include("UserSetting").Include("MapRoutePoints").FirstOrDefault(m => m.Id == rId);
                        if (base.UserSettings != null)
                        {
                            bAddRoute.Visible = entities.User2MapRouteFav.FirstOrDefault(mr => mr.MapRoute.Id == route.Id && mr.UserSettingsKey == UserSettings.Id) == null;
                        }
                        Affine.Utils.UnitsUtil.MeasureUnit unit = this.UserSettings != null && this.UserSettings.DistanceUnits != null?Affine.Utils.UnitsUtil.ToUnit(this.UserSettings.DistanceUnits.Value) : Affine.Utils.UnitsUtil.MeasureUnit.UNIT_MILES;

                        string dist = Math.Round(Affine.Utils.UnitsUtil.systemDefaultToUnits(route.RouteDistance, unit), 2) + " " + Affine.Utils.UnitsUtil.unitToStringName(unit);
                        lRouteTitle.Text = route.Name + " (" + dist + ")";
                        lRouteInfo.Text  = "<span>A " + dist + " route posted by <a class=\"username\" href=\"/" + route.UserSetting.UserName + "\">" + route.UserSetting.UserName + "</a> on " + route.CreationDate.ToShortDateString() + "</span>";
                        double centerLat = (route.LatMax + route.LatMin) / 2;
                        double centerLng = (route.LngMax + route.LngMin) / 2;
                        atiGMapView.Lat = centerLat;
                        atiGMapView.Lng = centerLng;
                        if (route.ThumbZoom.HasValue)
                        {
                            atiGMapView.Zoom = (short)(route.ThumbZoom.Value + 2);
                        }
                        atiGMapView.Route      = route;
                        atiProfileImg.Settings = route.UserSetting;
                        atiRoutePanel.Visible  = false;
                        atiRouteViewer.Visible = true;

                        string js = string.Empty;

                        //js += "Affine.WebService.StreamService.GetRoutes(" + centerLat + ", " + centerLng + ", 10, 0, 5, 'distance', function (json) { ";
                        js += "Aqufit.Page.atiSimilarRouteListScript.dataBinder = function(skip, take){ \n";
                        js += "     Affine.WebService.StreamService.GetSimilarRoutes(" + rId + ", 10, skip, take, 'distance', function (json) { \n";
                        js += "         Aqufit.Page.atiSimilarRouteListScript.generateStreamDom(json); \n";
                        js += "     }); \n";
                        js += "};";
                        js += " Aqufit.Page.atiSimilarRouteListScript.dataBinder(0,5); ";
                        atiShareLink.ShareLink  = "http://" + Request.Url.Host + "/route/" + route.Id;
                        atiShareLink.ShareTitle = "FlexFWD.com Mapped Route: \"" + route.Name + "\"";

                        routeTabTitle.Text = "&nbsp;" + (string.IsNullOrWhiteSpace(route.Name) ? "Untitled" : route.Name);

                        Affine.WebService.StreamService ss = new WebService.StreamService();
                        string json = ss.getStreamDataForRoute(route.Id, 0, 5);
                        //generateStreamDom

                        ScriptManager.RegisterStartupScript(this, Page.GetType(), "SimilarRouteList", "$(function(){ " + js + " Aqufit.Page.atiStreamScript.generateStreamDom('" + json + "'); });", true);
                    }
                    else
                    {
                        if (Settings["Configure"] != null && Convert.ToString(Settings["Configure"]).Equals("ConfigureMyRoutes"))
                        {
                            atiMyRoutePanel.Visible = true;
                            mapContainer.Visible    = false;
                            atiRoutePanel.Visible   = true;
                            routeTabTitle.Text      = "My Routes";
                            liMyRoutes.Visible      = false;
                            liFindRoute.Visible     = true;
                            WebService.StreamService streamService = new WebService.StreamService();
                            string json = streamService.GetMyRoutes(base.UserSettings.Id, 0, 10, "date");
                            string js   = string.Empty;
                            //js += "Affine.WebService.StreamService.GetRoutes(" + centerLat + ", " + centerLng + ", 10, 0, 5, 'distance', function (json) { ";
                            js += "$(function(){ Aqufit.Page.atiRouteListScript.isMyRoutes = true; Aqufit.Page.atiRouteListScript.generateStreamDom('" + json + "'); \n";
                            js += "     Aqufit.Page.atiRouteListScript.dataBinder = function(skip, take){ \n";
                            js += "         Affine.WebService.StreamService.GetMyRoutes(" + base.UserSettings.Id + ", skip, take, 'date', function (json) { \n";
                            js += "             Aqufit.Page.atiRouteListScript.generateStreamDom(json); \n";
                            js += "         }); \n";
                            js += "     } \n";
                            js += " }); \n";

                            ScriptManager.RegisterStartupScript(this, Page.GetType(), "RouteList", js, true);
                        }
                        else
                        {
                            routeTabTitle.Text     = "Routes";
                            atiRoutePanel.Visible  = true;
                            atiRouteViewer.Visible = false;
                            SetupPage();        // do normal page setup
                        }
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #21
0
 public static void UnpackScreenCaptureData(ServiceReference.WindowData data, out Image image, out Rectangle bounds)
 {
     var ms = new MemoryStream(data.Image, 0, data.Image.Length);
     bounds = new Rectangle();
     image = null;
     if (data.Image != null)
     {
         ms.Write(data.Image, 0, data.Image.Length);
         image = Image.FromStream(ms, true);
         bounds = new Rectangle(data.Left, data.Top, data.Right, data.Bottom);
     }
 }
Beispiel #22
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);
            try
            {
                this.BackgroundImageUrl = ResolveUrl("~/DesktopModules/ATI_Base/services/images/profile.aspx") + "?us=0&bg=1";
                aqufitEntities entities = new aqufitEntities();
                GroupType[]    gTypes   = entities.GroupTypes.ToArray();

                if (!Page.IsPostBack && !Page.IsCallback)
                {
                    ServiceReference service = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/RegisterService.asmx");
                    service.InlineScript = true;
                    ScriptManager.GetCurrent(Page).Services.Add(service);
                    ServiceReference service2 = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/StreamService.asmx");
                    service2.InlineScript = true;
                    ScriptManager.GetCurrent(Page).Services.Add(service2);

                    if (Request.Url.AbsoluteUri.Contains("http://www."))
                    {
                        Response.Redirect(Request.Url.AbsoluteUri.Replace("http://www.", "http://"), true);
                        return;
                    }
                    if (Request["t"] != null)
                    {
                        RadAjaxManager1.ResponseScripts.Add(" $(function(){ Aqufit.Page.Tabs.SwitchTab(" + Request["t"] + "); }); ");
                    }
                    if (Request["oauth_token"] != null)
                    {
                        RadAjaxManager1.ResponseScripts.Add(" $(function(){ Aqufit.Page.Tabs.SwitchTab(4); }); ");
                    }
                    atiFindInvite.UserSettings = UserSettings;
                    atiFindInvite.TabId        = TabId;

                    ddlGroupType.DataSource     = gTypes;
                    ddlGroupType.DataTextField  = "TypeName";
                    ddlGroupType.DataValueField = "Id";
                    ddlGroupType.DataBind();

                    imgError.Src = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/iError.png");
                    imgCheck.Src = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/iCheck.png");


                    if (GroupSettings != null)   // This is a person trying to edit a group profile
                    {
                        atiFindInvite.GroupSettings   = GroupSettings;
                        hrefBackToProfile.Visible     = true;
                        hrefBackToProfile.HRef        = ResolveUrl("~/") + "group/" + GroupSettings.UserName;
                        hrefBackToProfile.InnerHtml   = "Back to " + GroupSettings.UserName + " page";
                        this.BackgroundImageUrl       = ResolveUrl("~/DesktopModules/ATI_Base/services/images/profile.aspx") + "?us=" + GroupSettings.Id + "&bg=1";
                        this.ProfileCSS               = GroupSettings.CssStyle;
                        bCreateGroup.Text             = "Update";
                        atiProfileImage.Settings      = GroupSettings;
                        atiProfileImage.GroupUserName = GroupSettings.UserName;
                        UserFriends perm = entities.UserFriends.FirstOrDefault(w => w.SrcUserSettingKey == UserSettings.Id && w.DestUserSettingKey == GroupSettings.Id && w.Relationship <= (int)Affine.Utils.ConstsUtil.Relationships.GROUP_ADMIN);
                        // check that they have permissions first (need to be a group admin)
                        if (perm != null)
                        {
                            SetupAccountEdit(GroupSettings);
                        }
                        else
                        {
                            Response.Redirect(ResolveUrl("~") + UserSettings.UserName, true);
                            return;
                        }
                    }
                    else
                    {   // This is a new group to register...
                        atiProfileImage.Visible = false;
                        RadAjaxManager1.ResponseScripts.Add("$(function(){ $('#tabs').tabs('option', 'disabled', [1,2,3, 4]); });");
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
 internal MethodReference(ServiceReference service, string name)
 {
     Service        = service;
     Name           = name;
     CallDescriptor = new MethodCallDescriptor(this);
 }
Beispiel #24
0
        /// <summary>
        /// Adds the service reference.
        /// </summary>
        /// <param myName="path">The path.</param>
        public void AddServiceReference(string path)
        {
            ServiceReference reference = new ServiceReference(path);

            ((BaseMaster)Master).ScriptManager.Services.Add(reference);
        }
Beispiel #25
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);
            try
            {
                RadAjaxManager1.AjaxSettings.AddAjaxSetting(panelAjax, panelAjax, RadAjaxLoadingPanel2);
                atiProfileImage.Settings = base.UserSettings;

                imgCheck.Src = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/iCheck.png");
                ServiceReference service = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/StreamService.asmx");
                service.InlineScript = true;
                ScriptManager.GetCurrent(Page).Services.Add(service);

                atiGMap.Lat  = UserSettings.LatHome;
                atiGMap.Lng  = UserSettings.LngHome;
                atiGMap.Zoom = 10;
                if (!Page.IsPostBack && !Page.IsCallback)
                {
                    aqufitEntities entities = new aqufitEntities();
                    // get all the users group ids
                    long[] groupIdArray   = entities.UserFriends.Where(g => (g.DestUserSettingKey == UserSettings.Id || g.SrcUserSettingKey == UserSettings.Id) && g.Relationship >= (int)Affine.Utils.ConstsUtil.Relationships.GROUP_OWNER).Select(g => (g.DestUserSettingKey == UserSettings.Id ? g.SrcUserSettingKey : g.DestUserSettingKey)).ToArray();
                    string groupKeyString = new string(groupIdArray.SelectMany(s => Convert.ToString(s) + ",").ToArray());
                    if (!string.IsNullOrWhiteSpace(groupKeyString))
                    {
                        groupKeyString = groupKeyString.Substring(0, groupKeyString.Length - 1);
                        RadAjaxManager1.ResponseScripts.Add(" $(function(){ Aqufit.Page.Groups = new Array(" + groupKeyString + "); }); ");
                    }
                    if (UserSettings.MainGroupKey.HasValue && UserSettings.MainGroupKey.Value > 1)
                    {
                        RadAjaxManager1.ResponseScripts.Add("$('#panelFindAffiliate').hide();");
                        Group homeGroup = entities.UserSettings.OfType <Group>().FirstOrDefault(g => g.Id == UserSettings.MainGroupKey.Value);
                        litAffiliateName.Text = homeGroup.UserFirstName;
                        RadAjaxManager1.ResponseScripts.Add(" $(function(){ Aqufit.Page.Actions.selectedPlace = {'Address': '', 'GroupKey':" + homeGroup.Id + ", 'Lat':" + homeGroup.DefaultMapLat + ", 'Lng':" + homeGroup.DefaultMapLng + " , 'Name':'" + homeGroup.UserFirstName + "', 'UserName':'******'", "") + "', 'UserKey':" + homeGroup.UserKey + ", 'ImageId':0, 'Description':''}; }); ");
                        bNotMyAffiliate.Visible = true;
                    }
                    // fill in know form fields
                    atiSlimControl.IsEditMode = true;
                    atiSlimControl.FullName   = UserSettings.UserFirstName + " " + UserSettings.UserLastName;
                    atiSlimControl.Email      = UserSettings.UserEmail;
                    txtTeamEmail.Text         = UserSettings.UserEmail;
                    atiSlimControl.ShowPostal = false;
                    atiBodyComp.IsEditMode    = true;
                    atiBodyComp.Gender        = UserSettings.Sex;
                    txtTeamCaptinName.Text    = atiSlimControl.FullName;
                    txtTeamCaptinEmail.Text   = atiSlimControl.Email;
                    if (UserSettings.BirthDate.HasValue)
                    {
                        atiBodyComp.BirthDate = UserSettings.BirthDate.Value;
                    }
                    // setup known times for Standard WODS
                    Workout fran = entities.UserStreamSet.OfType <Workout>().FirstOrDefault(w => w.UserSetting.Id == UserSettings.Id && w.WOD.Id == Affine.Utils.ConstsUtil.FRAN_ID && w.IsBest == true && w.Duration.HasValue);
                    if (fran != null)
                    {
                        atiTimeSpanFran.Time = fran.Duration.Value;
                        hiddenFranId.Value   = "" + fran.Id;
                    }
                    Workout helen = entities.UserStreamSet.OfType <Workout>().FirstOrDefault(w => w.UserSetting.Id == UserSettings.Id && w.WOD.Id == Affine.Utils.ConstsUtil.HELEN_ID && w.IsBest == true && w.Duration.HasValue);
                    if (helen != null)
                    {
                        atiTimeSpanHelen.Time = helen.Duration.Value;
                        hiddenHelenKey.Value  = "" + helen.Id;
                    }
                    Workout grace = entities.UserStreamSet.OfType <Workout>().FirstOrDefault(w => w.UserSetting.Id == UserSettings.Id && w.WOD.Id == Affine.Utils.ConstsUtil.GRACE_ID && w.IsBest == true && w.Duration.HasValue);
                    if (grace != null)
                    {
                        atiTimeSpanGrace.Time = grace.Duration.Value;
                        hiddenGraceKey.Value  = "" + grace.Id;
                    }
                    Workout ff = entities.UserStreamSet.OfType <Workout>().FirstOrDefault(w => w.UserSetting.Id == UserSettings.Id && w.WOD.Id == Affine.Utils.ConstsUtil.FILTHY50_ID && w.IsBest == true && w.Duration.HasValue);
                    if (ff != null)
                    {
                        atiTimeSpanFilthyFifty.Time = ff.Duration.Value;
                        hiddenFilthyFiftyKey.Value  = "" + ff.Id;
                    }
                    Workout fgb = entities.UserStreamSet.OfType <Workout>().FirstOrDefault(w => w.UserSetting.Id == UserSettings.Id && w.WOD.Id == Affine.Utils.ConstsUtil.FGB_ID && w.IsBest == true && w.Score.HasValue);
                    if (fgb != null)
                    {
                        txtFGB.Text        = "" + fgb.Score.Value;
                        hiddenFGBKey.Value = "" + fgb.Id;
                    }

                    Workout maxPullups = entities.UserStreamSet.OfType <Workout>().FirstOrDefault(w => w.UserSetting.Id == UserSettings.Id && w.WOD.Id == Affine.Utils.ConstsUtil.MAX_PULLUPS_ID && w.IsBest == true && w.Score.HasValue);
                    if (maxPullups != null)
                    {
                        txtMaxPullups.Text       = "" + maxPullups.Score.Value;
                        hiddenMaxPullupKey.Value = "" + maxPullups.Id;
                    }

                    atiMaxBSUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS);
                    atiMaxBSUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_KG);
                    atiMaxBSUnits.Selected = Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS;
                    Workout maxBS = entities.UserStreamSet.OfType <Workout>().FirstOrDefault(w => w.UserSetting.Id == UserSettings.Id && w.WOD.Id == Affine.Utils.ConstsUtil.MAX_BACK_SQUAT_ID && w.IsBest == true && w.Max.HasValue);
                    if (maxBS != null)
                    {
                        txtMaxBS.Text = "" + Affine.Utils.UnitsUtil.systemDefaultToUnits(maxBS.Max.Value, UnitsUtil.MeasureUnit.UNIT_LBS);
                        hiddenMaxBackSquatKey.Value = "" + maxBS.Id;
                    }

                    atiMaxCleanUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS);
                    atiMaxCleanUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_KG);
                    atiMaxCleanUnits.Selected = Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS;
                    Workout maxClean = entities.UserStreamSet.OfType <Workout>().FirstOrDefault(w => w.UserSetting.Id == UserSettings.Id && w.WOD.Id == Affine.Utils.ConstsUtil.MAX_CLEAN_ID && w.IsBest == true && w.Max.HasValue);
                    if (maxClean != null)
                    {
                        txtMaxClean.Text        = "" + Affine.Utils.UnitsUtil.systemDefaultToUnits(maxClean.Max.Value, UnitsUtil.MeasureUnit.UNIT_LBS);
                        hiddenMaxCleanKey.Value = "" + maxClean.Id;
                    }

                    atiMaxDeadliftUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS);
                    atiMaxDeadliftUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_KG);
                    atiMaxDeadliftUnits.Selected = Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS;
                    Workout maxDead = entities.UserStreamSet.OfType <Workout>().FirstOrDefault(w => w.UserSetting.Id == UserSettings.Id && w.WOD.Id == Affine.Utils.ConstsUtil.MAX_DEADLIFT_ID && w.IsBest == true && w.Max.HasValue);
                    if (maxDead != null)
                    {
                        txtMaxDeadlift.Text        = "" + Affine.Utils.UnitsUtil.systemDefaultToUnits(maxDead.Max.Value, UnitsUtil.MeasureUnit.UNIT_LBS);
                        hiddenMaxDeadliftKey.Value = "" + maxDead.Id;
                    }

                    atiMaxSnatchUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS);
                    atiMaxSnatchUnits.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_KG);
                    atiMaxSnatchUnits.Selected = Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS;
                    Workout maxSnatch = entities.UserStreamSet.OfType <Workout>().FirstOrDefault(w => w.UserSetting.Id == UserSettings.Id && w.WOD.Id == Affine.Utils.ConstsUtil.MAX_SNATCH_ID && w.IsBest == true && w.Max.HasValue);
                    if (maxSnatch != null)
                    {
                        txtMaxSnatch.Text        = "" + Affine.Utils.UnitsUtil.systemDefaultToUnits(maxSnatch.Max.Value, UnitsUtil.MeasureUnit.UNIT_LBS);
                        hiddenMaxSnatchKey.Value = "" + maxSnatch.Id;
                    }

                    if (Request["step"] != null)
                    {
                        atiSidePanel.Visible        = false;
                        atiMainPanel.Style["width"] = "100%";
                        atiGMap.Width = Unit.Pixel(605);
                        // check if we may have info on this person from the 2011 crossfit open.
                        RadAjaxManager1.ResponseScripts.Add(" $(function(){ Aqufit.Page.Actions.LoadStep(" + Request["step"] + "); }); ");
                    }
                    this.baseUrl  = ResolveUrl("~/");
                    userPhotoPath = this.baseUrl + @"\Portals\0\Users\" + base.UserSettings.UserName;
                    urlPath       = "/Portals/0/Users/" + base.UserSettings.UserName;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #26
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);
            try
            {
                ServiceReference service = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/StreamService.asmx");
                service.InlineScript = true;
                ScriptManager.GetCurrent(Page).Services.Add(service);
                imgAd.Src = ResolveUrl("~/images/iphoneAd.png");

                Affine.Utils.WorkoutUtil.WorkoutType workoutType = Affine.Utils.WorkoutUtil.WorkoutType.RUNNING;
                if (Request["wt"] != null)
                {
                    workoutType = Affine.Utils.WorkoutUtil.IntToWorkoutType(Convert.ToInt32(Request["wt"]));
                }
                atiWorkoutTypes.SelectedType = workoutType;
                aqufitEntities entities     = new aqufitEntities();
                WorkoutType    selectedType = entities.WorkoutType.First(w => w.Id == (int)workoutType);
                userQuery             = entities.UserSettings.OfType <User>().Where(u => u.PortalKey == this.PortalId && !u.User2WorkoutType.Select(wt => wt.WorkoutType.Id).Contains(selectedType.Id)).OrderBy(u => u.Id).AsQueryable();
                userQueryRecentActive = userQuery.OrderByDescending(w => w.LastLoginDate);
                if (this.UserSettings != null)
                {
                    userQueryLiveNear = userQuery.Where(u => u.LngHome.HasValue && u.LngHome.HasValue).OrderBy(u => Math.Abs(u.LatHome.Value - UserSettings.LatHome.Value) + Math.Abs(u.LngHome.Value - UserSettings.LngHome.Value));
                }
                userQueryMostWatched = userQuery.Where(u => u.Metrics.FirstOrDefault(m => m.MetricType == (int)Affine.Utils.MetricUtil.MetricType.NUM_FOLLOWERS) != null).OrderByDescending(u => u.Metrics.FirstOrDefault(m => m.MetricType == (int)Affine.Utils.MetricUtil.MetricType.NUM_FOLLOWERS).MetricValue);
                IQueryable <Workout> fastWorkoutQuery = entities.UserStreamSet.Include("UserSettings").OfType <Workout>().Where(w => w.WorkoutTypeKey.HasValue && w.WorkoutTypeKey.Value == (int)workoutType && w.Duration.HasValue && w.Duration.Value > 0);
                if (workoutType == Utils.WorkoutUtil.WorkoutType.RUNNING)
                {
                    // metrics will be 1 mile, 5km and 10km
                    hFastTime1.InnerText = "Fastest 1 mile";
                    double mile = Affine.Utils.UnitsUtil.distanceMetricToDistance(Utils.UnitsUtil.DistanceMetric.MILE_1);
                    workoutQueryFastest1 = fastWorkoutQuery.Where(w => w.Distance >= mile).OrderBy(w => w.Duration);

                    hFastTime2.InnerText = "Fastest 5 km";
                    double km5 = Affine.Utils.UnitsUtil.distanceMetricToDistance(Utils.UnitsUtil.DistanceMetric.KM_5);
                    workoutQueryFastest2 = fastWorkoutQuery.Where(w => w.Distance >= km5).OrderBy(w => w.Duration);
                }
                else if (workoutType == Utils.WorkoutUtil.WorkoutType.ROW)
                {
                    // row metrics will be fastest 500 M and 1 Km
                    hFastTime1.InnerText = "Fastest 500 M";
                    double m500 = Affine.Utils.UnitsUtil.distanceMetricToDistance(Utils.UnitsUtil.DistanceMetric.M_500);
                    workoutQueryFastest1 = fastWorkoutQuery.Where(w => w.Distance >= m500).OrderBy(w => w.Duration);

                    hFastTime2.InnerText = "Fastest 1 km";
                    double km1 = Affine.Utils.UnitsUtil.distanceMetricToDistance(Utils.UnitsUtil.DistanceMetric.KM_1);
                    workoutQueryFastest2 = fastWorkoutQuery.Where(w => w.Distance >= km1).OrderBy(w => w.Duration);
                }
                else if (workoutType == Utils.WorkoutUtil.WorkoutType.CROSSFIT)
                {
                    hFastTime1.InnerText = "Fran";
                    workoutQueryFastest1 = fastWorkoutQuery.Where(w => w.WOD.Standard > 0 && w.WOD.Name == "Fran" && w.RxD.HasValue && w.RxD.Value).OrderBy(w => w.Duration);

                    hFastTime2.InnerText = "Helen";
                    workoutQueryFastest2 = fastWorkoutQuery.Where(w => w.WOD.Standard > 0 && w.WOD.Name == "Helen" && w.RxD.HasValue && w.RxD.Value).OrderBy(w => w.Duration);
                }

                if (!Page.IsPostBack && !Page.IsCallback)
                {
                    if (ProfileSettings != null)
                    {
                        liFindFriends.Visible       = false;
                        pageViewFindFriends.Visible = false;
                        atiProfileImg.Settings      = ProfileSettings;
                        atiProfileImg.IsOwner       = base.Permissions == AqufitPermission.OWNER;
                        atiPeoplePanel.Visible      = false;
                        atiPeopleViewer.Visible     = true;
                        peopleTabTitle.Text         = ProfileSettings.UserName + " Achievements";
                        litUserName.Text            = "<a class=\"midBlue\" href=\"" + ResolveUrl("~") + ProfileSettings.UserName + "\">" + ProfileSettings.UserName + "</a> <span> (" + ProfileSettings.UserFirstName + " " + ProfileSettings.UserLastName + ")</span>";
                        atiShareLink.ShareLink      = Request.Url.AbsoluteUri;
                        atiShareLink.ShareTitle     = ProfileSettings.UserName + " Achievements";

                        if (ProfileSettings is Group)
                        {
                            Affine.Utils.ConstsUtil.Relationships memberType = Utils.ConstsUtil.Relationships.NONE;
                            if (UserSettings != null)
                            {
                                UserFriends uf = entities.UserFriends.FirstOrDefault(f => f.SrcUserSettingKey == UserSettings.Id && f.DestUserSettingKey == ProfileSettings.Id);
                                if (uf != null)
                                {
                                    memberType = Utils.ConstsUtil.IntToRelationship(uf.Relationship);
                                }
                            }
                            Affine.Data.Managers.IDataManager dataMan = Affine.Data.Managers.LINQ.DataManager.Instance;
                            atiWorkoutTotals.Visible = false;
                            nvgCrossfit.Visible      = false;
                            liConfig.Visible         = (memberType == Utils.ConstsUtil.Relationships.GROUP_ADMIN || memberType == Utils.ConstsUtil.Relationships.GROUP_OWNER);
                            if ((memberType == Utils.ConstsUtil.Relationships.GROUP_ADMIN || memberType == Utils.ConstsUtil.Relationships.GROUP_OWNER) && Request["c"] != null)
                            {
                                atiPeopleViewer.Visible      = false;
                                atiLeaderBoardConfig.Visible = true;
                                bool hasCustom = entities.LeaderBoard2WOD.FirstOrDefault(lb => lb.UserSetting.Id == GroupSettings.Id) != null;
                                if (hasCustom)
                                {
                                    Affine.Data.json.LeaderBoardWOD[] all = dataMan.CalculatCrossFitLeaderBoard(base.GroupSettings.Id);
                                    System.Web.Script.Serialization.JavaScriptSerializer jsSerial = new System.Web.Script.Serialization.JavaScriptSerializer();
                                    RadAjaxManager1.ResponseScripts.Add("$(function(){ Aqufit.Page." + atiLeaderBoard2Config.ID + ".loadLeaderBoardFromJson('" + jsSerial.Serialize(all) + "'); });");
                                }
                            }
                            else
                            {
                                Affine.Data.json.LeaderBoardWOD[] all = dataMan.CalculatCrossFitLeaderBoard(base.GroupSettings.Id);
                                System.Web.Script.Serialization.JavaScriptSerializer jsSerial = new System.Web.Script.Serialization.JavaScriptSerializer();
                                RadAjaxManager1.ResponseScripts.Add("$(function(){ Aqufit.Page." + atiLeaderBoard2.ID + ".loadLeaderBoardFromJson('" + jsSerial.Serialize(all) + "'); });");
                            }
                        }
                        else
                        {
                            atiWorkoutTotals.Cols = 3;
                            // get number of workouts for each workout type
                            WorkoutType[]        wtypes       = entities.WorkoutType.ToArray();
                            IQueryable <Workout> workoutQuery = entities.UserStreamSet.OfType <Workout>().Where(w => w.UserSetting.Id == ProfileSettings.Id);
                            foreach (WorkoutType wt in wtypes)
                            {
                                atiWorkoutTotals.Totals.Add(new DesktopModules_ATI_Base_controls_ATI_NameValueGrid.TotalItem()
                                {
                                    Name  = wt.Name,
                                    Icon  = wt.Icon,
                                    Total = "" + workoutQuery.Where(w => w.WorkoutTypeKey == wt.Id).Count()
                                });
                            }
                            IQueryable <Workout> crossfitWorkouts = entities.UserStreamSet.OfType <Workout>().Include("WOD").Where(w => w.UserSetting.Id == ProfileSettings.Id && w.IsBest == true);
                            int numDistinct = crossfitWorkouts.Select(w => w.WOD).Distinct().Count();
                            IQueryable <Workout> wodsToDisplay = null;
                            wodsToDisplay = crossfitWorkouts.OrderByDescending(w => w.Id);
                            string baseUrl = ResolveUrl("~") + "workout/";
                            // We need to split up into WOD types now...
                            Workout[] timedWods = wodsToDisplay.Where(w => w.WOD.WODType.Id == (int)Affine.Utils.WorkoutUtil.WodType.TIMED).OrderBy(w => w.Duration).ToArray();
                            IList <DesktopModules_ATI_Base_controls_ATI_NameValueGrid.TotalItem> cfTotals = timedWods.Select(w => new DesktopModules_ATI_Base_controls_ATI_NameValueGrid.TotalItem()
                            {
                                Name = w.Title, Total = Affine.Utils.UnitsUtil.durationToTimeString(Convert.ToInt64(w.Duration)), Link = baseUrl + w.WOD.Id
                            }).ToList();
                            // Now all the scored ones...
                            Workout[] scoredWods = wodsToDisplay.Where(w => w.WOD.WODType.Id == (int)Affine.Utils.WorkoutUtil.WodType.SCORE || w.WOD.WODType.Id == (int)Affine.Utils.WorkoutUtil.WodType.AMRAP).ToArray();
                            cfTotals = cfTotals.Concat(scoredWods.Select(w => new DesktopModules_ATI_Base_controls_ATI_NameValueGrid.TotalItem()
                            {
                                Name = w.Title, Total = Convert.ToString(w.Score), Link = baseUrl + w.WOD.Id
                            }).ToList()).ToList();
                            Workout[] maxWods = wodsToDisplay.Where(w => w.WOD.WODType.Id == (int)Affine.Utils.WorkoutUtil.WodType.MAX_WEIGHT).ToArray();
                            cfTotals = cfTotals.Concat(maxWods.Select(w => new DesktopModules_ATI_Base_controls_ATI_NameValueGrid.TotalItem()
                            {
                                Name = w.Title, Total = Affine.Utils.UnitsUtil.systemDefaultToUnits(w.Max.Value, WeightUnits) + " " + Affine.Utils.UnitsUtil.unitToStringName(WeightUnits), Link = baseUrl + w.WOD.Id
                            }).ToList()).ToList();
                            // TODO: we should have workout names link to that workout (a you vs. them kinda deal)
                            nvgCrossfit.Totals = cfTotals.OrderBy(t => t.Name).ToArray();

                            #region Achievments

                            Affine.WebService.StreamService ss = new WebService.StreamService();
                            string js = string.Empty;

                            Affine.Utils.WorkoutUtil.WorkoutType running = Utils.WorkoutUtil.WorkoutType.RUNNING;
                            Achievement[] runningAchievements            = entities.Achievements.Include("UserStream").Include("UserStream.UserSetting").Include("AchievementType").Where(a => a.AchievementType.WorkoutType.Id == (int)running && a.UserSetting.Id == ProfileSettings.Id).OrderBy(a => a.AchievementType.DistanceRangeA).ToArray();
                            foreach (Achievement a in runningAchievements)
                            {
                                string json = ss.getStreamData((Workout)a.UserStream);
                                js += "Aqufit.Page.atiFeaturedRunning.addItem('" + json + "','" + a.AchievementType.Name + "'); ";
                            }
                            Affine.Utils.WorkoutUtil.WorkoutType rowing = Utils.WorkoutUtil.WorkoutType.ROW;
                            Achievement[] rowingAchievements            = entities.Achievements.Include("UserStream").Include("UserStream.UserSetting").Include("AchievementType").Where(a => a.AchievementType.WorkoutType.Id == (int)rowing && a.UserSetting.Id == ProfileSettings.Id).OrderBy(a => a.AchievementType.DistanceRangeA).ToArray();
                            foreach (Achievement a in rowingAchievements)
                            {
                                string json = ss.getStreamData((Workout)a.UserStream);
                                js += "Aqufit.Page.atiFeaturedRowing.addItem('" + json + "','" + a.AchievementType.Name + "'); ";
                            }
                            Affine.Utils.WorkoutUtil.WorkoutType cycling = Utils.WorkoutUtil.WorkoutType.CYCLING;
                            Achievement[] cyclingAchievements            = entities.Achievements.Include("UserStream").Include("UserStream.UserSetting").Include("AchievementType").Where(a => a.AchievementType.WorkoutType.Id == (int)cycling && a.UserSetting.Id == ProfileSettings.Id).OrderBy(a => a.AchievementType.DistanceRangeA).ToArray();
                            foreach (Achievement a in cyclingAchievements)
                            {
                                string json = ss.getStreamData((Workout)a.UserStream);
                                js += "Aqufit.Page.atiFeaturedCycling.addItem('" + json + "','" + a.AchievementType.Name + "'); ";
                            }
                            Affine.Utils.WorkoutUtil.WorkoutType swimming = Utils.WorkoutUtil.WorkoutType.SWIMMING;
                            Achievement[] swimmingAchievements            = entities.Achievements.Include("UserStream").Include("UserStream.UserSetting").Include("AchievementType").Where(a => a.AchievementType.WorkoutType.Id == (int)swimming && a.UserSetting.Id == ProfileSettings.Id).OrderBy(a => a.AchievementType.DistanceRangeA).ToArray();
                            foreach (Achievement a in swimmingAchievements)
                            {
                                string json = ss.getStreamData((Workout)a.UserStream);
                                js += "Aqufit.Page.atiFeaturedSwimming.addItem('" + json + "','" + a.AchievementType.Name + "'); ";
                            }

                            ScriptManager.RegisterStartupScript(this, Page.GetType(), "Achievements", "$(function(){" + js + " });", true);
                            #endregion
                        }
                    }
                    else
                    {
                        peopleTabTitle.Text     = "Athletes";
                        atiPeoplePanel.Visible  = true;
                        atiPeopleViewer.Visible = false;
                        SetupPage();        // do normal page setup
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #27
0
        /// <summary>
        /// Registers a service as a subscriber for messages.
        /// </summary>
        /// <param name="messageTypeName">Full type name of message object.</param>
        /// <param name="service">Reference to the service to register.</param>
        public async Task RegisterServiceSubscriberAsync(ServiceReference service, string messageTypeName)
        {
            var serviceReference = new ServiceReferenceWrapper(service);

            await RegisterSubscriberAsync(serviceReference, messageTypeName);
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);
            try
            {
                ServiceReference service = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/StreamService.asmx");
                service.InlineScript = true;
                ScriptManager.GetCurrent(Page).Services.Add(service);

                if (ProfileSettings is Group)
                {
                    litFriendTerm.Text              = "Members";
                    litGroupName.Text               = "<a class=\"username\" href=\"/groups/" + ProfileSettings.UserName + "\">" + ProfileSettings.UserFirstName + "</a>";
                    atiProfileImage.IsOwner         = false;
                    atiWebLinksList.ProfileSettings = ProfileSettings;
                    panelGroupInfo.Visible          = true;
                }
                atiProfileImage.Settings = base.ProfileSettings != null ? base.ProfileSettings : base.UserSettings;
                if (Settings["ProfileMode"] != null && Convert.ToString(Settings["ProfileMode"]).Equals("None"))
                {
                    divLeftNav.Visible = false;
                    divAd.Visible      = false;
                    divCenterWrapper.Style["margin-right"] = "0px";
                    divControl.Style["float"] = "right";
                }
                if (Permissions == AqufitPermission.PUBLIC && Settings["ModuleMode"] == null)
                {
                    Response.Write("<h1>TODO: error page => You can not view this persons friends.. you are not friends with them</h1>");
                }
                else
                {
                    if (Permissions == AqufitPermission.PUBLIC && Settings["ModuleMode"] == "Friend")
                    {
                        Response.Write("<h1>TODO: error page => You can not view this persons friends.. you are not friends with them</h1>");
                    }
                    if (!Page.IsPostBack && !Page.IsCallback)
                    {
                        if (Settings["ModuleMode"] != null && Convert.ToString(Settings["ModuleMode"]).Equals("Follow"))
                        {
                            tabFriends.Visible = pageViewFriends.Visible = false;
                            SetupPageFollowMode();
                        }
                        else if (Settings["ModuleMode"] != null && Convert.ToString(Settings["ModuleMode"]).Equals("FriendFollow"))
                        {
                            SetupPageFollowMode();
                            SetupPageFriendMode();
                        }
                        else
                        {
                            tabFollowing.Visible = pageViewFollowing.Visible = false;
                            tabFollowers.Visible = pageViewFollowers.Visible = false;
                            SetupPageFriendMode();
                        }
                    }
                }
                imgAdRight.Src = ResolveUrl("/portals/0/images/adTastyPaleo.jpg");
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #29
0
 /// <summary>
 /// Updates the tree model to reflect the newly created document.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void proxy_AddFolderCompleted(object sender, ServiceReference.AddFolderCompletedEventArgs args)
 {
     TreeViewModel.GetInstance().InsertFolder(new string[] { args.Result.ToString(), session.NewlyCreatedFolderName, session.NewlyCreatedFolderParentId.ToString() }, gui.ExplorerTree.Items);
 }
Beispiel #30
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);
            try
            {
                aqufitEntities entities = new aqufitEntities();
                bool           isAdmin  = false;
                if (Request["c"] != null)
                {
                    // TODO: make sure they are a group admin to the comp..
                    CompetitionKey = Convert.ToInt64(Request["c"]);
                    Competition comp = entities.Competitions.Include("Group").FirstOrDefault(c => c.Id == CompetitionKey);
                    if (comp != null)
                    {
                        UserFriends admin = entities.UserFriends.FirstOrDefault(f => f.SrcUserSettingKey == UserSettings.Id && f.DestUserSettingKey == comp.Group.Id && f.Relationship <= (int)Affine.Utils.ConstsUtil.Relationships.GROUP_ADMIN);
                        if (admin != null)
                        {
                            isAdmin = true;
                        }
                        litCompOwner.Text             = comp.Group.UserFirstName;
                        txtCompName.Text              = comp.Name;
                        RadCompStartDate.SelectedDate = comp.CompetitionStartDate;
                        RadCompEndDate.SelectedDate   = comp.CompetitionEndDate;
                    }
                }

                if (!isAdmin)
                {
                    Response.Redirect(ResolveUrl("~/") + UserSettings.UserName);
                }
                RadListBoxTeamSource.DataSource     = entities.CompetitionRegistrations.Where(r => r.Competition.Id == CompetitionKey && r.CompetitionCategory.Id == (int)Affine.Utils.WorkoutUtil.CompetitionCategory.TEAM).Select(r => new { Name = r.TeamName, Value = r.Id }).ToArray();
                RadListBoxTeamSource.DataTextField  = "Name";
                RadListBoxTeamSource.DataValueField = "Value";
                RadListBoxTeamSource.DataBind();



                if (!Page.IsPostBack && !Page.IsCallback)
                {
                    ddlTeamPools.DataSource     = entities.CompetitionTeamPools.Where(tp => tp.Competition.Id == CompetitionKey).Select(tp => new { Name = tp.Name, Value = tp.Id }).ToArray();
                    ddlTeamPools.DataTextField  = "Name";
                    ddlTeamPools.DataValueField = "Value";
                    ddlTeamPools.DataBind();

                    if (ddlTeamPools.Items.Count == 0)
                    {
                        buttonAddPoolWorkout.Visible = false;
                        RadGrid2.Visible             = false;
                    }

                    baseUrl = ResolveUrl("~/");
                    ServiceReference service = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/StreamService.asmx");
                    service.InlineScript = true;
                    ScriptManager.GetCurrent(Page).Services.Add(service);
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
 public ServiceReferenceFacade(ServiceReference instance)
 {
     this.instance = instance;
 }
Beispiel #32
0
 public void SongStarted(ServiceReference.Track track, Guid containerId, int index)
 {
     //x throw new NotImplementedException();
 }
Beispiel #33
0
 public ServiceReference[] getServiceReferences(string clazz, string filter)
 {
     ServiceReference[] serviceReferences = new ServiceReference[serviceReferenceList.Count];
     serviceReferenceList.CopyTo(serviceReferences, 0);
     return(serviceReferences);
 }
Beispiel #34
0
 private void ApplyPlaylists(ServiceReference.Playlist[] playlist)
 {
     foreach (var p in MakePlaylistTree(playlist))
         playlists.Add(p);
 }
Beispiel #35
0
 internal ServiceReference[] getRegisteredServices()
 {
     ServiceReference[] serviceReferences = new ServiceReference[serviceReferenceList.Count];
     serviceReferenceList.CopyTo(serviceReferences, 0);
     return(serviceReferences);
 }
Beispiel #36
0
        private void ApplyStatus(ServiceReference.SpotifyStatus spotifyStatus)
        {
            Shuffle = spotifyStatus.Shuffle;
            Repeat = spotifyStatus.Repeat;

            IsPlaying = spotifyStatus.IsPlaying;
            CanStartPlayback = spotifyStatus.CanStartPlayback;
            CanGoBack = spotifyStatus.CanGoBack;
            CanGoNext = spotifyStatus.CanGoNext;

            Volume = spotifyStatus.Volume;

            Track = spotifyStatus.CurrentTrack != null ? new TrackViewModel(spotifyStatus.CurrentTrack) : null;
            currentTime = spotifyStatus.LengthPlayed;
            lastQueried = DateTime.Now;
        }
Beispiel #37
0
 public PlaybackEventArgs(ServiceReference.Track track, Guid containerId, int index)
 {
     this.track = track;
     this.containerId = containerId;
     this.index = index;
 }
        /********************************************************************************************************************************
        *****************************************************    Metodo PRINCIPAL  ******************************************************
        *********************************************************************************************************************************/

        //es el metodo que corre cuando se dispara el evento de recibir respuesta, aqui van todas las respuestas
        //con los codigos que le pertenecen, consultar TABLA DE PETICIONES.XLSX

        private void Wrapper_AgregarPeticionCompleted(object sender, ServiceReference.AgregarPeticionCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                string temp = e.Result.Substring(0, 3);
                string recievedResponce = e.Result.Substring(3);
                if (recievedResponce == "False")
                {
                    if (flags[2])
                    {
                        flags[2] = false;
                        MessageBox.Show("Ha ocurrido un error.  Intente su consulta de nuevo.\nSi el problema persiste, refresque la pagina e intente de nuevo.");
                    }
                }
                else
                {
                    switch (temp)
                    {
                        case "p21"://Get datos Afiliado
                            if (flags[0])
                            {
                                flags[0] = false;
                                if (recievedResponce != "")
                                {
                                    afiliado = MainPage.tc.getAfiliado(recievedResponce);

                                    numeroCertificado_txt.Text = afiliado.certificadoCuenta.ToString();
                                    pNombre_txt.Text = afiliado.primerNombre;
                                    sNombre_txt.Text = afiliado.segundoNombre;
                                    pApellido_txt.Text = afiliado.primerApellido;
                                    sApellido_txt.Text = afiliado.segundoApellido;
                                    direccion_txt.Text = afiliado.direccion;
                                    id_txt.Text = afiliado.identidad;
                                    genero_txt.Text = afiliado.genero;
                                    try
                                    {
                                        telefono_txt.Text = afiliado.telefonoPersonal[0];
                                        telefono2_txt.Text = afiliado.telefonoPersonal[1];
                                        celular_txt.Text = afiliado.celular[0];
                                        celular2_txt.Text = afiliado.celular[1];
                                    }
                                    catch { }
                                    profesion_txt.Text = afiliado.Ocupacion;
                                    email_txt.Text = afiliado.CorreoElectronico;
                                    lugarNacimiento_txt.Text = afiliado.lugarDeNacimiento;
                                    fechaNacimiento_txt.Text = afiliado.fechaNacimiento;
                                    estadoCivil_txt.Text = afiliado.estadoCivil;
                                    estadoAfiliado_txt.Text = afiliado.EstadoAfiliado;

                                    empresa_txt.Text = afiliado.NombreEmpresa;
                                    fechaIngresoEmpresa_txt.Text = afiliado.fechaIngresoCooperativa;
                                    telefonoEmpresa_txt.Text = afiliado.TelefonoEmpresa;
                                    departamentoEmpresa_txt.Text = afiliado.DepartamentoEmpresa;
                                    direccionEmpresa_txt.Text = afiliado.DireccionEmpresa;

                                    beneficiarioNormal = afiliado.bensNormales;
                                    beneficiarioContingencia = (BeneficiarioContingencia)afiliado.BeneficiarioCont;

                                    foreach (BeneficiarioNormal item in beneficiarioNormal)
                                    {
                                        listaBeneficiarios.Add(new BeneficiarioGrid()
                                        {
                                            PrimerNombre = item.primerNombre,
                                            SegundoNombre = item.segundoNombre,
                                            PrimerApellido = item.primerApellido,
                                            SegundoApellido = item.segundoApellido,
                                            NumeroIdentidad = item.identidad,
                                            Fecha_Nacimiento = item.fechaNacimiento,
                                            Genero = item.genero,
                                            Direccion = item.direccion,
                                            Parentesco = item.Parentesco,
                                            PorcentajeSeguros = item.porcentajeSeguros,
                                            PorcentajeAportaciones = item.porcentajeAportaciones,
                                            TipoBeneficiario = "Normal",
                                        });
                                    }

                                    //Este es el Beneficiario de Contingencia
                                    listaBeneficiarios.Add(new BeneficiarioGrid()
                                    {
                                        PrimerNombre = beneficiarioContingencia.primerNombre,
                                        SegundoNombre = beneficiarioContingencia.segundoNombre,
                                        PrimerApellido = beneficiarioContingencia.primerApellido,
                                        SegundoApellido = beneficiarioContingencia.segundoApellido,
                                        NumeroIdentidad = beneficiarioContingencia.identidad,
                                        Fecha_Nacimiento = beneficiarioContingencia.fechaNacimiento,
                                        Genero = beneficiarioContingencia.genero,
                                        Direccion = beneficiarioContingencia.direccion,
                                        Parentesco = beneficiarioContingencia.Parentesco,
                                        TipoBeneficiario = "De Contingencia",
                                        PorcentajeAportaciones = 100,
                                        PorcentajeSeguros = 100
                                    });

                                    gridBeneficiarios.ItemsSource = listaBeneficiarios;
                                }
                                else
                                {
                                    MessageBox.Show("No se ha encontrado el registro!");
                                }
                            }
                            break;

                        case "p22"://Get datos Empleados
                            if (flags[1])
                            {
                                flags[1] = false;
                                if (recievedResponce != "")
                                {
                                    datosLaborales_tab.IsEnabled = false;
                                    beneficiarios_tab.IsEnabled = false;
                                    empleado = MainPage.tc.getEmpleado(recievedResponce);

                                    label20.Content = "";
                                    numeroCertificado_txt.Text = "";
                                    pNombre_txt.Text = empleado.primerNombre;
                                    sNombre_txt.Text = empleado.segundoNombre;
                                    pApellido_txt.Text = empleado.primerApellido;
                                    sApellido_txt.Text = empleado.segundoApellido;
                                    direccion_txt.Text = empleado.direccion;
                                    id_txt.Text = empleado.identidad;
                                    genero_txt.Text = empleado.genero;
                                    telefono_txt.Text = empleado.telefonoPersonal[0];
                                    celular_txt.Text = empleado.celular[0];
                                    profesion_txt.Text = "";
                                    puesto_txt.Text = empleado.Puesto;
                                    email_txt.Text = empleado.correoElectronico;
                                    lugarNacimiento_txt.Text = "";
                                    fechaNacimiento_txt.Text = empleado.fechaNacimiento;
                                    estadoCivil_txt.Text = empleado.estadoCivil;
                                }
                                else
                                {
                                    MessageBox.Show("No se ha encontrado el registro!");
                                }

                            }
                            break;

                        default:
                            if (flags[2])
                            {
                                flags[2] = false;
                                MessageBox.Show("No se entiende la peticion. (No esta definida)");
                            }
                            break;
                    }
                }
            }
            else
            {
                if (flags[2])
                {
                    flags[2] = false;
                    MessageBox.Show("Ha ocurrido un error.  Intente su consulta de nuevo.\nSi el problema persiste, refresque la pagina e intente de nuevo.");
                }
            }
        }
Beispiel #39
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //SD: This is useless as it won't work in live editing anyways whilst using MS Ajax/ScriptManager for ajax calls
            if (!UmbracoContext.Current.LiveEditingContext.Enabled)
            {
                presentation.webservices.ajaxHelpers.EnsureLegacyCalls(base.Page);
                ScriptManager    sm             = ScriptManager.GetCurrent(base.Page);
                ServiceReference webservicePath = new ServiceReference(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/webservices/MacroContainerService.asmx");

                if (!sm.Services.Contains(webservicePath))
                {
                    sm.Services.Add(webservicePath);
                }
            }
            else
            {
                ClientDependencyLoader.Instance.RegisterDependency("webservices/legacyAjaxCalls.asmx/js", "UmbracoRoot", ClientDependencyType.Javascript);
                ClientDependencyLoader.Instance.RegisterDependency("webservices/MacroContainerService.asmx/js", "UmbracoRoot", ClientDependencyType.Javascript);
            }

            _addMacro    = new LinkButton();
            _addMacro.ID = ID + "_btnaddmacro";


            _addMacro.Click   += new EventHandler(_addMacro_Click);
            _addMacro.Text     = ui.Text("insertMacro");
            _addMacro.CssClass = "macroContainerAdd";

            this.ContentTemplateContainer.Controls.Add(_addMacro);


            _limit         = new Literal();
            _limit.Text    = string.Format(" Only {0} macros are allowed", _maxNumber);
            _limit.ID      = ID + "_litlimit";
            _limit.Visible = false;

            this.ContentTemplateContainer.Controls.Add(_limit);

            string widthHeight = "";

            if (_preferedHeight > 0 && _preferedWidth > 0)
            {
                widthHeight = String.Format(" style=\"min-width: {0}px; min-height: {1}px;\"", _preferedWidth, _preferedHeight);
            }

            this.ContentTemplateContainer.Controls.Add(new LiteralControl(String.Format("<div id=\"" + ID + "container\" class=\"macrocontainer\"{0}>", widthHeight)));

            Regex           tagregex = new Regex("<[^>]*(>|$)", RegexOptions.Singleline | RegexOptions.ExplicitCapture | RegexOptions.Compiled);
            MatchCollection tags     = tagregex.Matches(_data.Value.ToString());

            List <int> editornumbers = new List <int>();
            string     sortorder     = string.Empty;


            for (int i = 0; i < _maxNumber; i++)
            {
                if (!editornumbers.Contains(i))
                {
                    string data = string.Empty;

                    if (tags.Count > i)
                    {
                        data = tags[i].Value;
                    }

                    MacroEditor macroEditor = new MacroEditor(data, _allowedMacros);
                    macroEditor.ID = ID + "macroeditor_" + i;

                    this.ContentTemplateContainer.Controls.Add(macroEditor);
                }
            }

            this.ContentTemplateContainer.Controls.Add(new LiteralControl("</div>"));

            if (tags.Count == _maxNumber)
            {
                _addMacro.Enabled = false;
                _limit.Visible    = true;
            }



            MacroContainerEvent.Execute += new MacroContainerEvent.ExecuteHandler(MacroContainerEvent_Execute);
        }
 /// <summary>
 /// Creates a new instance of <see cref="ServiceReferenceInfo{T}"/> wrapping original <see cref="ServiceReference"/>.
 /// Qi4CS runtime will use this constructor so there is no need to user code to invoke this.
 /// </summary>
 /// <param name="sRef">The <see cref="ServiceReference"/> to wrap.</param>
 /// <exception cref="ArgumentNullException">If <paramref name="sRef"/> is <c>null</c>.</exception>
 public ServiceReferenceInfo(ServiceReference sRef)
 {
     ArgumentValidator.ValidateNotNull("Service reference", sRef);
     this._ref = sRef;
 }
Beispiel #41
0
 /// <summary>
 /// Checks whether given service reference has same ID as the one specified in service qualifier attribute.
 /// </summary>
 /// <param name="reference">The <see cref="ServiceReference"/>.</param>
 /// <param name="attribute">The <see cref="IdentifiedByAttribute"/>.</param>
 /// <returns><c>true</c> if <see cref="ServiceReference.ServiceID"/> property of <paramref name="reference"/> equals to <see cref="IdentifiedByAttribute.ServiceID"/> property; <c>false</c> otherwise.</returns>
 protected override Boolean Qualifies(ServiceReference reference, IdentifiedByAttribute attribute)
 {
     return(String.Equals(reference.ServiceID, attribute.ServiceID));
 }
 public Task SubscribeAsync(ServiceReference serviceReference, IEnumerable <Type> messageTypes, Uri broker = null)
 {
     return(_helper.SubscribeAsync(serviceReference, messageTypes, broker));
 }
Beispiel #43
0
 /// <inheritdoc />
 public Boolean Qualifies(ServiceReference reference, Attribute attribute)
 {
     return(this.Qualifies(reference, (TAttribute)attribute));
 }
Beispiel #44
0
        public static TServiceInterface CreateServiceProxy <TServiceInterface>(this IServiceProxyFactory actorProxyFactory, ServiceReference serviceReference)
            where TServiceInterface : IService
        {
            if (serviceReference == null)
            {
                throw new ArgumentNullException(nameof(serviceReference));
            }

            return(actorProxyFactory.CreateServiceProxy <TServiceInterface>(serviceReference.ServiceUri, GetPartitionKey(serviceReference)));
        }
        /********************************************************************************************************************************
        *****************************************************    Metodo PRINCIPAL  ******************************************************
        *********************************************************************************************************************************/

        //es el metodo que corre cuando se dispara el evento de recibir respuesta, aqui van todas las respuestas
        //con los codigos que le pertenecen, consultar TABLA DE PETICIONES.XLSX

        private void Wrapper_AgregarPeticionCompleted(object sender, ServiceReference.AgregarPeticionCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                string temp = e.Result.Substring(0, 3);
                string recievedResponce = e.Result.Substring(3);
                if (recievedResponce == "False")
                {
                    if (flags[2])
                    {
                        flags[2] = false;
                        MessageBox.Show("Ha ocurrido un error.  Intente su consulta de nuevo.\nSi el problema persiste, refresque la pagina e intente de nuevo.");
                        habilitarCampos(true);
                    }
                }
                else
                {
                    switch (temp)
                    {
                        case "p01"://Ingresar Afiliado
                            if (flags[0])
                            {
                                MessageBox.Show("Se ha ingresado el afiliado exitosamente!");
                                flags[0] = false;
                                NavigationService.Refresh();
                            }
                            break;

                        case "p10"://Get Ocupaciones, refrescamos el monto actual
                            if (flags[0])
                            {
                                flags[0] = false;
                                List<string[]> lista = new List<string[]>();
                                
                                lista = MainPage.tc.getParentesco(e.Result.Substring(3));
                                if(lista != null)
                                    for (int i = 0; i < lista.Count; i++)
                                    {
                                        if((lista[i])[1] == "True")
                                            profesion_txt.Items.Add((lista[i])[0]);
                                    }
                                Wrapper.AgregarPeticionCompleted += new EventHandler<ServiceReference.AgregarPeticionCompletedEventArgs>(Wrapper_AgregarPeticionCompleted);
                                Wrapper.AgregarPeticionAsync(ServiceReference.peticion.getParentesco, "");
                            }
                            break;

                        case "p12"://Get Parentescos
                            if (flags[1])
                            {
                                flags[1] = false;
                                habilitarCampos(true);
                                id_txt.IsEnabled = true;
                                List<string[]> lista = new List<string[]>();
                                lista = MainPage.tc.getParentesco(e.Result.Substring(3));
                                if (lista != null)
                                    for (int i = 0; i < lista.Count; i++)
                                    {
                                        if((lista[i])[1] == "True")
                                            parentescoBeneficiario_txt.Items.Add((lista[i])[0]);
                                    }
                            }
                            break;

                        case "p33"://Get Proximo Numero Certificado
                            if (flags[3])
                            {
                                flags[3] = false;
                                numeroCertificado_txt.Text = recievedResponce;
                                Wrapper.AgregarPeticionCompleted += new EventHandler<ServiceReference.AgregarPeticionCompletedEventArgs>(Wrapper_AgregarPeticionCompleted);
                                Wrapper.AgregarPeticionAsync(ServiceReference.peticion.getOcupacion, "");
                            }
                            break;


                        default:
                            if (flags[2])
                            {
                                flags[2] = false;
                                MessageBox.Show("No se entiende la peticion. (No esta definida)");
                                habilitarCampos(true);
                                id_txt.IsEnabled = true;
                            }
                            break;
                    }
                }
            }
            else
            {
                if (flags[2])
                {
                    flags[2] = false;
                    MessageBox.Show("Ha ocurrido un error.  Intente su consulta de nuevo.\nSi el problema persiste, refresque la pagina e intente de nuevo.");
                }
                id_txt.IsEnabled = true;
                habilitarCampos(true);
                habilitarPantalla(true);
            }
        }
Beispiel #46
0
        /// <summary>
        /// 送检索引擎
        /// </summary>
        /// <param name="se"></param>
        /// <param name="sNo"></param>
        /// <param name="UserId"></param>
        /// <param name="_type"></param>
        /// <returns></returns>
        public string SendSearch(Searches se, int sNo, int UserId, ServiceReference.SearchDbType _type)
        {
            List<int> lstZhuanTi = new List<int>();//专题库结果
            List<int> lstRs = new List<int>();//合并对比文件
            List<int> lstHis = new List<int>();//预警历史结果
            List<int> lstResult = new List<int>();//检索结果文件
            List<string> leixing = new List<string>();
            List<string> shixiao = new List<string>();
            string strMsg = "";
            //判断是否为专题库预警
            if (!string.IsNullOrEmpty(se.NID))
            {
                string type = "CN";
                if (_type.ToString().ToUpper() == "DOCDB")
                {
                    type = "EN";
                }
                lstZhuanTi = ztHelper.GetZTResultList(se.NID, type);
            }

            ServiceReference.SearchWebServiceSoapClient mySearch = new ServiceReference.SearchWebServiceSoapClient();
            /// 返回CNP文件号单
            /// fm.cnp,授权:FS.cnp
            ///新型:um.cnp
            ///外观:wg.cnp
            ///有效:YX.cnp
            ///失效: SX.cnp
            if (se.C_TYPE == "16")//行业质量预警时
            {
                string[] lsttemp = se.SearchName.Split(';');
                foreach (string tmp in lsttemp)
                {
                    switch (tmp)
                    {
                        case "有效发明公开":
                            se.SearchName = "";
                            leixing.Add("FM");
                            shixiao.Add("YX");
                            break;
                        case "有效实用新型授权":
                            se.SearchName = "";
                            leixing.Add("UM");
                            shixiao.Add("YX");
                            break;
                        case "有效外观设计授权":
                            se.SearchName = "";
                            leixing.Add("WG");
                            shixiao.Add("YX");
                            break;
                        case "有效发明授权":
                            se.SearchName = "";
                            leixing.Add("FS");
                            shixiao.Add("YX");
                            break;
                        case "失效发明公开":
                            se.SearchName = "";
                            leixing.Add("FM");
                            shixiao.Add("SX");
                            break;
                        case "失效实用新型授权":
                            se.SearchName = "";
                            leixing.Add("UM");
                            shixiao.Add("SX");
                            break;
                        case "失效外观设计授权":
                            se.SearchName = "";
                            leixing.Add("WG");
                            shixiao.Add("SX");
                            break;
                        case "失效发明授权":
                            se.SearchName = "";
                            leixing.Add("FS");
                            shixiao.Add("SX");
                            break;
                    }
                }

            }
            if (!string.IsNullOrEmpty(se.SearchName))
            {
                if (!se.SearchName.StartsWith("F "))
                {
                    se.SearchName = "F XX " + se.SearchName;
                }
                //送引擎
                ServiceReference.ResultInfoWebService res = mySearch.Search(se.SearchName, UserId, sNo, _type);
                if (res == null)
                {
                    return null;
                }

                strMsg = res.ResultInfo.HitMsg;
                strMsg = strMsg.Substring(strMsg.LastIndexOf(":") + 1);
                if (res.ResultInfo.HitCount > 0)// 返回结果正确
                {
                    //获取结果文件路径
                    string srcFilePath = res.ResultSearchFilePath;
                    //对比结果文件
                    FileStream fs = new FileStream(srcFilePath, FileMode.Open);//当前检索结果文件
                    byte[] bteRs = new byte[fs.Length];
                    fs.Read(bteRs, 0, bteRs.Length);
                    fs.Close();

                    lstResult = ConvertLstByte.GetCnpList(bteRs);

                }
                else
                {
                    AddSearchLis(se);
                    return strMsg;
                }
            }
            //判断是否专题库
            if (!string.IsNullOrEmpty(se.NID) && !string.IsNullOrEmpty(se.SearchName))
            {
                lstRs = lstZhuanTi.Intersect(lstResult).ToList<int>();
            }
            else if (!string.IsNullOrEmpty(se.NID))
            {
                if (se.C_TYPE == "11")//专题库授权量统计
                {
                    List<int> lstFS = GetCNPList("FS");
                    List<int> lstWG = GetCNPList("WG");
                    List<int> lstUM = GetCNPList("UM");
                    List<int> lstZhuanTi_FS = lstZhuanTi.Intersect(lstFS).ToList<int>();
                    List<int> lstZhuanTi_WG = lstZhuanTi.Intersect(lstWG).ToList<int>();
                    List<int> lstZhuanTi_UM = lstZhuanTi.Intersect(lstUM).ToList<int>();

                    lstZhuanTi = lstZhuanTi_FS.Union(lstZhuanTi_WG).ToList<int>();
                    lstZhuanTi = lstZhuanTi.Union(lstZhuanTi_UM).ToList<int>();
                }
                else if (se.C_TYPE == "16")//专题库质量统计
                {
                    List<int> lst = new List<int>();
                    for (int i = 0; i < leixing.Count; i++)
                    {
                        List<int> lstLX = GetCNPList(leixing[i]);//根据LEIXING读取CNP文件
                        List<int> lstSX = GetCNPList(shixiao[i]);//根据失效,有效读取CNP文件
                        List<int> lstlx_sx = lstLX.Intersect(lstSX).ToList<int>();
                        List<int> lsttmp = lstZhuanTi.Intersect(lstlx_sx).ToList<int>();
                        lst = lst.Union(lsttmp).ToList<int>();
                    }
                    lstZhuanTi = lst;
                }
                lstRs = lstZhuanTi;
            }
            else
            {
                lstRs = lstResult;
            }
            byte[] bteResult = ConvertLstByte.GetListBytes(lstRs);//结果文件

            lstHis = ConvertLstByte.GetCnpList(se.SearchFile);

            // Union  Except  Intersect
            List<int> lstRs_His = lstRs.Except(lstHis).ToList<int>();
            List<int> lstHis_Rs = lstHis.Except(lstRs).ToList<int>();
            List<int> lstExcept = lstRs_His.Union(lstHis_Rs).ToList<int>();

            int Exceptnum = 0;
            if (lstHis.Count != 0)
            {
                Exceptnum = lstExcept.Count;//差异数
            }

            byte[] cbuffer = ConvertLstByte.GetListBytes(lstExcept);//差异文件
            if (se.C_TYPE.Substring(1, 1) == "7")//计算专利平均寿命
            {
                string avgage = GetPatentAvgAge(lstRs);
                //检索历史
                AddSearchLis(se, bteResult, cbuffer, avgage, Exceptnum.ToString());
            }
            else
            {
                //检索历史
                AddSearchLis(se, bteResult, cbuffer, lstRs.Count.ToString(), Exceptnum.ToString());
            }

            return strMsg;
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);
            try
            {               
                this.BackgroundImageUrl = ResolveUrl("~/DesktopModules/ATI_Base/services/images/profile.aspx")+"?u=-1&p=0&bg=1";
                if (!Page.IsPostBack && !Page.IsCallback)
                {
                    baseUrl = ResolveUrl("~/");
                    aqufitEntities entities = new aqufitEntities();
                    ServiceReference service = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/StreamService.asmx");
                    service.InlineScript = true;
                    ScriptManager.GetCurrent(Page).Services.Add(service);

                    imgSearch.Src = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/iSearch.png");
                    if (GroupSettings == null)
                    {       // Let people search for a group in this case..
                        atiGroupListPanel.Visible = true;
                        atiGroupProfile.Visible = false;

                        if (this.UserSettings == null)
                        {
                            pageMyGroups.Visible = false;
                            tabMyGroups.Visible = false;
                        }

                        if (this.UserSettings != null && (this.UserSettings.LatHome != null && this.UserSettings.LatHome.Value > 0.0))
                        {
                            atiGMap.Lat = this.UserSettings.LatHome.Value;
                            atiGMap.Lng = this.UserSettings.LngHome.Value;
                            atiGMap.Zoom = 13;
                        }
                        imgAd.Src = ResolveUrl("~/portals/0/images/adTastyPaleo.jpg");
                        WebService.StreamService streamService = new WebService.StreamService();
                        if (this.UserSettings != null)
                        {   // TODO: need to hide the "My Group" section
                            string json = streamService.getGroupListData(this.UserSettings.Id, 0, 25);
                            ScriptManager.RegisterStartupScript(this, Page.GetType(), "MyGroups", "$(function(){ Aqufit.Page.atiMyGroupList.generateStreamDom('" + json + "'); });", true);
                        }
                       // string search = streamService.searchGroupListData(PortalId, null, 0, 15);

                        atiMyGroupList.IsOwner = true;

                        SetupFeaturedGroups();

                        // we need to setup for a location based group search                    
                       // ScriptManager.RegisterStartupScript(this, Page.GetType(), "GroupSearch", "$(function(){ Aqufit.Page.atiGroupSearch.generateStreamDom('" + search + "'); });", true);
                    }
                    else
                    {
                        atiWebLinksList.ProfileSettings = GroupSettings;
                        aHistory.HRef = baseUrl + GroupSettings.UserName + "/workout-history";
                        aLeaders.HRef = baseUrl + GroupSettings.UserName + "/achievements";
                        aMembers.HRef = baseUrl + GroupSettings.UserName + "/friends";
                        atiProfile.ProfileSettings = GroupSettings;
                        this.ProfileCSS = GroupSettings.CssStyle;
                        atiWorkoutScheduler.ProfileSettings = GroupSettings;
                       
                        litGroupName.Text = "<h2>" + GroupSettings.UserFirstName + "</h2>";
                        imgAdRight.Src = ResolveUrl("/portals/0/images/adTastyPaleo.jpg");
                        LoadChartData();

                        if (Request["w"] != null)
                        {
                            RadAjaxManager1.ResponseScripts.Add("$(function(){ Aqufit.Page.Tabs.SwitchTab(1); });");
                            long wId = Convert.ToInt64(Request["w"]);
                            WOD wod = entities.WODs.Include("WODType").FirstOrDefault(w => w.Id == wId);
                            if (wod != null)
                            {
                                atiWorkoutScheduler.SetControlToWOD = wod;
                            }
                        }

                        long[] friendIds = entities.UserFriends.Where(f => (f.SrcUserSettingKey == this.GroupSettings.Id || f.DestUserSettingKey == this.GroupSettings.Id) && f.Relationship >= (int)Affine.Utils.ConstsUtil.Relationships.GROUP_OWNER).Select(f => (f.SrcUserSettingKey == this.GroupSettings.Id ? f.DestUserSettingKey : f.SrcUserSettingKey)).ToArray();
                        IQueryable<Affine.Data.User> friends = entities.UserSettings.OfType<User>().Where(LinqUtils.BuildContainsExpression<User, long>(s => s.Id, friendIds)).OrderBy(s => s.Id);
                        int fcount = friends.Count();
                        UserSettings[] firendSettings = null;
                        if (fcount > 6)
                        {
                            Random rand = new Random((int)DateTime.Now.Millisecond);
                            int skip = rand.Next(fcount - 6);
                            firendSettings = friends.Skip(skip).Take(6).ToArray();
                        }
                        else
                        {
                            firendSettings = friends.Take(6).ToArray();
                        }
                        // PERMISSIONS: The action panel is only visible to OWNERS                     
                        if (GroupPermissions == ConstsUtil.Relationships.GROUP_OWNER || GroupPermissions == ConstsUtil.Relationships.GROUP_ADMIN)  // Need to find if user is an admin
                        {
                            atiProfile.IsOwner = true;
                            tabWorkout.Visible = true;
                            pageScheduleWOD.Visible = true;
                            bJoinGroup.Visible = false;     // for now owners can never leave the group ... mu ha ha ha
                            RadAjaxManager1.AjaxSettings.AddAjaxSetting(atiCommentPanel, atiCommentPanel, RadAjaxLoadingPanel1);
                        }
                        else if (GroupPermissions == ConstsUtil.Relationships.GROUP_MEMBER)
                        {
                            bJoinGroup.Text = "Leave Group";
                            RadAjaxManager1.AjaxSettings.AddAjaxSetting(atiCommentPanel, atiCommentPanel, RadAjaxLoadingPanel1);
                            RadAjaxManager1.AjaxSettings.AddAjaxSetting(bJoinGroup, bJoinGroup, RadAjaxLoadingPanel1);
                        }
                        else
                        {
                            tabComment.Visible = false;
                            pageViewComment.Visible = false;
                            RadAjaxManager1.AjaxSettings.AddAjaxSetting(bJoinGroup, bJoinGroup, RadAjaxLoadingPanel1);
                        }                      
                        // settup the users web links                    
                        this.BackgroundImageUrl = ResolveUrl("~/DesktopModules/ATI_Base/services/images/profile.aspx") + "?us=" + GroupSettings.Id + "&bg=1";
                        this.ProfileCSS = GroupSettings.CssStyle;                         
                        
                    }
                }
                
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }         
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);
            try
            {
                RadAjaxManager1.AjaxSettings.AddAjaxSetting(panelAjax, panelAjax, RadAjaxLoadingPanel2);
                atiProfileImage.Settings   = atiProfileLinks.ProfileSettings = base.UserSettings;
                atiProfileLinks.IsOwner    = true;
                atiFindInvite.UserSettings = UserSettings;
                atiFindInvite.TabId        = TabId;

                imgCheck.Src = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/iCheck.png");
                ServiceReference service = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/StreamService.asmx");
                service.InlineScript = true;
                ScriptManager.GetCurrent(Page).Services.Add(service);

                atiGMap.Lat  = UserSettings.LatHome;
                atiGMap.Lng  = UserSettings.LngHome;
                atiGMap.Zoom = 10;
                if (!Page.IsPostBack && !Page.IsCallback)
                {
                    instruction1.Text = "Upload a profile picture, so people know who you are, then click the 'save' button.";
                    if (Request["step"] != null)
                    {
                        instruction1.Text          += ".. or press the skip button in the bottom right.";
                        atiSidePanel.Visible        = false;
                        atiMainPanel.Style["width"] = "100%";
                        atiGMap.Width = Unit.Pixel(605);
                        // check if we may have info on this person from the 2011 crossfit open.
                        aqufitEntities entities = new aqufitEntities();
                        UserFriends    inDotCom = entities.UserFriends.FirstOrDefault(f => f.SrcUserSettingKey == UserSettings.Id && f.DestUserSettingKey == CROSSFIT_COM_ID);
                        if (inDotCom != null)
                        {
                            rbFollowDotCom.SelectedIndex = 0;
                        }
                        CompetitionAthlete[] found = entities.CompetitionAthletes.Where(a => string.Compare(a.AthleteName, UserSettings.UserFirstName + " " + UserSettings.UserLastName, true) == 0 && a.UserSetting == null).ToArray();
                        if (found.Length > 0)
                        {
                            foreach (CompetitionAthlete athlete in found)
                            {
                                Panel p = new Panel();
                                p.CssClass = "compAthleteIsMe";
                                p.Attributes["onclick"] = "Aqufit.Page.Actions.ConnectCompetitionAthlete(" + athlete.Id + ");";
                                Literal me = new Literal();
                                me.Text = "<span class=\"boldButton compAthleteIsMeButton\">This is Me !</span>";
                                p.Controls.Add(me);
                                Control ctrl = Page.LoadControl("~/DesktopModules/ATI_Base/controls/ATI_CompetitionAthlete.ascx");
                                ctrl.ID = "athlete" + athlete.Id;
                                p.Controls.Add(ctrl);
                                ASP.desktopmodules_ati_base_controls_ati_competitionathlete_ascx details = (ASP.desktopmodules_ati_base_controls_ati_competitionathlete_ascx)ctrl;
                                details.CompetitionAthleteId = athlete.Id;
                                p.Controls.Add(details);
                                phCompetitionAthlete.Controls.Add(p);
                            }
                            RadAjaxManager1.ResponseScripts.Add(" $(function(){ Aqufit.Page.Actions.LoadStep(0); }); ");
                        }
                        else
                        {
                            RadAjaxManager1.ResponseScripts.Add(" $(function(){ Aqufit.Page.Actions.LoadStep(" + Request["step"] + "); }); ");
                        }
                    }
                    else
                    {
                        RadAjaxManager1.ResponseScripts.Add(" $(function(){ $('#step0').hide(); }); ");
                    }
                    this.baseUrl  = ResolveUrl("~/");
                    userPhotoPath = this.baseUrl + @"\Portals\0\Users\" + base.UserSettings.UserName;
                    urlPath       = "/Portals/0/Users/" + base.UserSettings.UserName;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #49
0
 public static MethodReference Create(string serviceId, string serviceAliasId, string methodId)
 {
     return(new MethodReference(ServiceReference.Create(serviceId, serviceAliasId), methodId));
 }
Beispiel #50
0
 private void proxy_GetDocumentRevisionContentByIdCompleted(object sender, ServiceReference.GetDocumentRevisionContentByIdCompletedEventArgs args)
 {
     string content = args.Result;
     session.RevisionDialog.richTextBoxCurrentRevision.SelectAll();
     session.RevisionDialog.richTextBoxCurrentRevision.Selection.Text = content;
 }
Beispiel #51
0
        /// <summary>
        /// Sets session data, updates tree view and updates the open document view.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="args">The id of the document</param>
        private void proxy_AddDocumentWithUserDocumentCompleted(object sender, ServiceReference.AddDocumentWithUserDocumentCompletedEventArgs args)
        {
            int documentId = args.Result;
            session.CurrentDocumentID = documentId;

            string[] documentData = new string[] { documentId.ToString(), session.RootFolderID.ToString(), session.CurrentDocumentTitle };

            TreeViewModel.GetInstance().InsertDocument(documentData, gui.ExplorerTree.Items);
            SetOpenDocument(documentId, session.CurrentDocumentTitle, session.RootFolderID);
        }
Beispiel #52
0
        /// <summary>
        /// Creates a userdocument for the invited user.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="args">The email of the user</param>
        private void proxy_GetUserByEmailCompleted(Object sender, ServiceReference.GetUserByEmailCompletedEventArgs args)
        {
            ServiceReference.ServiceUser shareUser = args.Result;

            if (shareUser != null)
            {
                ServiceReference.Service1Client proxy = new ServiceReference.Service1Client();
                proxy.AddUserDocumentInRootAsync(shareUser.id, session.CurrentDocumentID);
                proxy.ShareDocumentWebAsync(session.CurrentDocumentID, session.UserID, shareUser.id);
                MessageBox.Show("Document shared with " + shareUser.email);
            }
            else
            {
                MessageBox.Show("User does not exist");
            }
        }
Beispiel #53
0
 /// <summary>
 /// Sets the session data and displays the correct dialog for the register operation.
 /// </summary>
 /// <param name="sender">The sender of the event</param>
 /// <param name="args"></param>
 private void proxy_AddUserCompleted(Object sender, ServiceReference.AddUserCompletedEventArgs args)
 {
     //-1 == user exists
     int successful = args.Result;
     if (successful == -1) //if the user already exsist
     {
         System.Windows.MessageBox.Show("User aldready exsists");
         session.Email = "";
     }
     else //the user has been created
     {
         System.Windows.MessageBox.Show("User with email: " + session.Email + " have been successfully created");
         session.UserID = successful;
     }
 }
 private void AddSharingBody(ServiceReference.User user)
 {
     if (user != null && Owner.id == Locator.LoginPageViewModel.User.id)
     {
         folderManagerService.AddSharingAsync(Owner.id, user.id, Name);
     }
 }
Beispiel #55
0
        /// <summary>
        /// Gets all the files and folders from a user, which are used to correctly update the view and data.
        /// </summary>
        /// <param name="sender">The sender ofthe event</param>
        /// <param name="args">The user data</param>
        private void proxy_GetAllFilesAndFoldersByUserIdCompleted(Object sender, ServiceReference.GetAllFilesAndFoldersByUserIdCompletedEventArgs args)
        {
            System.Collections.ObjectModel.ObservableCollection<System.Collections.ObjectModel.ObservableCollection<System.Collections.ObjectModel.ObservableCollection<string>>> foldersAndFiles = args.Result;
            string[][][] foldersAndFilesArrays = new string[2][][];

            for (int i = 0; i < 2; i++)
            {
                System.Collections.ObjectModel.ObservableCollection<string>[] temp = foldersAndFiles[i].ToArray();
                foldersAndFilesArrays[i] = new string[temp.Length][];
                for (int j = 0; j < temp.Length; j++)
                {
                    string[] tempfoldersorfiles = temp[j].ToArray();
                    foldersAndFilesArrays[i][j] = tempfoldersorfiles;
                }
            }

            TreeViewModel.GetInstance().LoadFilesAndFolders(gui.ExplorerTree.Items, foldersAndFilesArrays);
            gui.textBlockOnline.Text = "Online";
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);

            try
            {
                ServiceReference service = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/StreamService.asmx");
                service.InlineScript = true;
                ScriptManager.GetCurrent(Page).Services.Add(service);
                imgAd.Src         = ResolveUrl("/portals/0/images/adTastyPaleo.jpg");
                imgCheck.ImageUrl = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/iCheck.png");

                if (!Page.IsPostBack && !Page.IsCallback)
                {
                    baseUrl = ResolveUrl("~/");
                    long wId = 0;
                    if (HttpContext.Current.Items["w"] != null)
                    {
                        wId = Convert.ToInt64(HttpContext.Current.Items["w"]);
                    }
                    else if (Request["w"] != null)
                    {
                        wId = Convert.ToInt64(Request["w"]);
                    }

                    // Are we viewing a specific workout ?
                    if (wId > 0)
                    {
                        divMainLinks.Visible = true;

                        atiProfile.Visible     = false;
                        hiddenWorkoutKey.Value = "" + wId;
                        aqufitEntities entities = new aqufitEntities();
                        WOD            wod      = entities.WODs.Include("WODType").Include("WODSets").Include("WODSets.WODExercises").Include("WODSets.WODExercises.Exercise").FirstOrDefault(w => w.Id == wId);
                        if (base.UserSettings != null && wod.Standard == 0)
                        {
                            User2WODFav fav = entities.User2WODFav.FirstOrDefault(mr => mr.WOD.Id == wod.Id && mr.UserSetting.Id == UserSettings.Id);
                            bAddWorkout.Visible    = fav == null;
                            bRemoveWorkout.Visible = fav != null;
                        }
                        lWorkoutTitle.Text = wod.Name;

                        //  lWorkoutDescription.Text = wod.Description;

                        // constructWorkoutInfo(wod);
                        lWorkoutInfo.Text = wod.Description;
                        if (wod.Standard > 0)
                        {
                            imgCrossFit.Visible   = true;
                            imgCrossFit.Src       = ResolveUrl("~/DesktopModules/ATI_Base/resources/images/xfit.png");
                            atiProfileImg.Visible = false;
                        }
                        else
                        {
                            atiProfileImg.Settings = entities.UserSettings.FirstOrDefault(us => us.Id == wod.UserSettingsKey);
                        }
                        atiWorkoutPanel.Visible  = false;
                        atiWorkoutViewer.Visible = true;

                        // Get the leader board
                        IQueryable <Workout> stream = entities.UserStreamSet.OfType <Workout>().Where(w => w.WOD.Id == wId);
                        long typeId = entities.WODs.Where(w => w.Id == wId).Select(w => w.WODType.Id).FirstOrDefault();
                        switch (typeId)
                        {
                        case (long)Affine.Utils.WorkoutUtil.WodType.AMRAP:
                        case (long)Affine.Utils.WorkoutUtil.WodType.SCORE:
                            atiScoreRangePanel.Visible = true;
                            stream = stream.OrderByDescending(w => w.Score);
                            break;

                        case (long)Affine.Utils.WorkoutUtil.WodType.MAX_WEIGHT:
                            atiMaxRangePanel.Visible = true;
                            atiMaxWeightUnitsFirst.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS);
                            atiMaxWeightUnitsFirst.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_KG);
                            atiMaxWeightUnitsFirst.Selected = WeightUnits;
                            atiMaxWeightUnitsLast.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS);
                            atiMaxWeightUnitsLast.UnitList.Add(Affine.Utils.UnitsUtil.MeasureUnit.UNIT_KG);
                            atiMaxWeightUnitsLast.Selected = WeightUnits;
                            stream = stream.OrderByDescending(w => w.Max);
                            break;

                        case (long)Affine.Utils.WorkoutUtil.WodType.TIMED:
                            atiTimeSpanePanel.Visible = true;
                            stream = stream.OrderBy(w => w.Duration);
                            break;

                        default:
                            stream = stream.OrderByDescending(w => w.TimeStamp);
                            break;
                        }
                        string js = string.Empty;
                        atiShareLink.ShareLink  = "http://" + Request.Url.Host + "/workout/" + wod.Id;
                        atiShareLink.ShareTitle = "FlexFWD.com crossfit WOD " + wod.Name;

                        workoutTabTitle.Text = "&nbsp;" + (string.IsNullOrWhiteSpace(wod.Name) ? "Untitled" : wod.Name) + "&nbsp;";
                        Affine.WebService.StreamService ss = new WebService.StreamService();
                        string jsonEveryone = ss.getStreamDataForWOD(wod.Id, -1, 0, 15, true, true, -1, -1, -1);

                        string jsonYou = string.Empty;

                        js += " Aqufit.Page." + atiWorkoutHighChart.ID + ".fromStreamData('" + jsonEveryone + "'); ";
                        if (base.UserSettings != null)
                        {
                            hlLogWorkout.HRef = baseUrl + UserSettings.UserName + "?w=" + wId;
                            hlWorkouts.HRef   = baseUrl + UserSettings.UserName + "/workout-history";
                            jsonYou           = ss.getStreamDataForWOD(wod.Id, base.UserSettings.Id, 0, 10, true, true, -1, -1, -1);
                            js += "Aqufit.Page.atiYouStreamScript.generateStreamDom('" + jsonYou + "');";
                            js += " Aqufit.Page." + atiWorkoutHighChart.ID + ".fromYourStreamData('" + jsonYou + "'); ";
                            // TODO: this could be improved on...
                            Workout thisWod = entities.UserStreamSet.OfType <Workout>().FirstOrDefault(w => w.UserSetting.Id == UserSettings.Id && w.WOD.Id == wId);
                            if (thisWod != null)
                            {   // graphs of this wod
                                hlGraph.HRef = ResolveUrl("~/") + UserSettings.UserName + "/workout/" + thisWod.Id;
                            }
                            else
                            {   // just grab any workout then..
                                Workout any = entities.UserStreamSet.OfType <Workout>().OrderByDescending(w => w.Id).FirstOrDefault(w => w.UserSetting.Id == UserSettings.Id);
                                if (any != null)
                                {
                                    hlGraph.HRef = ResolveUrl("~/") + UserSettings.UserName + "/workout/" + any.Id;
                                }
                                else
                                {   // no workouts ??? say what.. slack man :) hide graph
                                    hlGraph.Visible = false;
                                }
                            }
                        }
                        else
                        {
                            hlGraph.HRef                 = ResolveUrl("~/Login");
                            hlLogWorkout.HRef            = hlGraph.HRef;
                            hlWorkouts.HRef              = hlGraph.HRef;
                            atiPanelYourProgress.Visible = false;
                        }
                        hlCreateWOD.HRef  = baseUrl + "Profile/WorkoutBuilder";
                        hlMyWorkouts.HRef = baseUrl + "Profile/MyWorkouts";
                        js += " Aqufit.Page." + atiWorkoutHighChart.ID + ".drawChart(); ";



                        ScriptManager.RegisterStartupScript(this, Page.GetType(), "SimilarRouteList", "$(function(){ " + js + " Aqufit.Page.atiEveryoneStreamScript.generateStreamDom('" + jsonEveryone + "'); });", true);



                        YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri);
                        //order results by the number of views (most viewed first)
                        query.OrderBy          = "viewCount";
                        query.NumberToRetrieve = 3;
                        query.SafeSearch       = YouTubeQuery.SafeSearchValues.Moderate;

                        YouTubeRequestSettings settings = new YouTubeRequestSettings(ConfigurationManager.AppSettings["youtubeApp"], ConfigurationManager.AppSettings["youtubeKey"]);
                        YouTubeRequest         request  = new YouTubeRequest(settings);
                        const int     NUM_ENTRIES       = 50;
                        IList <Video> videos            = new List <Video>();
                        IList <Video> groupVideo        = new List <Video>();
                        // first try to find videos with regard to users group
                        Feed <Video> videoFeed = null;

                        if (this.UserSettings != null)
                        {
                            long[] groupIds = entities.UserFriends.Where(f => (f.SrcUserSettingKey == UserSettings.Id || f.DestUserSettingKey == UserSettings.Id) && f.Relationship >= (int)Affine.Utils.ConstsUtil.Relationships.GROUP_OWNER).Select(f => f.SrcUserSettingKey == UserSettings.Id ? f.DestUserSettingKey : f.SrcUserSettingKey).ToArray();
                            Group  business = entities.UserSettings.OfType <Group>().Where(Utils.Linq.LinqUtils.BuildContainsExpression <Group, long>(us => us.Id, groupIds)).FirstOrDefault(g => g.GroupType.Id == 1);
                            if (business != null)
                            {   // TODO: need the business name...
                                query.Query = business.UserName;
                            }
                            else
                            {
                                UserSettings creator = entities.UserSettings.FirstOrDefault(u => u.Id == wod.UserSettingsKey);
                                if (creator is Group)
                                {   // TODO: need the business name...
                                    query.Query = creator.UserFirstName + " " + creator.UserLastName;
                                }
                                else
                                {
                                    query.Query = UserSettings.UserFirstName + " " + UserSettings.UserLastName;
                                }
                            }
                            videoFeed = request.Get <Video>(query);
                            foreach (Video v in videoFeed.Entries)
                            {
                                groupVideo.Add(v);
                            }
                        }
                        if (videos.Count < NUM_ENTRIES)
                        {   // now try the crossfit WOD name
                            query.NumberToRetrieve = NUM_ENTRIES - videos.Count;
                            query.Query            = "crossfit wod " + wod.Name;
                            videoFeed = request.Get <Video>(query);
                            foreach (Video v in videoFeed.Entries)
                            {
                                videos.Add(v);
                            }
                            if (videos.Count < NUM_ENTRIES)
                            {   // this is last resort .. just get videos about crossfit...
                                query.NumberToRetrieve = NUM_ENTRIES - videos.Count;
                                query.Query            = "crossfit wod";
                                videoFeed = request.Get <Video>(query);
                                foreach (Video v in videoFeed.Entries)
                                {
                                    videos.Add(v);
                                }
                            }
                        }

                        const int TAKE = 3;
                        if (videos.Count > TAKE)
                        {
                            Random random = new Random((int)DateTime.Now.Ticks);
                            int    rand   = random.Next(videos.Count - TAKE);
                            videos = videos.Skip(rand).Take(TAKE).ToList();
                            if (groupVideo.Count > 0)
                            {
                                // always replace one of the main videos with a gorup one.. (if possible)
                                rand      = random.Next(groupVideo.Count - 1);
                                videos[0] = groupVideo[rand];
                            }
                            atiYoutubeThumbList.VideoFeed = videos;
                        }
                        else
                        {
                            atiVideoPanel.Visible = false;
                        }
                    }
                    else
                    {
                        atiVideoPanel.Visible     = false;
                        atiPanelQuickView.Visible = false;
                        hlGraph.Visible           = false;
                        aqufitEntities entities      = new aqufitEntities();
                        var            exerciseArray = entities.Exercises.OrderBy(x => x.Name).Select(x => new{ Text = x.Name, Value = x.Id }).ToArray();
                        RadListBoxExcerciseSource.DataSource = exerciseArray;
                        RadListBoxExcerciseSource.DataBind();

                        string order = orderDate.Checked ? "date" : "popular";
                        if (Settings["Configure"] != null && Convert.ToString(Settings["Configure"]).Equals("ConfigureMyWorkouts"))
                        {
                            this.IsMyWorkouts          = true;
                            atiProfile.ProfileSettings = base.UserSettings;
                            atiProfile.IsOwner         = true;
                            atiProfile.IsSmall         = true;
                            atiWorkoutPanel.Visible    = true;
                            workoutTabTitle.Text       = "My Workouts";
                            liMyWorkouts.Visible       = false;
                            liFindWorkout.Visible      = true;
                            WebService.StreamService streamService = new WebService.StreamService();
                            string json = streamService.GetWorkouts(base.UserSettings.Id, 0, 30, order, null);
                            ScriptManager.RegisterStartupScript(this, Page.GetType(), "WorkoutList", "$(function(){ Aqufit.Page.atiWorkoutListScript.isMyRoutes = true; Aqufit.Page.atiWorkoutListScript.generateStreamDom('" + json + "'); });", true);
                        }
                        else
                        {
                            this.IsMyWorkouts        = false;
                            atiProfile.Visible       = false;
                            workoutTabTitle.Text     = "Workouts";
                            atiWorkoutPanel.Visible  = true;
                            atiWorkoutViewer.Visible = false;
                            WebService.StreamService streamService = new WebService.StreamService();
                            string json = streamService.GetWorkouts(-1, 0, 30, order, null);
                            ScriptManager.RegisterStartupScript(this, Page.GetType(), "WorkoutList2", "$(function(){ Aqufit.Page.atiWorkoutListScript.generateStreamDom('" + json + "'); });", true);
                        }
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #57
0
        /// <summary>
        /// Sets gui view and session data. Calls additional asynchronous calls to set update view and data.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="args">The user credentials</param>
        private void proxy_GetUserByEmailAndPassCompleted(Object sender, ServiceReference.GetUserByEmailAndPassCompletedEventArgs args)
        {
            ServiceReference.ServiceUser user = args.Result;
            if (user != null) //login successful
            {
                //User logged in
                session.UserID = user.id;
                session.RootFolderID = user.rootFolderId;

                gui.SetLoginView(true);

                ServiceReference.Service1Client proxy = new ServiceReference.Service1Client();
                proxy.GetAllFilesAndFoldersByUserIdAsync(user.id);
                proxy.GetAllFilesAndFoldersByUserIdCompleted += new EventHandler<ServiceReference.GetAllFilesAndFoldersByUserIdCompletedEventArgs>(proxy_GetAllFilesAndFoldersByUserIdCompleted);
            }
            else
            {
                session.Email = "";
                gui.textBlockOnline.Text = "Offline";
                MessageBox.Show("Wrong email or password");
            }
        }
Beispiel #58
0
        public void AddDependency_ShouldThrowOnExternallyOwnedService()
        {
            var svc = new ServiceReference(new AbstractServiceEntry(typeof(IDummyService), null, new Mock <IServiceContainer>(MockBehavior.Strict).Object), value: new Mock <IDummyService>().Object, false);

            Assert.Throws <InvalidOperationException>(() => svc.AddDependency(new ServiceReference(new AbstractServiceEntry(typeof(IDisposable), null, new Mock <IServiceContainer>(MockBehavior.Strict).Object), value: new Disposable(), false)), Resources.FOREIGN_DEPENDENCY);
        }
Beispiel #59
0
        /// <summary>
        /// Receives a merge result and interpret whether it is a conflict. If a conflict exists the merge view is setup.
        /// </summary>
        /// <param name="sender">The merge result</param>
        /// <param name="args">Event arguments. Not used</param>
        private void proxy_SyncDocumentWebCompleted(Object sender, ServiceReference.SyncDocumentWebCompletedEventArgs args)
        {
            if (args.Result != null) //if there is a conflict
            {
                string[][] responseArrays = new string[4][];
                for (int i = 0; i < args.Result.Count; i++)
                {
                    responseArrays[i] = args.Result[i].ToArray();
                }

                gui.SetupMergeView(responseArrays);
            }
        }
 void accountService_UserListCompleted(object sender, ServiceReference.UserListCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         Users = e.Result.Value;
         RaisePropertyChange("Users");
     }
 }