• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# aqufitEntities类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中aqufitEntities的典型用法代码示例。如果您正苦于以下问题:C# aqufitEntities类的具体用法?C# aqufitEntities怎么用?C# aqufitEntities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



aqufitEntities类属于命名空间,在下文中一共展示了aqufitEntities类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Page_Load

    //$response[] = array($i, $name, null, '<img src="images/'. $filename . (file_exists('images/' . $filename . '.jpg') ? '.jpg' : '.png') .'" /> ' . $name);
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Items["UserId"] = 8;
            if (Items["UserId"] != null && Request["search"] != null)
            {
                string search = Request["search"];

                aqufitEntities entities = new aqufitEntities();
                long uid = Convert.ToInt64(Items["UserId"]);
                IList<long> friendIds = entities.UserFriends.Where(f => (f.PortalKey == 0) && (f.SrcUserKey == uid || f.DestUserKey == uid)).Select(f => (f.SrcUserKey == uid ? f.DestUserKey : f.SrcUserKey)).ToList();
                UserSettings[] firendSettings = entities.UserSettings.Where(LinqUtils.BuildContainsExpression<UserSettings, long>(s => s.UserKey, friendIds)).Where(f => f.UserName.ToLower().Contains(search) || f.UserFirstName.ToLower().Contains(search) || f.UserLastName.ToLower().Contains(search)).ToArray();
                //
                object[] response = firendSettings.Select(f => new object[] { "" + f.UserKey, f.UserName + " (" + f.UserFirstName + "," + f.UserLastName + ")", null, "<img src=\"" + ResolveUrl("~/services/images/profile.aspx?u=" + f.UserKey) + "\" align=\"middle\"/>&nbsp;&nbsp;" + f.UserName + " (" + f.UserFirstName + "," + f.UserLastName + ")" }).ToArray();
                //object[] response = {new object[]{ "5", "fdsafda dfsa fdsa", null, null } };
                Response.Write(serializer.Serialize(response));
                Response.End();
            }
        }
        catch (Exception)
        {
            //Affine.Data.json.MapRoute route = new Affine.Data.json.MapRoute() { Id = -1 };
            //Response.Write(serializer.Serialize(route));
        }
    }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:27,代码来源:Friends.aspx.cs


示例2: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Request["i"] != null )
         {
             long iid = Convert.ToInt64(Request["i"]);
             aqufitEntities entities = new aqufitEntities();
             Affine.Data.Image img = entities.Image.FirstOrDefault(i => i.Id == iid);
             if (Request["f"] != null)
             {
                 Affine.Data.Image image = entities.Image.FirstOrDefault(i => i.Id == img.ImageLargeKey);
                 Response.ContentType = image.ContentType;
                 Response.OutputStream.Write(image.Bytes, 0, image.Bytes.Length);
                 Response.Flush();
                 Response.End();
             }
             else
             {
                 Response.ContentType = img.ContentType;
                 Response.OutputStream.Write(img.Bytes, 0, img.Bytes.Length);
                 Response.Flush();
                 Response.End();
             }
         }
     }
     catch (Exception)
     {
         // fall through
     }
     Response.Flush();
     Response.End();
 }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:33,代码来源:image.aspx.cs


示例3: atiRadComboBoxSearchMessageInbox_ItemsRequested

        protected void atiRadComboBoxSearchMessageInbox_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            // TODO: we need to search "reply" text and add those messages to the results.
            RadComboBox atiRadComboBoxSearchMessageInbox = (RadComboBox)sender;
            atiRadComboBoxSearchMessageInbox.Items.Clear();
            const int TAKE = 5;
            aqufitEntities entities = new aqufitEntities();
            int itemOffset = e.NumberOfItems;
            IQueryable<Message> messagesQuery = entities.MessageRecipiants.Where( m => m.UserSettingsKey == this.UserSettings.Id ).Select( m => m.Message ).OrderBy(m => m.DateTime);
            int length = messagesQuery.Count();
            messagesQuery = string.IsNullOrEmpty(e.Text) ? messagesQuery.Where(m => m.UserSetting.Id != this.UserSettings.Id).Skip(itemOffset).Take(TAKE) : messagesQuery.Where(m => m.UserSetting.Id != this.UserSettings.Id && m.Subject.ToLower().Contains(e.Text) || m.Text.ToLower().Contains(e.Text)).Skip(itemOffset).Take(TAKE);

            Message[] messages = messagesQuery.ToArray();

            foreach (Message m in messages)
            {
                RadComboBoxItem item = new RadComboBoxItem(m.Subject);
                item.Value = "" + m.Id;
               // item.ImageUrl = ResolveUrl("~/DesktopModules/ATI_Base/services/images/profile.aspx") + "?u=" + g.UserKey + "&p=" + g.PortalKey;
                atiRadComboBoxSearchMessageInbox.Items.Add(item);
            }
            int endOffset = Math.Min(itemOffset + TAKE + 1, length);
            e.EndOfItems = endOffset == length;
            e.Message = (length <= 0) ? "No matches" : String.Format("Items <b>1</b>-<b>{0}</b> of {1}", endOffset, length);
        }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:25,代码来源:ViewATI_Messages.ascx.cs


