Esempio n. 1
0
    private void CheckInsertEventTeamScore()
    {
        using (PortalDataContext pdc = new PortalDataContext())
        {
            List <int> teamIDList = new List <int>();
            teamIDList = (from t in pdc.Teams
                          where t.ActivityID == SynergyCurrentID &&
                          !(from ets in pdc.EventTeamScores
                            where ets.EventID == hdnEventID.Value.ToInt()
                            select ets.TeamID).Contains(t.TeamID)
                          select t.TeamID).ToList();

            foreach (int teamID in teamIDList)
            {
                EventTeamScore ets = new EventTeamScore()
                {
                    EventID = hdnEventID.Value.ToInt(),
                    TeamID  = teamID,
                    Rank    = 0,
                    Score   = 0
                };
                pdc.EventTeamScores.InsertOnSubmit(ets);
            }

            pdc.SubmitChanges();
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            hdnTeamID.Value = Request.QueryString["teamid"];
            trTeamCompositionEditor.Visible = clsSystemModule.HasAccess(clsSystemModule.ModuleSynergy, Request.Cookies["Speedo"]["Username"]);

            Team thread = new Team();
            using (PortalDataContext pdc = new PortalDataContext())
            {
                thread = (from t in pdc.Teams
                          where t.TeamID == hdnTeamID.Value.ToInt()
                          select t).SingleOrDefault();
            }
            txtTeamName.Text    = thread.Name;
            txtCaptain.Text     = thread.Captain;
            txtViceCaptain.Text = thread.ViceCaptain;


            this.BindTeamComposition();
            this.LoadTeamMembers();

            imgpnlavatar.ImageUrl = DALPortal.GetTeamLogo(hdnTeamID.Value.ToInt());
            btnBack.Attributes.Add("onclick", "history.back(); return false");
        }
    }
Esempio n. 3
0
    protected void dgCompetingTeams_ItemCommand(object source, DataGridCommandEventArgs e)
    {
        if (e.CommandName == "AddPlayer")
        {
            DropDownList pddlPlayers = (DropDownList)e.Item.FindControl("ddlPlayers");
            HiddenField  phdnTeamID  = (HiddenField)e.Item.FindControl("hdnTeamID");
            if (pddlPlayers.Items.Count > 0)
            {
                using (PortalDataContext pdc = new PortalDataContext())
                {
                    EventGameTeamPlayer egtp = new EventGameTeamPlayer()
                    {
                        GameID   = hdnGameID.Value.ToInt(),
                        TeamID   = phdnTeamID.Value.ToInt(),
                        Username = pddlPlayers.SelectedValue
                    };

                    pdc.EventGameTeamPlayers.InsertOnSubmit(egtp);

                    pdc.SubmitChanges();
                }

                this.LoadCompetingTeams();
            }
        }
    }
Esempio n. 4
0
    public static string GetJoinedEvents(string username, int activityID)
    {
        string joinedEvents = "";


        using (PortalDataContext pdc = new PortalDataContext())
        {
            var qEventList = (from ev in pdc.Events
                              where ev.ActivityID == activityID &&
                              (from eg in pdc.EventGames
                               where (from egtp in pdc.EventGameTeamPlayers
                                      where egtp.Username == username
                                      select egtp.GameID).Contains(eg.GameID)
                               select eg.EventID).Distinct().Contains(ev.EventID)
                              orderby ev.Name
                              select ev.Name).Distinct().ToList();

            foreach (string s in qEventList)
            {
                joinedEvents += (joinedEvents.Length > 0 ? ", " : "") + s;
            }
        }

        return(joinedEvents);
    }
    private void InitializeFields()
    {
        using (PortalDataContext pdc = new PortalDataContext())
        {
            var qActivity = (from a in pdc.Activities
                             orderby a.ActivityID descending
                             select new
            {
                ActivityID = a.ActivityID,
                Name = a.Name
            }).ToList();
            ddlActivity.DataSource     = qActivity;
            ddlActivity.DataValueField = "ActivityID";
            ddlActivity.DataTextField  = "Name";
            ddlActivity.DataBind();
        }

        using (ThreadDataContext tdc = new ThreadDataContext())
        {
            var q = (from em in tdc.Employees
                     where em.pstatus == '1'
                     orderby em.lastname
                     select new
            {
                Usename = em.username,
                Name = em.lastname + ", " + em.nickname
            }).ToList();
            ddlTeamMember.DataSource     = q;
            ddlTeamMember.DataValueField = "Usename";
            ddlTeamMember.DataTextField  = "Name";
            ddlTeamMember.DataBind();
        }

        this.LoadAchievements();
    }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            using (PortalDataContext pdc = new PortalDataContext())
            {
                var qDivision = (from ed in pdc.EventDivisions
                                 orderby ed.Name
                                 select new { DivisionID = ed.EventDivisionID, Name = ed.Name }).ToList();

                ddlDivision.DataSource     = qDivision;
                ddlDivision.DataValueField = "DivisionID";
                ddlDivision.DataTextField  = "Name";
                ddlDivision.DataBind();

                var qCategory = (from ec in pdc.EventCategories
                                 orderby ec.Name
                                 select new { CategoryID = ec.EventCategoryID, Name = ec.Name }).ToList();

                ddlCategory.DataSource     = qCategory;
                ddlCategory.DataValueField = "CategoryID";
                ddlCategory.DataTextField  = "Name";
                ddlCategory.DataBind();

                ddlWinner.DataSource     = DALPortal.DSLTeamNA();
                ddlWinner.DataValueField = "TeamID";
                ddlWinner.DataTextField  = "TeamName";
                ddlWinner.DataBind();
            }
        }
    }
