예제 #1
0
        public ActionResult Index()
        {
            if (!WebSecurity.IsAuthenticated)
            {
                return(View("~/Views/Account/Login.cshtml", new LoginModel()));
            }



            FrontModel front = new FrontModel
            {
                News    = reposetory.GetFrontNews(),
                Events  = reposetory.GetFrontEvents(),
                MyTeams = reposetory.GetMyTeams(CurrentProfile.PersonID)
            };

            if (CurrentProfile.useTakeTeamSpot)
            {
                int         minTeammembers = int.Parse(ConfigurationManager.AppSettings["TeamMin"]);
                List <Team> teamsToTake    = reposetory.GetOpenTeams(CurrentProfile.PersonID, CurrentProfile.AssociationID, minTeammembers);
                if (teamsToTake != null)
                {
                    front.MyTeams.AddRange(teamsToTake);
                }
            }

            return(View(front));
        }
예제 #2
0
 public FrontViewModel(FrontModel model)
 {
     Front                = model;
     Add                  = new RelayCommand(InsAddFrontExecute);
     Delete               = new RelayCommand <FrontGroup>(OnDeleteExecute);
     ShowHouse            = new RelayCommand <House>(OnShowHouseExecute);
     Export               = new RelayCommand(InsFrontExportExecute);
     DrawVisuals          = new RelayCommand(InsFrontDrawVisuals);
     ShowOptions          = new RelayCommand <FrontGroup>(OnShowOptionsExecute);
     ShowHouseOptions     = new RelayCommand <House>(OnShowHouseOptionsExecute);
     ClearOverrideOptions = new RelayCommand <House>(OnClearOverrideOptionsExecute);
 }
예제 #3
0
        //
        // GET: /CPFront/

        public ActionResult Front()
        {
            ViewBag.CurrentMainTab     = "Front";
            ViewBag.CurrentSubTab      = "Profile";
            ViewBag.CurrentSuperSubTab = "Name";
            VideoLinkModel objVideoLink = new VideoLinkModel();
            FrontModel     objFront     = new FrontModel();

            objFront.VideoLinkModel = objVideoLink;

            List <SectionModel> objSection = new List <SectionModel>();

            objSection = SectionMap.Map(_repoSection.GetList(x => x.LanguageId == 1).ToList());
            objFront.SectionListModel = objSection;
            return(View("Front", objFront));
        }
예제 #4
0
        public ActionResult FrontSection(FrontModel objFrontModel, FormCollection fc)
        {
            try
            {
                long sectionId = long.Parse(fc["sectionId"]);
                if (ModelState.IsValid)
                {
                    if (!string.IsNullOrEmpty(objFrontModel.VideoLinkModel.VideoLinkUrl))
                    {
                        objFrontModel.VideoLinkModel.CreatedDate = DateTime.Now;
                        objFrontModel.VideoLinkModel.SectionId   = sectionId;
                        var vidLink = VideoLinkMap.Map(objFrontModel.VideoLinkModel);
                        _repoVideoLink.Add(vidLink);
                        _repoVideoLink.Save();
                    }
                    if (objFrontModel.BannerPic != null && objFrontModel.BannerPic.InputStream != null)
                    {
                        var file = new Models.File();

                        file.ContentType = objFrontModel.BannerPic.ContentType;
                        file.FileName    = objFrontModel.BannerPic.FileName;

                        var memoryStream = new MemoryStream();
                        objFrontModel.BannerPic.InputStream.CopyTo(memoryStream);

                        file.Content = memoryStream.ToArray();
                        file.Link    = objFrontModel.FileLink;

                        _repoFile.Add(file);
                        _repoFile.Save();

                        FrontEntityFileModel efModel = new FrontEntityFileModel();
                        var entityFile = FrontEntityFileMap.Map(efModel);
                        entityFile.SectionId = sectionId;
                        entityFile.EntityId  = 0;
                        entityFile.FileId    = file.Id;
                        _repoFrontEntityFile.Add(entityFile);
                        _repoFrontEntityFile.Save();
                    }
                }
                return(View("Front", objFrontModel));
            }
            catch (Exception e)
            {
                return(View("Front", objFrontModel));
            }
        }
예제 #5
0
        /// <summary>
        /// Расчет фронтонов дома
        /// </summary>
        public List <FrontValue> CalcHouse(House house, out List <List <FrontCalcPoint> > contourSegmentsCalcPoints)
        {
            contourSegmentsCalcPoints = new List <List <FrontCalcPoint> >();
            if (house == null)
            {
                return(null);
            }

            var resFronts = new List <FrontValue>();

            this.house = house;
            front      = house.FrontGroup?.Front;
            if (front == null)
            {
                return(resFronts);
            }
            frontOpt = front.Options;
            model    = front.Model;
            map      = model.Map;
            delta    = frontOpt.StepCalcPointInFront;

            var houseContour = house.Contour;

            // Расчет фронтов на каждом сегменте контура дома
            for (int i = 0; i < houseContour.NumberOfVertices; i++)
            {
                try
                {
                    using (var seg = houseContour.GetLineSegment2dAt(i))
                    {
                        List <FrontCalcPoint> segCalcPoints;
                        var segFronts = CalcSegment(seg, out segCalcPoints);
                        if (segFronts != null && segFronts.Any())
                        {
                            resFronts.AddRange(segFronts);
                        }
                        contourSegmentsCalcPoints.Add(segCalcPoints);
                    }
                }
                catch (Exception ex) // houseContour.GetLineSegment2dAt(i) - если сегмент не линейный
                {
                    Logger.Log.Error(ex, "CalcFrontCentral.CalcHouse");
                }
            }
            //resFronts = FrontValue.Merge(resFronts);
            return(resFronts);
        }
예제 #6
0
        public PartialViewResult FrontSearch()
        {
            //long sectionId = 0;
            //if (HttpContext.Items["one"] != null)
            //{
            long sectionId = long.Parse(HttpContext.Items["one"].ToString());
            //}
            FrontModel            objFront = new FrontModel();
            List <VideoLinkModel> lstVideo = new List <VideoLinkModel>();

            lstVideo = VideoLinkMap.Map(_repoVideoLink.GetList(x => x.SectionId == sectionId).OrderBy(x => x.CreatedDate).ToList());

            FrontModel fModel = new FrontModel();

            fModel.VideoListModel = lstVideo;

            List <FrontEntityFileModel> lstFrontEntityFile = new List <FrontEntityFileModel>();

            lstFrontEntityFile = FrontEntityFileMap.Map(_repoFrontEntityFile.GetList(x => x.SectionId == sectionId).OrderBy(x => x.Id).ToList());
            fModel.FrontEntityFileListModel = lstFrontEntityFile;
            return(PartialView("_FrontList", fModel));
            //return View(fModel);
        }
예제 #7
0
 public ExportToDB (FrontModel frontModel)
 {
     this.frontModel = frontModel;
 }