示例4: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     aqufitEntities entities = new aqufitEntities();
     if (this.CompetitionAthleteId > 0)
     {
         CompetitionAthlete athlete = entities.CompetitionAthletes.FirstOrDefault(a => a.Id == CompetitionAthleteId);
         if (athlete != null)
         {
             litName.Text = athlete.AthleteName + " " + athlete.OverallRank + "(" + athlete.OverallScore + ")";
             imgAthlete.ImageUrl = athlete.ImgUrl;
             string html = "<ul>";
             if( athlete.Height.HasValue ){
                 double inch = Affine.Utils.UnitsUtil.systemDefaultToUnits(athlete.Height.Value, Affine.Utils.UnitsUtil.MeasureUnit.UNIT_INCHES );
                 html += "<li>Height: <em>" + Math.Floor(inch/12.0) + "' " + Math.Ceiling(inch%12.0) + "\"</em></li>";
             }
             if( athlete.Weight.HasValue ){
                 double lbs = Affine.Utils.UnitsUtil.systemDefaultToUnits(athlete.Weight.Value, Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS);
                 html += "<li>Weight: <em>" + Math.Round(lbs, 2) + "</em></li>";
             }
             html += "<li>&nbsp;</li>";
             html += "<li>Affiliate: <em>" + athlete.AffiliateName + "</em></li>";
             html += "<li>Region: <em>" + athlete.RegionName + "</em></li>";
             html += "<li>Hometown: <em>" + athlete.Hometown + "</em></li>";
             html += "<li>Country: <em>" + athlete.Country + "</em></li>";
             html += "</ul>";
             litDetails.Text = html;
         }
     }
 }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:29,代码来源:ATI_CompetitionAthlete.ascx.cs


示例5: Page_Load

    /*
    <u>{userId}</u>
    <t>{token}</t>
    <ds>{dateSrc}</ds>
    <d>{description}</d>
    <n>{workoutName}</n>
    <wt>{WODType}</wt>
    <at>{amrapTime}</at>
     */
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "application/json";
        if (!string.IsNullOrWhiteSpace(Request.Form["u"]))
        {
            object json = new{ Id = -1, Status = "FAIL", Msg = "" };
            try
            {
                aqufitEntities entities = new aqufitEntities();
                long uid = Convert.ToInt64(Request.Form["u"]);
                string token = Convert.ToString(Request.Form["t"]);     // our limited security model ;)
                int wodType = Convert.ToInt32(Request.Form["wt"]);
                string description = Convert.ToString(Request.Form["d"]);
                string name = Convert.ToString(Request.Form["n"]);
                long dataSrc = Convert.ToInt64(Request.Form["ds"]);
                long amrapTime = Convert.ToInt64(Request.Form["at"]);

                Guid gToken = Guid.Parse(token);
                User user = entities.UserSettings.OfType<User>().FirstOrDefault(u => u.Id == uid && u.Guid == gToken);

                Affine.Data.json.Exercise[] none = new Affine.Data.json.Exercise[0];
                long wodId = dataManager.CreateWOD(user.Id, name, description, wodType, amrapTime, none);
                json = new { Id = wodId, Status = "SUCCESS", Msg = "" };
            }
            catch (Exception ex)
            {
                json = new { Id = -1, Status = "FAIL", Msg = ex.Message.Replace("'", "") };
            }
            Response.Write(serializer.Serialize(json));
            Response.Flush();
            Response.End();
        }
    }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:42,代码来源:workoutCreate.aspx.cs


