Example #1
0
        public List <SeasonTeamPlayerPositionDomainModel> STPP_Detail(SeasonDomainModel season, TeamDomainModel team)
        {
            List <SeasonTeamPlayerPositionDomainModel> STPP = new List <SeasonTeamPlayerPositionDomainModel>();

            using (CSBAAzureEntities context = new CSBAAzureEntities())
            {
                STPP = (from result in context.v_SeasonTeamPlayerPosition
                        orderby result.PositionSortOrder, result.Points
                        where result.SeasonID == season.SeasonID
                        where result.TeamID == team.TeamID
                        select new SeasonTeamPlayerPositionDomainModel
                {
                    PlayerGUID = result.PlayerGUID,
                    PlayerName = result.PlayerName,
                    Points = result.Points,
                    PositionName = result.PositionName,
                    PositionNameLong = result.PositionNameLong,
                    SeasonID = result.SeasonID,
                    TeamID = result.TeamID,
                    TeamName = result.TeamName
                }).ToList();
            } // Guaranteed to close the Connection

            return(STPP);
        }
Example #2
0
 public void SelectCurrentSeason(SeasonDomainModel season)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.sp_Season_Current(season.SeasonID);
     }
 }
Example #3
0
 public void ClearSeason(SeasonDomainModel season)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.sp_Season_Clear(season.SeasonID);
     }
 }
Example #4
0
 public void DeleteSeason(SeasonDomainModel season)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var cSeason = (from n in context.Seasons where n.SeasonID == season.SeasonID select n).FirstOrDefault();
         context.Seasons.Remove(cSeason);
         context.SaveChanges();
     }
 }
Example #5
0
        protected void rGridSeason_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "Clear")
            {
                try
                {
                    {
                        SeasonDomainModel SeasonDM = new SeasonDomainModel();
                        SeasonDM.SeasonID = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["SeasonID"];
                        BLL.ClearSeason(SeasonDM);
                    }
                }
                catch (Exception ex)
                {
                    StackTrace st        = new StackTrace();
                    StackFrame sf        = st.GetFrame(0);
                    string     errMethod = sf.GetMethod().Name.ToString();                                           // Get the current method name
                    string     errMsg    = "600";                                                                    // Gotta pass something, we're retro-fitting an existing method
                    Session["LastException"] = ex;                                                                   // Throw the exception in the session variable, will be used in error page
                    string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL
                    Response.Redirect(url);                                                                          // Go to the error page.
                }
            }

            if (e.CommandName == "Select")
            {
                try
                {
                    {
                        SeasonDomainModel SeasonDM = new SeasonDomainModel();
                        SeasonDM.SeasonID = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["SeasonID"];
                        BLL.SelectCurrentSeason(SeasonDM);
                    }
                }
                catch (Exception ex)
                {
                    StackTrace st        = new StackTrace();
                    StackFrame sf        = st.GetFrame(0);
                    string     errMethod = sf.GetMethod().Name.ToString();                                           // Get the current method name
                    string     errMsg    = "600";                                                                    // Gotta pass something, we're retro-fitting an existing method
                    Session["LastException"] = ex;                                                                   // Throw the exception in the session variable, will be used in error page
                    string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL
                    Response.Redirect(url);                                                                          // Go to the error page.
                }
            }
        }
Example #6
0
 public void UpdateSeason(SeasonDomainModel season)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var cSeason = context.Seasons.Find(season.SeasonID);
         if (cSeason != null)
         {
             cSeason.SeasonName    = season.SeasonName;
             cSeason.DraftDate     = season.DraftDate;
             cSeason.MinBid        = season.MinBid;
             cSeason.Active        = season.Active;
             cSeason.CurrentSeason = season.CurrentSeason;
             cSeason.StartPoints   = season.StartPoints;
             context.SaveChanges();
         }
     }
 }
