Пример #1
0
        public List <SportType> getLkpSportType()
        {
            SportBuildingsContext con   = new SportBuildingsContext();
            List <SportType>      dbobj = con.SportType.ToList();

            return(dbobj);
        }
Пример #2
0
        public DataPager GetSportBuildingList(int count, int page = 1, string filterText = "", [FromBody] string filterIds = null)
        {
            if (filterText == null)
            {
                filterText = "";
            }
            int  num;
            bool isNumeric               = int.TryParse(filterText, out num);
            SportBuildingsContext con    = new SportBuildingsContext();
            List <int>            idsLit = new List <int>();

            if (!String.IsNullOrEmpty(filterIds))
            {
                idsLit = filterIds.Split(',').Select(x => int.Parse(x)).ToList();
            }


            DataPager obj = new DataPager();

            obj.aaData               = GetSportBuildings(count, page, String.Join(',', idsLit), filterText);
            obj.iTotalRecords        = con.SportBuildings.Count();
            obj.iTotalDisplayRecords = count;
            obj.currentPage          = page;


            int page_range = 4;
            int startRange = (page < page_range) ? 1 : ((page > obj.totalPages - page_range + 1) ? obj.totalPages - page_range + 1 : page - 2);

            obj.pages = Enumerable.Range(startRange, (obj.totalPages > page_range) ? page_range : obj.totalPages).ToList();
            return(obj);
        }
Пример #3
0
        public IEnumerable <MainPageObjectList> GetSportBuildings(int count, int page = 1)
        {
            //  if (filterText == null) filterText = "";
            int num;
            // bool isNumeric = int.TryParse(filterText, out num);
            SportBuildingsContext con    = new SportBuildingsContext();
            List <int>            idsLit = new List <int>();

            //   if (!String.IsNullOrEmpty(idsList)) idsLit = idsList.Split(',').Select(x => int.Parse(x)).ToList();

            int toskip = count * (page - 1);
            List <MainPageObjectList> list = new List <MainPageObjectList>();

            foreach (SportBuildings x in con.SportBuildings
                     .OrderByDescending(x => x.Objectid).Skip(toskip).Take(count))
            {
                MainPageObjectList obj = new MainPageObjectList();
                obj.ID         = x.Objectid;
                obj.ObjectName = x.BuildingName;
                //obj.Variety = String.Join(", ", x.ImmovableObjectsVariety.Select(v => v.Variety.Name));

                //                obj.PhotoAddress = !String.IsNullOrEmpty(x.PhotoAddress) ? Program.proxy + x.PhotoAddress : "";
                obj.linkPath = "objects/SportBuilding/SportBuildingObject?id=" + x.Objectid.ToString();
                obj.objType  = "immovable";
                obj.mapType  = "immovable";
                //obj.mapID = x.Id;
                list.Add(obj);
            }
            return(list);
        }
Пример #4
0
        public List <Lkpregion> getLkpRegion()
        {
            SportBuildingsContext con   = new SportBuildingsContext();
            List <Lkpregion>      dbobj = con.Lkpregion.ToList();

            return(dbobj);
        }
Пример #5
0
        public IEnumerable <DamxmareNagebobebiSatavsoebiObjectList> GetDaxmareNagebobebiSatavsoebis(int objID, int count, int page = 1)
        {
            //  if (filterText == null) filterText = "";
            int num;
            // bool isNumeric = int.TryParse(filterText, out num);
            SportBuildingsContext con    = new SportBuildingsContext();
            List <int>            idsLit = new List <int>();

            //   if (!String.IsNullOrEmpty(idsList)) idsLit = idsList.Split(',').Select(x => int.Parse(x)).ToList();

            int toskip = count * (page - 1);
            List <DamxmareNagebobebiSatavsoebiObjectList> list = new List <DamxmareNagebobebiSatavsoebiObjectList>();

            foreach (DamxmareNageboba x in con.DamxmareNageboba.Where(m => Convert.ToInt32(m.BuildingId) == objID)
                     .OrderByDescending(x => x.Objectid).Skip(toskip).Take(count))
            {
                DamxmareNagebobebiSatavsoebiObjectList obj = new DamxmareNagebobebiSatavsoebiObjectList();
                obj.Objectid   = x.Objectid;
                obj.Dasaxeleba = x.Dasaxeleba;
                obj.Raodenoba  = x.Raodenoba;
                obj.Shenishvna = x.Shenishvna;

                //obj.Variety = String.Join(", ", x.ImmovableObjectsVariety.Select(v => v.Variety.Name));

                //                obj.PhotoAddress = !String.IsNullOrEmpty(x.PhotoAddress) ? Program.proxy + x.PhotoAddress : "";
                obj.linkPath = "objects/SportBuilding/DamxmareNagebobebiSatavsoebi?id=" + x.Objectid.ToString();
                //obj.objType = "immovable";
                //obj.mapType = "immovable";
                //obj.mapID = x.Id;
                list.Add(obj);
            }
            return(list);
        }