示例6: Page_Load

    //$response[] = array($i, $name, null, '<img src="images/'. $filename . (file_exists('images/' . $filename . '.jpg') ? '.jpg' : '.png') .'" /> ' . $name);
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "application/json";
        if (!string.IsNullOrWhiteSpace(Request.Form["u"]))
        {
            object json = new { Status = "FAIL", Msg = "" };
            try
            {
                aqufitEntities entities = new aqufitEntities();
                long uid = Convert.ToInt64(Request.Form["u"]);
                string token = Convert.ToString(Request.Form["t"]);     // our limited security model ;)
                long sk = Convert.ToInt64(Request.Form["sk"]);
                long profileKey = Convert.ToInt64(Request.Form["p"]);
                string comment = Convert.ToString(Request.Form["c"]);
                Guid guid = Guid.Parse(token);
                User user = entities.UserSettings.OfType<User>().FirstOrDefault(u => u.Id == uid && u.Guid == guid);

                Affine.Data.Managers.LINQ.DataManager.Instance.AddComment(user.UserKey, user.PortalKey, profileKey, sk, comment);
                json = new { Status = "SUCCESS", Msg = "" };
            }
            catch (Exception ex)
            {
                json = new { Status = "FAIL", Msg = ex.Message.Replace("'", "") };
            }
            Response.Write(serializer.Serialize(json));
            Response.Flush();
            Response.End();
        }
    }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:30,代码来源:comment.aspx.cs


示例7: bSend_Click

 protected void bSend_Click(object sender, EventArgs e)
 {
     aqufitEntities entities = new aqufitEntities();
     UserSettings settings = null;
     if (this.UserId > 0)
     {
         settings = entities.UserSettings.FirstOrDefault(us => us.UserKey == this.UserId && us.PortalKey == this.PortalId);
     }
     string un = settings != null ? settings.UserName : "";
     string url = Request["u"] != null ? Request["u"] : Request.Url.AbsoluteUri;
     long tab = Request["t"] != null ? Convert.ToInt64(Request["t"]) : this.TabId;
     string email = string.Empty;
     if (this.UserId > 0)
     {
         email = entities.UserSettings.FirstOrDefault(u => u.Id == this.UserId && u.PortalKey == this.PortalId).UserEmail;
     }
     else
     {
         email = txtEmail.Text;
     }
     BugReport bug = new BugReport()
     {
         Description = txtDescription.Text,
         UserAgent = Request.UserAgent,
         UserId = this.UserId,
         UserName = un,
         PortalId = this.PortalId,
         PortalName = this.PortalAlias.HTTPAlias,
         AbsoluteUrl = Request.Url.AbsoluteUri,
         AbsoluteUrlReferrer = url,
         DateTime = DateTime.Now,
         Ip = Request.ServerVariables["REMOTE_ADDR"],
         RawUrl = Request.RawUrl,
         ScreenResolution = hiddenScreenRes.Value,
         Status = "Open",
         Email = email,
         ActiveTabId = this.TabId,
         IsContactRequest = panelContactHead.Visible
     };
     entities.AddToBugReports(bug);
     entities.SaveChanges();
     bSend.Visible = false;
     txtDescription.Visible = false;
     if (panelBugHead.Visible)   // This moduel is configured to report bugs
     {
         sendBugNotificationEmailAsync(bug);
         litStatus.Text = "<em>Thank You</em>.  Bear with us as we work out some of the kinks in our system.";
     }
     else
     {
         sendContactNotificationEmailAsync(bug);
         litStatus.Text = "<em>Thank You</em>.  Your request has been sent.  We will get back to you as soon as we possibly can.";
     }
 }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:54,代码来源:ViewATI_BugReporter.ascx.cs