Esempio n. 7
0
        public static AuthUserLoginResponse DoLogin(String Login, String Password, HttpSessionState Session, bool RememberMe)
        {
            bool passwordMatch           = false;
            AuthUserLoginResponse retVal = new AuthUserLoginResponse();

            AuthUser au = new AuthUser();

            CheckBCryptVersion cbv = new CheckBCryptVersion();

            using (PortalDataContext db = new PortalDataContext())
            {
                User u = null;

                try
                {
                    u             = db.Users.Where(x => x.UserName == Login).SingleOrDefault();
                    passwordMatch = BCrypt.Net.BCrypt.Verify(Password, u.Password);
                }
                catch
                {
                    retVal.ErrorText = "Username not found";
                }

                if (u != null && passwordMatch)
                {
                    au.UserType = AuthUserUserType.None;
                    try
                    {
                        au.UserType         = (AuthUser.AuthUserUserType)Enum.Parse(typeof(AuthUser.AuthUserUserType), u.UserAccessLevel.ToString());
                        Session["UserType"] = au.UserType;
                        Session["UserID"]   = u.UserID;
                        au.DisplayName      = u.UserFirstName;
                    }
                    catch
                    {
                    }
                }
                else
                {
                    au = null;
                }
            }

            if (au != null)
            {
                if (Session != null)
                {
                    Session["AuthUser"] = au;
                    Session["UserName"] = au.DisplayName;
                    retVal.IsSuccess    = true;
                }
            }
            else
            {
                retVal.IsSuccess  = false;
                retVal.ErrorText += "Incorrect Login, Please try again";
            }

            return(retVal);
        }
Esempio n. 8
0
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        if (this.IsCorrectEntries())
        {
            using (PortalDataContext pdc = new PortalDataContext())
            {
                EventGame eg = new EventGame()
                {
                    EventID      = hdnEventID.Value.ToInt(),
                    GamePhase    = ddlGamePhase.SelectedValue.ToChar(),
                    StartDate    = clsValidator.CheckDate(txtStartYear.Text.ToInt(), ddlStartMonth.SelectedValue.ToInt(), ddlStartDay.SelectedValue.ToInt(), ddlStartHour.SelectedValue.ToInt(), ddlStartMinute.SelectedValue.ToInt(), ddlStartTimePeriod.SelectedValue),
                    EndDate      = clsValidator.CheckDate(txtEndYear.Text.ToInt(), ddlEndMonth.SelectedValue.ToInt(), ddlEndDay.SelectedValue.ToInt(), ddlEndHour.SelectedValue.ToInt(), ddlEndMinute.SelectedValue.ToInt(), ddlEndTimePeriod.SelectedValue),
                    Location     = txtLocation.Text,
                    WinnerTeamID = ddlWinner.SelectedValue.ToInt(),
                    IsFinished   = chkFinished.Checked,
                    IsActive     = true,
                    CreatedBy    = Request.Cookies["Speedo"]["UserName"],
                    DateCreated  = DateTime.Now
                };

                pdc.EventGames.InsertOnSubmit(eg);
                pdc.SubmitChanges();
            }
            Response.Redirect("EventDetails.aspx?eventid=" + Request.QueryString["eventid"]);
        }
    }
Esempio n. 9
0
    private void LoadOfficials()
    {
        bool blnHasAccess = clsSystemModule.HasAccess(clsSystemModule.ModuleSynergy, Request.Cookies["Speedo"]["Username"]);

        List <EventGameOfficial> officialList = new List <EventGameOfficial>();

        using (PortalDataContext pdc = new PortalDataContext())
        {
            officialList = (from ego in pdc.EventGameOfficials
                            where ego.GameID == hdnGameID.Value.ToInt()
                            orderby ego.OfficialID
                            select ego).ToList();
        }

        dgOfficials.DataSource = officialList;
        dgOfficials.DataBind();
        dgOfficials.Columns[1].Visible = blnHasAccess;

        if (dgOfficials.Items.Count > 0)
        {
            divOfficials.Visible  = true;
            lblNoOfficial.Visible = false;
        }
        else
        {
            divOfficials.Visible  = false;
            lblNoOfficial.Visible = true;
        }

        if (blnHasAccess)
        {
            trOfficialsAdd.Visible = true;

            List <Committee> committeeList = new List <Committee>();
            using (PortalDataContext pdc = new PortalDataContext())
            {
                committeeList = (from c in pdc.Committees
                                 where c.ActivityID == SynergyCurrentID &&
                                 !(from ego in pdc.EventGameOfficials
                                   where ego.GameID == hdnGameID.Value.ToInt()
                                   select ego.OfficialID).Contains(c.Username)
                                 orderby c.Username
                                 select c).ToList();
            }
            ddlCommittee.DataSource     = committeeList;
            ddlCommittee.DataValueField = "Username";
            ddlCommittee.DataTextField  = "Username";
            ddlCommittee.DataBind();
        }
        else
        {
            trOfficialsAdd.Visible = false;
        }
    }