Пример #6
0
        public SportBuildingCustomClass getSportBuildingObject(int id)
        {
            SportBuildingsContext    con   = new SportBuildingsContext();
            SportBuildings           dbobj = con.SportBuildings.FirstOrDefault(m => m.Objectid == id);
            SportBuildingCustomClass obj   = new SportBuildingCustomClass()
            {
                Objectid     = dbobj.Objectid,
                BuildingName = dbobj.BuildingName,
                SportTypeId  = dbobj.SportTypeId,
                Regioni      = dbobj.Regioni,
                Raioni       = dbobj.Raioni,
                Sofeli       = dbobj.Sofeli,
                Qucha        = dbobj.Qucha,
                Saxli        = dbobj.Saxli,
                TelNumber    = dbobj.TelNumber,
                OwnedBy      = dbobj.OwnedBy,

                EqspSesvlisTariRi   = dbobj.EqspSesvlisTariRi,
                SabalansoRirebuleba = dbobj.SabalansoRirebuleba,
                ParcelArea          = dbobj.ParcelArea,
                SaqKodi             = dbobj.SaqKodi,
                Gengegma            = dbobj.Gengegma,
                Gatboba             = dbobj.Gatboba,
                ElKveba             = dbobj.ElKveba,
                Ventilacia          = dbobj.Ventilacia,
                Kondicireba         = dbobj.Kondicireba,
                Radioficireba       = dbobj.Radioficireba,
                Interneti           = dbobj.Interneti,
                TeritorisSemogobva  = dbobj.TeritorisSemogobva,
                Wyalmomarageba      = dbobj.Wyalmomarageba,
                TeqnikuriAgwera     = dbobj.TeqnikuriAgwera,
                WebSite             = dbobj.WebSite,
                PostalCode          = dbobj.PostalCode,
                Email         = dbobj.Email,
                DaarsebisWeli = dbobj.DaarsebisWeli,
                DawesebulebisXelmdzgvaneli        = dbobj.DawesebulebisXelmdzgvaneli,
                OrganizaciisIuridiuliSaxelwodeba  = dbobj.OrganizaciisIuridiuliSaxelwodeba,
                OrganizaciisIuridiuliStatusi      = dbobj.OrganizaciisIuridiuliStatusi,
                GoogleMapCoordinates              = dbobj.GoogleMapCoordinates,
                OrganizaciisXelmdzgvaneli         = dbobj.OrganizaciisXelmdzgvaneli,
                OrganizaciisXelmdzgvanelisStatusi = dbobj.OrganizaciisXelmdzgvanelisStatusi,
                InformaciaAdaptirebulobis         = dbobj.InformaciaAdaptirebulobis,
                NagebobisStatusi     = dbobj.NagebobisStatusi,
                NagebobisMdgomareoba = dbobj.NagebobisMdgomareoba
            };

            return(obj);
        }