示例8: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!string.IsNullOrEmpty(Request["u"]) && !string.IsNullOrEmpty(Request["json"]))
            {
                string jsonString = Request["json"];

                Affine.Data.json.MapRoute mapRoute = serializer.Deserialize<Affine.Data.json.MapRoute>(jsonString);

                long userKey = Convert.ToInt64(Request["u"]);
                Affine.Data.MapRoute route = new MapRoute()
                {
                    Name = mapRoute.Name,
                    City = mapRoute.City,
                    Region = mapRoute.Region,
                    Rating = mapRoute.Rating,
                    PortalKey = 0,                  // TODO: send this in
                    UserKey = userKey,
                    RouteDistance = mapRoute.RouteDistance,
                    LatMax = mapRoute.LatMax,
                    LatMin = mapRoute.LatMin,
                    LngMax = mapRoute.LngMax,
                    LngMin = mapRoute.LngMin,
                    CreationDate = DateTime.Now
                };
                Affine.Data.MapRoutePoint[] points = mapRoute.MapRoutePoints.Select(mp => new Affine.Data.MapRoutePoint() { Lat = mp.Lat, Lng = mp.Lng, Order = mp.Order, MapRoute = route }).ToArray<Affine.Data.MapRoutePoint>();
                route.MapRoutePoints.Concat(points);
                aqufitEntities entities = new aqufitEntities();
                entities.AddToMapRoutes(route);
                long id = entities.SaveChanges();
                MapRoute passback = entities.MapRoutes.Where(m => m.UserKey == userKey ).OrderByDescending( m => m.Id).FirstOrDefault();
                Affine.Data.json.MapRoute mr = new Affine.Data.json.MapRoute() { Id = passback.Id, Name = passback.Name, RouteDistance = passback.RouteDistance };
                string json = serializer.Serialize(mr);
                Response.Write(json);
            }
            else
            {
                Affine.Data.json.MapRoute route = new Affine.Data.json.MapRoute() { Id = -1 };
                Response.Write(serializer.Serialize(route));
            }
        }
        catch (Exception)
        {
            Affine.Data.json.MapRoute route = new Affine.Data.json.MapRoute() { Id = -1 };
            Response.Write(serializer.Serialize(route));
        }
    }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:48,代码来源:MapRoute.aspx.cs


示例9: bSave_Click

 protected void bSave_Click(object sender, EventArgs e)
 {
     try
     {
         _hId = Request["h"] != null ? Convert.ToInt64(Request["h"]) : 1;
         aqufitEntities entities = new aqufitEntities();
         HelpPage helpPage = entities.HelpPages.FirstOrDefault(h => h.Id == _hId);
         helpPage.Content = TextEditor.RichText.Text;
         entities.SaveChanges();
         RadAjaxManager1.ResponseScripts.Add("alert('Content Saved');");
     }
     catch (Exception ex)
     {
         RadAjaxManager1.ResponseScripts.Add("alert('Error: "+ex.Message+"');");
     }
 }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:16,代码来源:EditATI_HowTo.ascx.cs


示例10: Page_Load

 //$response[] = array($i, $name, null, '<img src="images/'. $filename . (file_exists('images/' . $filename . '.jpg') ? '.jpg' : '.png') .'" /> ' . $name);
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.ContentType = "application/json";
     if (!string.IsNullOrWhiteSpace(Request.Form["u"]))
     {
         aqufitEntities entities = new aqufitEntities();
         long uid = Convert.ToInt64( Request.Form["u"] );
         Guid token = Guid.Parse( Request.Form["t"] );
         User user = entities.UserSettings.OfType<User>().FirstOrDefault(u => u.Id == uid && u.Guid == token);
         string json = ss.getStreamData(0, user.UserKey, user.PortalKey, user.UserKey, 0, 0, 0, 30);
         json = json.Replace(";", "");   // this messes up the json parser .. frig..
         Response.Write(json);
         Response.Flush();
         Response.End();
     }
 }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:17,代码来源:stream.aspx.cs