Esempio n. 10
0
    protected void dgAchievements_DeleteCommand(object source, DataGridCommandEventArgs e)
    {
        using (PortalDataContext pdc = new PortalDataContext())
        {
            Achievement achievement = (from a in pdc.Achievements
                                       where a.AchievementID == e.Item.Cells[0].Text.ToInt()
                                       select a).SingleOrDefault();

            pdc.Achievements.DeleteOnSubmit(achievement);
            pdc.SubmitChanges();
        }
        this.LoadAchievements();
    }
Esempio n. 11
0
    public static string GetEventDivisionName(int eventDivisionID)
    {
        string eventDivisionName = "";

        using (PortalDataContext pdc = new PortalDataContext())
        {
            eventDivisionName = (from ed in pdc.EventDivisions
                                 where ed.EventDivisionID == eventDivisionID
                                 select ed.Name).SingleOrDefault();
        }

        return(eventDivisionName);
    }
Esempio n. 12
0
    public static string GetEventName(int eventID)
    {
        string eventName = "";

        using (PortalDataContext pdc = new PortalDataContext())
        {
            eventName = (from ev in pdc.Events
                         where ev.EventID == eventID
                         select ev.Name).SingleOrDefault();
        }

        return(eventName);
    }
Esempio n. 13
0
    public static string GetTeamName(int teamID)
    {
        string teamname = "";

        using (PortalDataContext pdc = new PortalDataContext())
        {
            teamname = (from t in pdc.Teams
                        where t.TeamID == teamID
                        select t.Name).SingleOrDefault();
        }

        return(teamname);
    }
Esempio n. 14
0
 public static void LogError(string username, string className, string method, string details)
 {
     using (PortalDataContext pdc = new PortalDataContext())
     {
         try
         {
             pdc.InsertErrorLog(username, className, method, details);
         }
         catch
         {
             // *gulp*
         }
     }
 }
Esempio n. 15
0
    public static DateTime GetLatestGameDate()
    {
        DateTime latestDate;

        using (PortalDataContext pdc = new PortalDataContext())
        {
            latestDate = (from eg in pdc.EventGames
                          where eg.StartDate >= DateTime.Now.Date
                          orderby eg.StartDate
                          select eg.StartDate).FirstOrDefault();
        }

        return(latestDate);
    }
Esempio n. 16
0
    public static int CountTotalDraw(int teamID, int eventID)
    {
        int totalDraw = 0;

        using (PortalDataContext pdc = new PortalDataContext())
        {
            totalDraw = (from eg in pdc.EventGames
                         where eg.WinnerTeamID == 0 && eg.IsFinished == true && eg.EventID == eventID &&
                         (from egt in pdc.EventGameTeams
                          where egt.TeamID == teamID
                          select egt.GameID).Contains(eg.GameID)
                         select eg).Count();
        }

        return(totalDraw);
    }
Esempio n. 17
0
    public static int GetScore(int teamID, int eventID)
    {
        int score = 0;

        using (PortalDataContext pdc = new PortalDataContext())
        {
            score = (from egt in pdc.EventGameTeams
                     where egt.TeamID == teamID &&
                     (from eg in pdc.EventGames
                      where eg.EventID == eventID
                      select eg.GameID).Contains(egt.GameID)
                     select egt.Score).Sum().ToString().ToInt();
        }

        return(score);
    }
Esempio n. 18
0
    public static int CountTotalGames(int teamID, int eventID)
    {
        int totalGames = 0;

        using (PortalDataContext pdc = new PortalDataContext())
        {
            totalGames = (from egt in pdc.EventGameTeams
                          where egt.TeamID == teamID &&
                          (from eg in pdc.EventGames
                           where eg.EventID == eventID
                           select eg.GameID).Contains(egt.GameID)
                          select egt).Count();
        }

        return(totalGames);
    }