Пример #7
0
        public DamxmareNagebobebiCustomClass getDamxmareNagebobebiObject(int id)
        {
            SportBuildingsContext         con   = new SportBuildingsContext();
            DamxmareNageboba              dbobj = con.DamxmareNageboba.FirstOrDefault(m => m.Objectid == id);
            DamxmareNagebobebiCustomClass obj   = new DamxmareNagebobebiCustomClass()
            {
                Objectid     = dbobj.Objectid,
                Dasaxeleba   = dbobj.Dasaxeleba,
                Danishnuleba = dbobj.Danishnuleba,
                Raodenoba    = dbobj.Raodenoba,
                Area         = dbobj.Area,
                Shenishvna   = dbobj.Shenishvna,
                BuildingId   = dbobj.BuildingId
            };

            return(obj);
        }
Пример #8
0
        public DataPager GetDamxmareNagebobebiSatavsoebiList(int objID, int count, int page = 1)
        {
            SportBuildingsContext con = new SportBuildingsContext();

            DataPager obj = new DataPager();

            obj.DaxmareNagebobebiData = GetDaxmareNagebobebiSatavsoebis(objID, count, page);
            obj.iTotalRecords         = obj.DaxmareNagebobebiData.Count();
            obj.iTotalDisplayRecords  = count;
            obj.currentPage           = page;


            int page_range = 4;
            int startRange = (page < page_range) ? 1 : ((page > obj.totalPages - page_range + 1) ? obj.totalPages - page_range + 1 : page - 2);

            obj.pages = Enumerable.Range(startRange, (obj.totalPages > page_range) ? page_range : obj.totalPages).ToList();
            return(obj);
        }
Пример #9
0
        public IActionResult AddObject([FromForm] SportBuildingCustomClass model)
        {
            SportBuildingsContext con = new SportBuildingsContext();
            string userID             = null;

            if (User.Identity.Name != null)
            {
                userID = User.Identity.Name;
            }
            try
            {
                if (model.Objectid == 0)
                {
                    SportBuildings ob = new SportBuildings()
                    {
                        BuildingName = model.BuildingName,
                        Regioni      = model.Regioni,
                        Raioni       = model.Raioni,
                        Sofeli       = model.Sofeli,
                        Qucha        = model.Qucha
                    };
                    // ob.UserObjectPhotos = new List<UserObjectPhotos>();

                    //if (model.photos != null)
                    //{
                    //    foreach (var photo in model.photos)
                    //    {
                    //        if (photo != null)
                    //        {
                    //            MemoryStream target = new MemoryStream();
                    //            photo.OpenReadStream().CopyTo(target);
                    //            var data = target.ToArray();
                    //            ob.UserObjectPhotos.Add(new UserObjectPhotos() { Photo = data });
                    //        }
                    //    }
                    //}

                    con.SportBuildings.Add(ob);
                    // con.SaveChanges();
                    return(Ok(""));
                }
                else
                {
                    SportBuildings ob = con.SportBuildings.FirstOrDefault(x => x.Objectid == model.Objectid);
                    con.Entry(ob).CurrentValues.SetValues(model);

                    //   List<UserObjectPhotos> photos = new List<UserObjectPhotos>();

                    //if (ob.UserObjectPhotos != null)
                    //{
                    //    foreach (UserObjectPhotos uphoto in ob.UserObjectPhotos)
                    //    {
                    //        string photo = Convert.ToBase64String(uphoto.Photo);
                    //        string p = String.Format("data:image/jpg;base64,{0}", photo);

                    //        if (!model.images.Contains(p)) photos.Add(uphoto);
                    //    }

                    //    if (photos.Count > 0)
                    //    {
                    //        photos.ForEach(x => con.UserObjectPhotos.Remove(x));
                    //    }
                    //}

                    //if (model.photos != null)
                    //{
                    //    foreach (var photo in model.photos)
                    //    {
                    //        if (photo != null)
                    //        {
                    //            MemoryStream target = new MemoryStream();
                    //            photo.OpenReadStream().CopyTo(target);
                    //            var data = target.ToArray();
                    //            ob.UserObjectPhotos.Add(new UserObjectPhotos() { Photo = data });
                    //        }
                    //    }
                    //}

                    //  con.SaveChanges();
                    return(Ok(""));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(new { message = ex.Message, }));
            }


            return(Ok(""));
        }