示例11: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "application/json";
        if (!string.IsNullOrWhiteSpace(Request.Form["u"]))
        {
            aqufitEntities entities = new aqufitEntities();
            long uid = Convert.ToInt64( Request.Form["u"] );
            Guid token = Guid.Parse( Request.Form["t"] );
            User user = entities.UserSettings.OfType<User>().FirstOrDefault(u => u.Id == uid && u.Guid == token);
            string search = Request["s"] != null ? Convert.ToString(Request["s"]) : "";

            if (!string.IsNullOrWhiteSpace(search))
            {
                IQueryable<Workout> wodsToDisplay = entities.UserStreamSet.OfType<Workout>().Include("WOD").Where(w => w.UserSetting.Id == user.Id && w.Title.StartsWith(search));
                wodsToDisplay.Take(25);
                Workout[] timedWods = wodsToDisplay.Where(w => w.WOD.WODType.Id == (int)Affine.Utils.WorkoutUtil.WodType.TIMED).OrderBy(w => w.Duration).ToArray();
                IList<NameValue> cfTotals = timedWods.Select(w => new NameValue() { Name = w.Title, Value = Affine.Utils.UnitsUtil.durationToTimeString(Convert.ToInt64(w.Duration)), Date = w.Date.ToShortDateString(), Notes = "" + w.Description }).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 NameValue() { Name = w.Title, Value = Convert.ToString(w.Score), Date = w.Date.ToShortDateString(), Notes = "" + w.Description }).ToList()).ToList();
                Workout[] maxWods = wodsToDisplay.Where(w => w.WOD.WODType.Id == (int)Affine.Utils.WorkoutUtil.WodType.MAX_WEIGHT).ToArray();
                Affine.Utils.UnitsUtil.MeasureUnit WeightUnits = Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS;
                cfTotals = cfTotals.Concat(maxWods.Select(w => new NameValue() { Name = w.Title, Value = Affine.Utils.UnitsUtil.systemDefaultToUnits(w.Max.Value, WeightUnits) + " " + Affine.Utils.UnitsUtil.unitToStringName(WeightUnits), Date = w.Date.ToShortDateString(), Notes = "" + w.Description }).ToList()).ToList();
                Response.Write(serializer.Serialize(cfTotals.OrderBy(t => t.Name).ToArray()));
            }
            else
            {
                IQueryable<Workout> crossfitWorkouts = entities.UserStreamSet.OfType<Workout>().Include("WOD").Where(w => w.UserSetting.Id == user.Id && w.IsBest == true);
                int numDistinct = crossfitWorkouts.Select(w => w.WOD).Distinct().Count();
                IQueryable<Workout> wodsToDisplay = null;
                wodsToDisplay = crossfitWorkouts.OrderByDescending(w => w.Id);
                // 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<NameValue> cfTotals = timedWods.Select(w => new NameValue() { Name = w.Title, Value = Affine.Utils.UnitsUtil.durationToTimeString(Convert.ToInt64(w.Duration)), Date = w.Date.ToShortDateString(), Notes = "" + w.Description }).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 NameValue() { Name = w.Title, Value = Convert.ToString(w.Score), Date = w.Date.ToShortDateString(), Notes = "" + w.Description }).ToList()).ToList();
                Workout[] maxWods = wodsToDisplay.Where(w => w.WOD.WODType.Id == (int)Affine.Utils.WorkoutUtil.WodType.MAX_WEIGHT).ToArray();
                Affine.Utils.UnitsUtil.MeasureUnit WeightUnits = Affine.Utils.UnitsUtil.MeasureUnit.UNIT_LBS;
                cfTotals = cfTotals.Concat(maxWods.Select(w => new NameValue() { Name = w.Title, Value = Affine.Utils.UnitsUtil.systemDefaultToUnits(w.Max.Value, WeightUnits) + " " + Affine.Utils.UnitsUtil.unitToStringName(WeightUnits), Date = w.Date.ToShortDateString(), Notes = "" + w.Description }).ToList()).ToList();
                Response.Write(serializer.Serialize(cfTotals.OrderBy(t => t.Name).ToArray()));
            }
            Response.Flush();
            Response.End();
        }
    }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:46,代码来源:history.aspx.cs


示例12: Page_Load

    //$response[] = array($i, $name, null, '<img src="images/'. $filename . (file_exists('images/' . $filename . '.jpg') ? '.jpg' : '.png') .'" /> ' . $name);
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "application/json";
        IList<object> json = new List<object>();
        json.Add( new { Id = 0, Name = "", Type =  1} );
        try
        {
            if (!string.IsNullOrWhiteSpace(Request.Form["u"]))
            {
                aqufitEntities entities = new aqufitEntities();
                long uid = Convert.ToInt64(Request.Form["u"]);
                Guid token = Guid.Parse(Request.Form["t"]);
                User user = entities.UserSettings.OfType<User>().FirstOrDefault(u => u.Id == uid && u.Guid == token);
                DateTime date = Convert.ToDateTime(Request.Form["d"]);
                string search = Request.Form["s"];
                if (string.IsNullOrWhiteSpace(search) && user.MainGroupKey.HasValue)
                {
                    WODSchedule schedule = entities.WODSchedules.Include("WOD").Include("WOD.WODType").FirstOrDefault(s => s.UserSetting.Id == user.MainGroupKey.Value && s.Date == date);
                    if (schedule != null)
                    {
                        json.RemoveAt(0);
                        json.Add(new { Id = schedule.WOD.Id, Name = schedule.WOD.Name, Type = schedule.WOD.WODType.Id });
                    }
                }
                else
                {
                    search = search.ToLower();
                    IQueryable<WOD> wods = entities.User2WODFav.Where(w => w.UserSetting.Id == user.Id).Select(w => w.WOD);
                    wods = wods.Union<WOD>(entities.WODs.Where(w => w.Standard > 0));
                    wods.Select(w => w.WODType).ToArray();  // hydrate WODTypes
                    wods = wods.Where(w => w.Name.ToLower().Contains(search)).OrderBy(w => w.Name).Take(10);
                    json = wods.Select(w => new { Id = w.Id, Name = w.Name, Type = w.WODType.Id }).ToArray();
                }

            }
        }
        catch (Exception ex)
        {
            json.RemoveAt(0);
            json.Add( new { WorkoutId = 0, Name = ex.Message } );
        }
        Response.Write(serializer.Serialize( json ));
        Response.Flush();
        Response.End();
    }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:46,代码来源:workout.aspx.cs