Esempio n. 19
0
    protected void LoadLatesActiveEvent()
    {
        string   strWrite       = "";
        int      intCountEvents = 0;
        DateTime latestDate     = DALPortal.GetLatestGameDate();

        if (latestDate != DateTime.MinValue)
        {
            DateTime latestDateStart = clsDateTime.ChangeTimeToStart(latestDate);
            DateTime latestDateEnd   = clsDateTime.ChangeTimeToEnd(latestDate);

            List <EventGame> eventGamesList = new List <EventGame>();

            using (PortalDataContext pdc = new PortalDataContext())
            {
                eventGamesList = (from eg in pdc.EventGames
                                  where eg.IsActive == true && eg.StartDate >= latestDateStart && eg.IsFinished == false && eg.EventID == GetActiveEvent().ToInt()
                                  orderby eg.StartDate
                                  select eg).ToList();
            }

            foreach (EventGame eg in eventGamesList)
            {
                strWrite += "<table>" +
                            "<tr>" +
                            "<td>" +
                            "<img src='../Support/play16red.png' alt='' />" +
                            "</td>" +
                            "<td style='font-size: 18pt; font-family: Arial; font-weight: bold'>" +
                            eg.StartDate.ToString("MMM dd, yyyy") +
                            "</td>" +
                            "</tr>" +
                            "<tr>" +
                            "<td>&nbsp;</td>" +
                            "<td>" +
                            DALPortal.GetGamePhaseName(eg.GamePhase.ToString()) + "<br/>(" + eg.StartDate.ToString("hh:mm tt") + ", " + eg.Location + ")" +
                            "<br/>" +
                            this.LoadLatestScheduleTeams1(eg.GameID, eg.EventID) +
                            " </td>" +
                            "<tr>" +
                            "</table>";
                break;
            }
        }

        litLatestEvent.Text = strWrite;
    }
Esempio n. 20
0
    protected void LoadLatestSchedule()
    {
        string   strWrite       = "";
        int      intCountEvents = 0;
        int      intCount       = 0;
        DateTime latestDate     = DALPortal.GetLatestGameDate();

        if (latestDate != DateTime.MinValue)
        {
            DateTime latestDateStart = clsDateTime.ChangeTimeToStart(latestDate);
            DateTime latestDateEnd   = clsDateTime.ChangeTimeToEnd(latestDate);

            List <EventGame> eventGamesList = new List <EventGame>();

            using (PortalDataContext pdc = new PortalDataContext())
            {
                eventGamesList = (from eg in pdc.EventGames
                                  where eg.IsActive == true && eg.StartDate >= latestDateStart && eg.IsFinished == false
                                  orderby eg.StartDate
                                  select eg).ToList();
            }
            intCount = eventGamesList.Count;
            foreach (EventGame eg in eventGamesList)
            {
                if (intCountEvents > 4)
                {
                    break;
                }
                strWrite += "<div class='GridBorder' style='text-align:center;border-color: #FFFFFF; font-size: 11px; line-height:5px'>" +
                            "<table style='width:100%;border-color: #FFFFFF;'>" +
                            "<tr><td style='border-color: #FFFFFF;'><b><a href='" + clsSystemConfigurations.PortalRootURL + "/Synergy/EventDetails.aspx?eventid=" + eg.EventID.ToString() + "'>" + DALPortal.GetEventName(eg.EventID) + "</a></b></td></tr>" +
                            "<tr><td style='border-color: #FFFFFF;'>" + DALPortal.GetGamePhaseName(eg.GamePhase.ToString()) + "</td></tr>" +
                            this.LoadLatestScheduleTeams(eg.GameID, eg.EventID) +
                            "<tr><td style='color:Black;border-color: #FFFFFF;'>" + eg.StartDate.ToString("hh:mm tt ddd, MMM dd") + "</td></tr>" +
                            "<tr><td style='color:Black;border-color: #FFFFFF;'>@ " + eg.Location + "</td></tr>" +
                            "</table><hr/>" +
                            "</div>";
                intCountEvents++;
            }
        }

        if (intCount > 0)
        {
            masterlitLatestSchedule.Text = "<div class='' ><div class='' style='font-weight:bold'>Game Schedule</div><div class='masterpanelspace'></div>" + strWrite + "</div>";
        }
    }
Esempio n. 21
0
    protected void LoadLatestSchedule()
    {
        string   strWrite       = "";
        int      intCountEvents = 0;
        DateTime latestDate     = DALPortal.GetLatestGameDate();

        if (latestDate != DateTime.MinValue)
        {
            DateTime latestDateStart = clsDateTime.ChangeTimeToStart(latestDate);
            DateTime latestDateEnd   = clsDateTime.ChangeTimeToEnd(latestDate);

            List <EventGame> eventGamesList = new List <EventGame>();
            using (PortalDataContext pdc = new PortalDataContext())
            {
                eventGamesList = (from eg in pdc.EventGames
                                  where eg.IsActive == true && eg.StartDate >= latestDateStart && eg.IsFinished == false
                                  orderby eg.StartDate
                                  select eg).ToList();
            }

            foreach (EventGame eg in eventGamesList)
            {
                if (intCountEvents > 4)
                {
                    break;
                }
                strWrite += "<tr>" +
                            "<td colspan='3' style='border-color: #FFFFFF;'>" +
                            "<b>Event:</b> " + DALPortal.GetEventName(eg.EventID) + "<br />" +
                            "<b>Teams:</b> " + this.LoadLatestScheduleTeams(eg.GameID, eg.EventID) + " <br />" +
                            "<b>Date:</b> " + eg.StartDate.ToString("MMM dd, yyyy") + "<br />" +
                            "<b>Time:</b> " + eg.StartDate.ToString("hh:mm tt") + "<br />" +
                            "<b>Location:</b> " + eg.Location + "<br />" +
                            "</td>" +
                            "</tr>" +
                            "<tr>" +
                            "<td style='height: 5px;' colspan='3'>" +
                            "</td>" +
                            "</tr><br/>";

                intCountEvents++;
            }
        }
        litEcheduledEvents.Text = strWrite;
    }
