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(); } }
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"); } }
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(); } } }
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(); }
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(); } } }
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); }
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"]); } }
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; } }
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(); }
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); }
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); }
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); }
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* } } }
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); }
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); }
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); }
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); }
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> </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; }
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>"; } }
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; }
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(); } }
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"); }
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; }
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(); } }
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; }
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); }
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(); }
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); }
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;'> <b>Versus </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>"); }
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); }
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(); } }
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; }
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; }
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; }
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; }
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; }