示例13: bRemoveImg1_Click

 protected void bRemoveImg1_Click(object sender, EventArgs e)
 {
     long rid = Convert.ToInt64(Request["s"]);
     if (rid > 0)
     {
         aqufitEntities entities = new aqufitEntities();
         Recipe r = entities.UserStreamSet.OfType<Recipe>().Include("RecipeExtendeds").Include("RecipeExtendeds.Image").FirstOrDefault(s => s.Id == rid && s.UserSetting.UserKey == this.UserId && s.UserSetting.PortalKey == this.PortalId);
         if (r == null)  // security exception
         {
             // TODO: send a notification email
         //    throw new Exception("Security Exception:  User does not own data.  Action has been logged");
         }
         Affine.Data.Image img = r.RecipeExtendeds.First().Image;
         entities.DeleteObject(img);
         entities.SaveChanges();
         litStatus.Text = "Image Removed.";
         RadAjaxManager1.ResponseScripts.Add(" $('#atiRecipeImg1Div').hide(); Aqufit.Page.atiUploadifyImg1.show();");
     }
 }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:19,代码来源:ViewATI_RecipeAdd.ascx.cs


示例14: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     Response.ContentType = "application/json";
     object json = new { Status = "Login Failed" };
     if (!string.IsNullOrWhiteSpace(Request.Form["u"]))
     {
         aqufitEntities entities = new aqufitEntities();
         string uname = Request.Form["u"];
         string password = Request.Form["p"];
         if (uname.Contains("@"))
         {   // this is an email login
             User user = entities.UserSettings.OfType<User>().FirstOrDefault(u => u.UserEmail == uname);
             if (user == null)
             {
                 json = new { Status = "Email ERROR" };
                 Response.Write(json);
                 Response.Flush();
                 Response.End();
                 return;
             }
             uname = user.UserName;
         }
         uname = uname.ToLower();
         DotNetNuke.Security.Membership.UserLoginStatus status = DotNetNuke.Security.Membership.UserLoginStatus.LOGIN_FAILURE;
         DotNetNuke.Entities.Portals.PortalController pc = new DotNetNuke.Entities.Portals.PortalController();
         DotNetNuke.Entities.Portals.PortalInfo pi = pc.GetPortal(0);
         UserInfo uinfo = UserController.UserLogin(0, uname, password, null, pi.PortalName, DotNetNuke.Services.Authentication.AuthenticationLoginBase.GetIPAddress(), ref status, true);
         if (status == DotNetNuke.Security.Membership.UserLoginStatus.LOGIN_SUCCESS || status == DotNetNuke.Security.Membership.UserLoginStatus.LOGIN_SUPERUSER)
         {
             UserSettings usersettings = entities.UserSettings.OfType<User>().FirstOrDefault(u => u.UserKey == uinfo.UserID && u.PortalKey == 0);
             if (!usersettings.Guid.HasValue)
             {   // we only add a UUID if there was none before.. this is so the "remember me" on the desktop site will still work.
                 usersettings.Guid = Guid.NewGuid();
                 entities.SaveChanges();
             }
             json = new { Status = "SUCCESS", Token = usersettings.Guid.ToString(), UserId = usersettings.Id, Username = usersettings.UserName };
         }
     }
     Response.Write(serializer.Serialize( json ));
     Response.Flush();
     Response.End();
 }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:42,代码来源:login.aspx.cs