Esempio n. 22
0
 private void LoadAchievements()
 {
     using (PortalDataContext pdc = new PortalDataContext())
     {
         var q = (from ea in pdc.Achievements
                  where ea.Username == ddlTeamMember.SelectedValue
                  join a in pdc.Activities on ea.ActivityID equals a.ActivityID
                  orderby a.ActivityID descending, ea.Award
                  select new
         {
             AchievementID = ea.AchievementID,
             ActivityName = a.Name,
             Awards = ea.Award
         }).ToList();
         dgAchievements.DataSource = q;
         dgAchievements.DataBind();
     }
 }
Esempio n. 23
0
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        Event ev = new Event()
        {
            Name            = txtEventName.Text,
            ActivityID      = SynergyCurrentID,
            EventDivisionID = ddlDivision.SelectedValue.ToInt(),
            EventCategoryID = ddlCategory.SelectedValue.ToInt(),
            MaxPoint        = txtMaxPoints.Text.ToInt(),
            WinnerTeamID    = ddlWinner.SelectedValue.ToInt(),
            SortOrder       = txtOrder.Text.ToInt(),
            IsActive        = true,
            ScoringTypeID   = 1,
            CreatedBy       = Request.Cookies["Speedo"]["UserName"].ToString(),
            DateCreated     = DateTime.Now
        };

        using (PortalDataContext pdc = new PortalDataContext())
        {
            pdc.Events.InsertOnSubmit(ev);
            pdc.SubmitChanges();

            List <int> teamIDList = new List <int>();
            teamIDList = (from t in pdc.Teams
                          where t.ActivityID == SynergyCurrentID
                          select t.TeamID).ToList();

            foreach (int teamID in teamIDList)
            {
                EventTeamScore ets = new EventTeamScore()
                {
                    EventID = ev.EventID,
                    TeamID  = teamID,
                    Rank    = 0,
                    Score   = 0
                };
                pdc.EventTeamScores.InsertOnSubmit(ets);
            }

            pdc.SubmitChanges();
        }

        Response.Redirect("EventMenu.aspx");
    }
Esempio n. 24
0
        public static IEnumerable<Plan> byCategory(string categoryCode)
        {
            PortalDataContext portaldb = new PortalDataContext(ACommerce.BO.Comun.GetConnString());

            //Selecciona todos los planes haciendo join con portalbycategory
            List<Plan> planList = (from pp in portaldb.vw_PortalPlanByCategories
                                   join c in portaldb.PortalCategories
                                     on pp.IDCategory equals c.IDCategory
                                   join p in portaldb.Planes
                                     on pp.IDPlan equals p.IDPlan
                                   where c.CatCode.ToLower() == categoryCode.ToLower()
                                   select new Plan(p.IDPlan, p.PlanDescription, p.Codigo,
                                       (from ps in portaldb.vw_PlanSpecs
                                        where ps.IDPlan == pp.IDPlan
                                        select new ParCaracteristicas(ps.Especificacion, ps.Plan_Value)).ToList()))
                                                    .ToList();

            return planList;
        }
Esempio n. 25
0
    protected void btnAddCommittee_Click(object sender, ImageClickEventArgs e)
    {
        if (ddlCommittee.Items.Count > 0)
        {
            using (PortalDataContext pdc = new PortalDataContext())
            {
                EventGameOfficial ego = new EventGameOfficial()
                {
                    GameID     = hdnGameID.Value.ToInt(),
                    OfficialID = ddlCommittee.SelectedValue
                };

                pdc.EventGameOfficials.InsertOnSubmit(ego);

                pdc.SubmitChanges();
            }
            this.LoadOfficials();
        }
    }