Example #7
0
 protected void rGridSeason_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
 {
     try
     {
         SeasonDomainModel Season = new SeasonDomainModel();
         rGridSeason.DataSource = BLL.ListAllSeason();
     }
     catch (Exception ex)
     {
         StackTrace st        = new StackTrace();
         StackFrame sf        = st.GetFrame(0);
         string     errMethod = sf.GetMethod().Name.ToString();                                           // Get the current method name
         string     errMsg    = "600";                                                                    // Gotta pass something, we're retro-fitting an existing method
         Session["LastException"] = ex;                                                                   // Throw the exception in the session variable, will be used in error page
         string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL
         Response.Redirect(url);                                                                          // Go to the error page.
     }
 }
Example #8
0
        protected void rGridSeason_UpdIns(object sender, GridCommandEventArgs e, string Action)
        {
            try
            {
                GridEditableItem eeditedItem = e.Item as GridEditableItem;

                SeasonDomainModel SeasonDM = new SeasonDomainModel();

                if (Action == "Update")
                {
                    SeasonDM.SeasonID = Convert.ToInt32((eeditedItem.FindControl("lblSeasonID") as Label).Text.ToString());
                }
                SeasonDM.SeasonName  = (eeditedItem.FindControl("rTBSeason") as RadTextBox).Text.ToString();
                SeasonDM.MinBid      = Convert.ToInt32((eeditedItem.FindControl("rNTBMinBid") as RadNumericTextBox).Text.ToString());
                SeasonDM.Active      = Convert.ToBoolean((eeditedItem.FindControl("chkEditActive") as CheckBox).Checked);
                SeasonDM.StartPoints = Convert.ToInt32((eeditedItem.FindControl("rTBStartPoints") as RadTextBox).Text.ToString());
                SeasonDM.DraftDate   = (eeditedItem.FindControl("calSeasonStart") as RadCalendar).SelectedDate;

                //TODO - Implement GEO CODE!!!!!
                if (Action == "Update")
                {
                    BLL.UpdateSeason(SeasonDM);
                }
                else if (Action == "Insert")
                {
                    BLL.InsertSeason(SeasonDM);
                }
            }
            catch (Exception ex)
            {
                StackTrace st        = new StackTrace();
                StackFrame sf        = st.GetFrame(0);
                string     errMethod = sf.GetMethod().Name.ToString();                                           // Get the current method name
                string     errMsg    = "600";                                                                    // Gotta pass something, we're retro-fitting an existing method
                Session["LastException"] = ex;                                                                   // Throw the exception in the session variable, will be used in error page
                string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL
                Response.Redirect(url);                                                                          // Go to the error page.
            }
        }
Example #9
0
        public SeasonDomainModel InsertSeason(SeasonDomainModel season)
        {
            using (CSBAAzureEntities context = new CSBAAzureEntities())
            {
                var _cSeason = new Season
                {
                    SeasonName    = season.SeasonName,
                    DraftDate     = season.DraftDate,
                    StartPoints   = season.StartPoints,
                    MinBid        = season.MinBid,
                    Active        = season.Active,
                    CurrentSeason = season.CurrentSeason
                };
                context.Seasons.Add(_cSeason);
                context.SaveChanges();

                // pass VolID back to BLL
                season.SeasonID = _cSeason.SeasonID;

                return(season);
            }
        }
Example #10
0
 public List <SeasonTeamPlayerPositionDomainModel> STPP_Detail(SeasonDomainModel season, TeamDomainModel team)
 {
     return(DAL.STPP_Detail(season, team));
 }
Example #11
0
 public void SelectCurrentSeason(SeasonDomainModel season)
 {
     dal.SelectCurrentSeason(season);
 }
Example #12
0
 public void ClearSeason(SeasonDomainModel season)
 {
     dal.ClearSeason(season);
 }
Example #13
0
 public void DeleteSeason(SeasonDomainModel season)
 {
     dal.DeleteSeason(season);
 }