示例15: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     try{
        // Response.ContentType = "application/json";
         if (!string.IsNullOrEmpty(Request["g"]))
         {
             aqufitEntities entities = new aqufitEntities();
             string gname = Request["g"];
             Group group = entities.UserSettings.OfType<Group>().FirstOrDefault(g => string.Compare(g.UserName, gname, true) == 0);
             Affine.Data.json.LeaderBoardWOD[] leaderBoard = dataMan.CalculatCrossFitLeaderBoard(group.Id);
             JavaScriptSerializer jserializer = new JavaScriptSerializer();
             string jsfile = System.IO.File.ReadAllText(Server.MapPath("~/DesktopModules/ATI_Base/resources/scripts/leaders.js"));
             Response.Write("var __ati_group = {Name:'"+group.UserFirstName+"', UserName:'"+group.UserName+"', Id:"+group.Id+"}; var __ati_json = '"+jserializer.Serialize(leaderBoard)+"';");
             Response.Write(jsfile);
         }
         else
         {
             Response.Write("{ERROR:'invalid request'}");
         }
     }catch(Exception){
         Response.Write("{ERROR:'exception in request'}");
     }
 }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:23,代码来源:LeaderBoard.aspx.cs


示例16: atiRadComboBoxSearchRoutes_ItemsRequested

        protected void atiRadComboBoxSearchRoutes_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            RadComboBox atiRadComboSearchWorkouts = (RadComboBox)sender;
            atiRadComboSearchWorkouts.Items.Clear();
            const int TAKE = 5;
            aqufitEntities entities = new aqufitEntities();
            int itemOffset = e.NumberOfItems;
            IQueryable<MapRoute> routes = entities.User2MapRouteFav.Where(r => r.UserSettingsKey == UserSettings.Id).Select(w => w.MapRoute);
            routes = routes.OrderBy(r => r.Name);
            int length = routes.Count();
            routes = string.IsNullOrEmpty(e.Text) ? routes.Skip(itemOffset).Take(TAKE) : routes.Where(r => r.Name.ToLower().StartsWith(e.Text)).Skip(itemOffset).Take(TAKE);

            MapRoute[] routeArray = routes.ToArray();

            foreach (MapRoute r in routeArray)
            {
                RadComboBoxItem item = new RadComboBoxItem(r.Name);
                item.Value = "" + r.Id;
                atiRadComboSearchWorkouts.Items.Add(item);
            }
            int endOffset = Math.Min(itemOffset + TAKE + 1, length);
            e.EndOfItems = endOffset == length;
            e.Message = (length <= 0) ? "No matches" : String.Format("Items <b>1</b>-<b>{0}</b> of {1}", endOffset, length);
        }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:24,代码来源:ViewATI_Routes.ascx.cs


示例17: RegisterGroup

        /*
        private long RegisterGroup(string name, string email, string address, string city, string url, string phone, double lat, double lng)
        {
            //3-933 Ellery Street, Victoria, BC V9A 4R9, Canada
            //1840 Gadsden Hwy # 112, Birmingham, AL
            string postal = string.Empty;
            string street = string.Empty;
            string region = string.Empty;
            string country = string.Empty;
            if (address != null)
            {
                string[] split = address.Split(',');
                if (split.Length > 0)
                {
                    street = split[0];
                }
                if (split.Length > 1)
                {
                    // city we have
                }
                if (split.Length > 2)
                {
                    region = split[2];
                }
            }
            // check required fields
            string uName = name.Replace(" ", "_").Replace("'", "");
            aqufitEntities entities = new aqufitEntities();
            Group test = entities.UserSettings.OfType<Group>().FirstOrDefault(g => g.UserName == uName);
                // if a user is found with that username, error. this prevents you from adding a username with the same name as a superuser.
           if (test != null)
           {
               throw new Exception("We already have an entry for the Group Name.");

           }
            Affine.WebService.RegisterService regService = new WebService.RegisterService();
            Group us = new Data.Group();
            us.UserKey = 0;
            us.PortalKey = PortalId;
            us.UserEmail = email;
            us.UserName = uName;
            us.UserFirstName = name;
            us.UserLastName = "";
            us.GroupType = entities.GroupTypes.FirstOrDefault(g => g.Id == 1);
            us.DefaultMapLat = lat;
            us.DefaultMapLng = lng;
            us.LngHome = lat;
            us.LngHome = lng;
            //us.Status = atTxtGroupDescription.Text;
            // TODO: don't make the Place required for groups..

            us.Places.Add(new Place()
            {
                City = city,
                Country = country,
                Email = email,
                Lat = lat,
                Lng = lng,
                Name = name,
                Postal = postal,
                Region = region,
                Street = street,
                Website = url,
                Phone = phone
            });
            entities.AddToUserSettings(us);
            entities.SaveChanges();
            // Now assign the creator of the group as an admin
            Group group = entities.UserSettings.OfType<Group>().First(g => g.UserName == us.UserName);
            return group.Id;

        }
        */
        protected void bAjaxPostback_Click(object sender, EventArgs e)
        {
            try
            {
                switch (hiddenAjaxAction.Value)
                {
                    case "su":
                        long uid = Convert.ToInt64(hiddenAjaxValue.Value);
                        aqufitEntities entities = new aqufitEntities();
                        User fbUser = entities.UserSettings.OfType<User>().FirstOrDefault(u => u.Id == uid);
                        UserController uc = new UserController();
                        UserInfo ui = uc.GetUser((int)fbUser.PortalKey, (int)fbUser.UserKey);
                        UserController.UserLogin(PortalId,ui,PortalSettings.PortalName, Request.UserHostAddress, true);
                        Response.Redirect(ResolveUrl("~"), true);
                        break;
                }
            }
            catch (Exception ex)
            {
                RadAjaxManager1.ResponseScripts.Add("Aqufit.Windows.ErrorDialog('" + ex.Message.Replace("'", "") + "'); ");
            }
        }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:95,代码来源:ViewATI_AdminTools.ascx.cs