Esempio n. 26
0
        public static IEnumerable<Plan> all()
        {
            PortalDataContext portaldb = new PortalDataContext(ACommerce.BO.Comun.GetConnString());

            // Selecciona todos los planes activos y luego selecciona todas las caracteristicas
            //de cada uno de estos planes y las inserta en un diccionario, que luego usa para crear una lista de planes

            List<Plan> planList = (from p in portaldb.Planes
                                      where p.IsDeleted == '0'
                                      select new Plan(p.IDPlan, p.PlanDescription, p.Codigo,
                                            (from c in portaldb.PlanSpecs
                                             join nv in portaldb.NameValues
                                             on c.nvPlan_Spec equals nv.IDNameValue
                                             where c.IDPlan == p.IDPlan
                                             select new ParCaracteristicas( nv.Descripcion, c.Value ))
                                     .ToList()))
                                     .ToList();

            return planList;
        }
Esempio n. 27
0
    private string LoadLatestScheduleTeams1(int gameID, int eventID)
    {
        string strReturn = "";

        List <EventGameTeam> eventGameTeamList = new List <EventGameTeam>();

        using (PortalDataContext pdc = new PortalDataContext())
        {
            eventGameTeamList = (from egt in pdc.EventGameTeams
                                 where egt.GameID == gameID
                                 orderby egt.Rank.Value
                                 select egt).ToList();
        }

        foreach (EventGameTeam egt in eventGameTeamList)
        {
            strReturn += (strReturn == "" ? "" : "<br/>Vs.<br/>") + DALPortal.GetTeamName(egt.TeamID);
        }
        return(strReturn);
    }
Esempio n. 28
0
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        using (PortalDataContext pdc = new PortalDataContext())
        {
            Achievement achievement = new Achievement()
            {
                ActivityID  = ddlActivity.SelectedValue.ToInt(),
                Username    = ddlTeamMember.SelectedValue,
                Award       = txtAchievement.Text,
                CreatedBy   = Request.Cookies["Speedo"]["Username"],
                DateCreated = DateTime.Now
            };

            pdc.Achievements.InsertOnSubmit(achievement);

            pdc.SubmitChanges();
        }
        txtAchievement.Text = "";
        this.LoadAchievements();
    }
Esempio n. 29
0
    public static string GetStanding(int teamID, int eventID)
    {
        string standing    = "";
        int    scoringType = 0;

        using (PortalDataContext pdc = new PortalDataContext())
        {
            scoringType = (from ev in pdc.Events
                           where ev.EventID == eventID
                           select ev.ScoringTypeID).SingleOrDefault();
        }
        if (scoringType == 1)
        {
            standing = "(" + DALPortal.CountTotalWon(teamID, eventID).ToString() + "-" + DALPortal.CountTotalDraw(teamID, eventID).ToString() + "-" + DALPortal.CountTotalLost(teamID, eventID).ToString() + ")";
        }
        else if (scoringType == 2)
        {
            standing = "(" + DALPortal.GetScore(teamID, eventID).ToString() + ")";
        }
        return(standing);
    }
Esempio n. 30
0
    private string LoadLatestScheduleTeams(int gameID, int eventID)
    {
        string strReturn = "";

        List <EventGameTeam> eventGameTeamList = new List <EventGameTeam>();

        using (PortalDataContext pdc = new PortalDataContext())
        {
            eventGameTeamList = (from egt in pdc.EventGameTeams
                                 where egt.GameID == gameID
                                 orderby egt.Rank.Value
                                 select egt).ToList();
        }

        foreach (EventGameTeam egt in eventGameTeamList)
        {
            strReturn += (strReturn == "" ? "" : "<tr><td  style='color:Red;border-color: #FFFFFF;'>&nbsp;<b>Versus&nbsp;</b></td></tr>") +
                         "<tr><td style='border-color: #FFFFFF;font-size:15px; line-height:15px'><b><a href='../Synergy/TeamDetails.aspx?teamid=" + egt.TeamID + "'>" + DALPortal.GetTeamName(egt.TeamID) + "</a></b></td></tr>";
        }
        return("<tr><td style='border-color: #FFFFFF;'><table align='center' style='border-color: #FFFFFF;'>" + strReturn + "</table></td></tr>");
    }
Esempio n. 31
0
    public static string GetAchievements(string username)
    {
        string achivementList = "";


        using (PortalDataContext pdc = new PortalDataContext())
        {
            List <string> qEventList = (from ea in pdc.Achievements
                                        where ea.Username == username
                                        join a in pdc.Activities on ea.ActivityID equals a.ActivityID
                                        orderby ea.ActivityID descending, ea.Award
                                        select ea.Award + " (" + a.Name + ")").ToList();

            foreach (string s in qEventList)
            {
                achivementList += (achivementList.Length > 0 ? "<br>" : "") + s;
            }
        }

        return(achivementList);
    }
Esempio n. 32
0
    protected void btnAddTeam_Click(object sender, ImageClickEventArgs e)
    {
        if (ddlTeams.Items.Count > 0)
        {
            using (PortalDataContext pdc = new PortalDataContext())
            {
                EventGameTeam egt = new EventGameTeam()
                {
                    GameID = hdnGameID.Value.ToInt(),
                    TeamID = ddlTeams.SelectedValue.ToInt(),
                    Rank   = 0,
                    Score  = 0
                };

                pdc.EventGameTeams.InsertOnSubmit(egt);

                pdc.SubmitChanges();
            }
            this.LoadCompetingTeams();
        }
    }
Esempio n. 33
0
        public static IEnumerable<Plan> byEquipo(string equipoCode)
        {
            PortalDataContext portaldb = new PortalDataContext(ACommerce.BO.Comun.GetConnString());

            //Selecciona todos los planes haciendo join con portalbycategory
            List<Plan> planList = (from pe in portaldb.vw_Producto_Plans
                                   join p in portaldb.Productos
                                   on pe.IDProduct equals p.IDProduct
                                   where p.Codigo == equipoCode
                                   && pe.Estatus_Produto == "Activo"
                                   && pe.Estatus_Plan == "Activo"
                                   && pe.LineType == "S"
                                   select new Plan(pe.IDPlan, pe.Nombre_Plan, pe.CodigoPlan,
                                       (from ps in portaldb.vw_PlanSpecs
                                        where ps.IDPlan == pe.IDPlan
                                        select new ParCaracteristicas(ps.Especificacion, ps.Plan_Value)).ToList()
                                       ))
                                       .ToList();

            return planList;
        }
Esempio n. 34
0
        public static IEnumerable<Equipo> all()
        {
            PortalDataContext portaldb = new PortalDataContext(ACommerce.BO.Comun.GetConnString());
            SecurityDataContext secdb = new SecurityDataContext(ACommerce.BO.Comun.GetConnString());

            string parametro = secdb.Parametros.Where(p => p.Codigo.Equals("URL_head")).FirstOrDefault().Valor.ToString();

            // Selecciona todos los planes activos y luego selecciona todas las caracteristicas
            //de cada uno de estos planes y las inserta en un diccionario, que luego usa para crear una lista de planes

            List<Equipo> equiposList = (from p in portaldb.Productos
                                        join nv in portaldb.NameValues
                                        on p.nvManufacturer equals nv.IDNameValue
                                        where p.IsDeleted == '0'
                                        && p.nvTipo_Producto == 52
                                        select new Equipo(p.IDProduct, p.ProductName, p.Codigo, p.ProductDescription,
                                                        p.IDPhotoDefault.HasValue ? parametro + "/Lib/Images.aspx?ID=" + p.IDPhotoDefault : "", nv.Descripcion, p.ProductPrice1, p.ProductPrice2,
                                                        p.ProductStock, (from pr in portaldb.ProductReviews
                                                                         where pr.IDProduct == p.IDProduct
                                                                         select pr.Score).FirstOrDefault(),
                                         (from ps in portaldb.vw_ProductSpecs
                                          where ps.IDProduct == p.IDProduct
                                          select new ParCaracteristicas(ps.Especificacion, ps.Value)).ToList()
                                         , parametro + "Master/Claro/Secciones/ShowProductMovil.aspx?ID=" + p.IDProduct)
                                     )
                                     .ToList();

            return equiposList;
        }
Esempio n. 35
0
        public static IEnumerable<Equipo> byPlan(string planCode)
        {
            PortalDataContext portaldb = new PortalDataContext(ACommerce.BO.Comun.GetConnString());
            SecurityDataContext secdb = new SecurityDataContext(ACommerce.BO.Comun.GetConnString());
            TiendaDataContext tiendadb = new TiendaDataContext(ACommerce.BO.Comun.GetConnString());

            // From i In tiendadb.ProductReviews Where i.IDProduct = _idProduct Select i.Score
            string parametro = secdb.Parametros.Where(p => p.Codigo.Equals("URL_head")).FirstOrDefault().Valor.ToString();

            //Selecciona todos los planes haciendo join con portalbycategory
            List<Equipo> equiposList = (from pe in portaldb.vw_Producto_Plans
                                     join p in portaldb.Productos
                                     on pe.IDProduct equals p.IDProduct
                                     where pe.CodigoPlan == planCode
                                     && pe.Estatus_Produto == "Activo"
                                     && pe.Estatus_Plan == "Activo"
                                     && pe.LineType == "S"
                                     select new Equipo(p.IDProduct, pe.Nombre_Producto, p.Codigo, HtmlRemoval.StripTagsCharArray(p.ProductDescription),
                                         p.IDPhotoDefault.HasValue ? parametro + "/Lib/Images.aspx?ID=" + p.IDPhotoDefault + "&thum=1": "",
                                         (from nv in portaldb.NameValues
                                          where nv.IDNameValue == p.nvManufacturer
                                          select nv.Descripcion).FirstOrDefault().ToString(),
                                         p.ProductPrice1, p.ProductPrice2, p.ProductStock, (from pr in portaldb.ProductReviews
                                                                                            where pr.IDProduct == p.IDProduct
                                                                                            select pr.Score).FirstOrDefault(),
                                         (from ps in portaldb.vw_ProductSpecs
                                          where ps.IDProduct == p.IDProduct
                                          select new ParCaracteristicas(ps.Especificacion, ps.Value)).ToList()
                                         , parametro + "Master/Claro/Secciones/ShowProductMovil.aspx?ID=" + p.IDProduct))
                                       .ToList();

            return equiposList;
        }
Esempio n. 36
0
        public static IEnumerable<Equipo> byCategory(string categoryCode)
        {
            PortalDataContext portaldb = new PortalDataContext(ACommerce.BO.Comun.GetConnString());
            SecurityDataContext secdb = new SecurityDataContext(ACommerce.BO.Comun.GetConnString());

            string parametro = secdb.Parametros.Where(p => p.Codigo.Equals("URL_head")).FirstOrDefault().Valor.ToString();

            //Selecciona todos los planes haciendo join con portalbycategory
            List<Equipo> equiposList = (from pp in portaldb.vw_PortalProductByCategories
                                   join c in portaldb.PortalCategories
                                     on pp.IDCategory equals c.IDCategory
                                    join p in portaldb.Productos
                                    on pp.IDProduct equals p.IDRecurso
                                        join nv in portaldb.NameValues
                                            on p.nvManufacturer equals nv.IDNameValue
                                   where c.CatCode.ToLower() == categoryCode.ToLower()
                                   select new Equipo(p.IDProduct, p.ProductName, p.Codigo, p.ProductDescription,
                                                        p.IDPhotoDefault.HasValue ? parametro + "/Lib/Images.aspx?ID=" + p.IDPhotoDefault : "", nv.Descripcion, p.ProductPrice1, p.ProductPrice2,
                                                        p.ProductStock, (from pr in portaldb.ProductReviews
                                                                         where pr.IDProduct == p.IDProduct
                                                                         select pr.Score).FirstOrDefault(),
                                         (from ps in portaldb.vw_ProductSpecs
                                          where ps.IDProduct == p.IDProduct
                                          select new ParCaracteristicas(ps.Especificacion, ps.Value)).ToList()
                                         , parametro + "Master/Claro/Secciones/ShowProductMovil.aspx?ID=" + p.IDProduct))
                                                    .ToList();

            return equiposList;
        }
Esempio n. 37
0
        public static IEnumerable<Equipo> compare(string[] equiposCodes)
        {
            PortalDataContext portaldb = new PortalDataContext(ACommerce.BO.Comun.GetConnString());
            SecurityDataContext secdb = new SecurityDataContext(ACommerce.BO.Comun.GetConnString());
            TiendaDataContext tiendadb = new TiendaDataContext(ACommerce.BO.Comun.GetConnString());
            // From i In tiendadb.ProductReviews Where i.IDProduct = _idProduct Select i.Score
            string parametro = secdb.Parametros.Where(p => p.Codigo.Equals("URL_head")).FirstOrDefault().Valor.ToString();

            //ACommerce.BO.usp_GetProductByCategory3Result source =  tiendadb.usp_GetProductByCategory3(-1, "", -1, -1, -1);

            //decimal Precio = Math.Round(source.Productprice1 ?? 0, 0, MidpointRounding.AwayFromZero);
            //decimal PrecioAnterior = source.Productprice1ant == null ? 0 : Math.Round(source.Productprice1ant ?? 0, 0, MidpointRounding.AwayFromZero);
            //decimal PrecioPre = Math.Round(source.ProductpricePREP, 0, MidpointRounding.AwayFromZero);
            //decimal PrecioAnteriorPre = source.ProductpricePREPant == null ? 0: Math.Round(source.ProductpricePREPant, 0, MidpointRounding.AwayFromZero);

            //Selecciona todos los planes haciendo join con portalbycategory
            List<Equipo> equiposList = (from p in portaldb.vw_Productos
                                        join nv in portaldb.NameValues
                                        on p.nvManufacturer equals nv.IDNameValue
                                        where equiposCodes.Contains(p.Codigo)
                                        && p.nvTipo_Producto == 52
                                        select new Equipo(p.IDProduct, p.Producto, p.Codigo, HtmlRemoval.StripTagsCharArray(p.Descripcion),
                                            p.IDPhotoDefault.HasValue ? parametro + "/Lib/Images.aspx?ID=" + p.IDPhotoDefault + "&thum=1" : "",
                                            nv.Descripcion, p.ProductPrice1, p.ProductPrice2, p.ProductStock,
                                                (from pr in portaldb.ProductReviews
                                                where pr.IDProduct == p.IDProduct
                                                select pr.Score).FirstOrDefault(),
                                            (from ps in portaldb.vw_ProductSpecs
                                             where ps.IDProduct == p.IDProduct
                                             select new ParCaracteristicas(ps.Especificacion, ps.Value)).ToList()
                                            , parametro + "Master/Claro/Secciones/ShowProductMovil.aspx?ID=" + p.IDProduct))
                                       .ToList();

            return equiposList;
        }