Example #14
0
 public void UpdateSeason(SeasonDomainModel season)
 {
     dal.UpdateSeason(season);
 }
Example #15
0
 public SeasonDomainModel InsertSeason(SeasonDomainModel season)
 {
     return(dal.InsertSeason(season));
 }
Example #16
0
        public static string CreateSpreadsheet(int iSeasonID)
        {
            SeasonDomainModel season = new SeasonDomainModel();

            season.SeasonID = iSeasonID;
            SeasonTeamBusinessLogic            stBLL                = new SeasonTeamBusinessLogic();
            SeasonTeamPlayerPositionBLL        stppBLL              = new SeasonTeamPlayerPositionBLL();
            List <SeasonTeamDomainModel>       listSeasonTeam       = stBLL.ListSelectedTeams(season.SeasonID);
            List <SeasonTeamPlayerDomainModel> listSeasonTeamPlayer = new List <SeasonTeamPlayerDomainModel>();
            TeamDomainModel team = new TeamDomainModel();

            Excel.Application xlApp = new Excel.Application();
            Workbook          wb    = xlApp.Workbooks.Add();

            for (int i = 0; i < listSeasonTeam.Count; i++)
            {
                Worksheet sh = wb.Worksheets.Add();
                xlApp.ActiveWindow.Zoom = 140;
                SeasonTeamDomainModel st = listSeasonTeam[i];

                team.TeamID = st.TeamID;
                List <SeasonTeamPlayerPositionDomainModel> stpList = stppBLL.STPP_Detail(season, team);
                sh.Name = st.TeamName.Trim();

                int rowNbr = 1;
                sh.Cells[rowNbr, "A"].Value2      = "Player Name";
                sh.Cells[rowNbr, "A"].ColumnWidth = 30;
                sh.Cells[rowNbr, "B"].Value2      = "Position";
                sh.Cells[rowNbr, "A"].ColumnWidth = 20;
                sh.Cells[rowNbr, "C"].Value2      = "Points";
                sh.Cells[rowNbr, "A"].ColumnWidth = 20;

                sh.Cells[rowNbr, "A"].Style.HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft;
                sh.Cells[rowNbr, "B"].Style.HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignRight;
                sh.Cells[rowNbr, "C"].Style.HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignRight;

                var columnHeadingsRange = sh.Range[sh.Cells[rowNbr, "A"], sh.Cells[rowNbr, "C"]];
                columnHeadingsRange.Interior.Color = XlRgbColor.rgbSkyBlue;
                columnHeadingsRange.Font.Color     = XlRgbColor.rgbWhite;

                rowNbr++;

                foreach (SeasonTeamPlayerPositionDomainModel stp in stpList)
                {
                    sh.Cells[rowNbr, "A"].Value2 = stp.PlayerName.Trim();
                    sh.Cells[rowNbr, "B"].Value2 = stp.PositionName.Trim();
                    sh.Cells[rowNbr, "C"].Value2 = stp.Points;
                    rowNbr++;
                }
            }

            xlApp.DisplayAlerts = false;
            for (int i = xlApp.ActiveWorkbook.Worksheets.Count; i > 0; i--)
            {
                Worksheet wkSheet = (Worksheet)xlApp.ActiveWorkbook.Worksheets[i];
                if (wkSheet.Name == "Sheet1")
                {
                    wkSheet.Delete();
                }
            }
            xlApp.DisplayAlerts = true;


            Random random       = new  Random();
            int    randomNumber = random.Next(0, 10000);
            string path         = AppDomain.CurrentDomain.BaseDirectory;

            string CWorkbook = path + randomNumber + ".xlsx ";

            wb.Application.ActiveWorkbook.CheckCompatibility = false;
            wb.Application.ActiveWorkbook.SaveAs(CWorkbook, Excel.XlFileFormat.xlOpenXMLWorkbook);

            wb.Close(true);

            xlApp.Quit();

            return(CWorkbook);
        }