示例18: Page_Load

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                base.Page_Load(sender, e);
                if (!Page.IsPostBack && !Page.IsCallback)
                {
                    if (ProfileSettings == null)
                    {
                        Response.Redirect(ResolveUrl( "~/" ), true);
                    }
                    ServiceReference service = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/StreamService.asmx");
                    service.InlineScript = true;
                    ScriptManager.GetCurrent(Page).Services.Add(service);
                    atiProfileImage.Settings = base.ProfileSettings;
                    atiProfileImage.IsOwner = base.Permissions == AqufitPermission.OWNER;
                    atiStreamScript.IsFollowMode = true;
                    atiStreamScript.DefaultTake = 10;
                    bEditProfile.HRef = ResolveUrl("~/Register.aspx");
                    litFriendsTitle.Text = "Chefs " + ProfileSettings.UserName + " follows";
                    atiWebLinksList.ProfileSettings = base.ProfileSettings;
                    if (Permissions == AqufitPermission.OWNER )
                    {
                        atiFollow.Visible = false;
                        atiWebLinksList.IsOwner = true;
                    }
                    else if (Permissions == AqufitPermission.PUBLIC)
                    {
                        string url = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.LoginTabId, "Login", new string[] { "returnUrl=/" + this.ProfileSettings.UserName });
                        atiFollow.OnClientClick = "self.location.href='" + url + "'; return false;";
                        atiFollow.Click -= atiFollow_Click;
                    }
                    else
                    {
                        atiFollow.Text = base.Following ? "Unfollow " : "Follow " + ProfileSettings.UserName;
                    }
                    aqufitEntities entities = new aqufitEntities();
                    IList<long> friendIds = entities.UserFriends.Where(f => (f.SrcUserSettingKey == this.ProfileSettings.Id) ).Select(f =>f.DestUserSettingKey).ToList();
                    UserSettings[] firendSettings = entities.UserSettings.Where(LinqUtils.BuildContainsExpression<UserSettings, long>(s => s.Id, friendIds)).Where( f => f.PortalKey == this.PortalId ).ToArray();
                    atiFriendsPhotos.RelationshipType = Affine.Relationship.FOLLOWING;
                    atiFriendsPhotos.FriendKeyList = firendSettings;
                    atiFriendsPhotos.User = base.ProfileSettings;
                    atiFriendsPhotos.FriendCount = friendIds.Count;

                    Metric numRecipes = ProfileSettings.Metrics.FirstOrDefault(m => m.MetricType == (int)Utils.MetricUtil.MetricType.NUM_RECIPES);
                    lNumCreations.Text = lNumCreations2.Text = ProfileSettings.UserName + "'s Creations (" + (numRecipes != null ? numRecipes.MetricValue : "0") + ")";
                    lNumFavorites.Text = lNumFavorites2.Text = "" + entities.User2StreamFavorites.Where(f => f.UserKey == ProfileSettings.UserKey && f.PortalKey == ProfileSettings.PortalKey).Count();
                    lUserName.Text = ProfileSettings.UserKey == this.UserId ? "you" : ProfileSettings.UserName;

                    atiStreamScript.EditUrl = ResolveUrl("~/AddRecipe.aspx");
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
开发者ID:huaminglee,项目名称:FlexFWD,代码行数:66,代码来源:ViewATI_RecipeProfile.ascx.cs


示例19: Page_Load

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# barycentricinterpolant类代码示例发布时间:2022-05-24
下一篇:
C# collections.AST类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap