Beispiel #1
0
        public ActionResult LoadGroup(string lang)
        {
            var        grouplst = SectorGroupManager.GetSectorGroupList(lang);
            JsonResult result   = Json(new SelectList(grouplst, "SectorGroupId", "GroupName"));

            return(result);
        }
        public ActionResult EditSectorGroup()
        {
            ImageHelperNew.DestroyImageCashAndSession(175, 127);
            var languages = LanguageManager.GetLanguages();
            var list      = new SelectList(languages, "Culture", "Language");

            ViewBag.LanguageList = list;
            if (RouteData.Values["id"] != null)
            {
                int  nid      = 0;
                bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
                if (isnumber)
                {
                    SectorGroup editrecord = SectorGroupManager.GetSectorGroupById(nid);
                    return(View(editrecord));
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                return(View());
            }
        }
        //
        // GET: /Admin/SectorGroup/

        public ActionResult Index()
        {
            string sellang = FillLanguagesList();

            var list = SectorGroupManager.GetSectorGroupList(sellang);

            return(View(list));
        }
        public JsonResult Delete(int id)
        {
            bool isdelete = SectorGroupManager.Delete(id);

            //if (isdelete)
            return(Json(isdelete));
            //  else return false;
        }
        public JsonResult SortRecords(string list)
        {
            JsonList psl = (new JavaScriptSerializer()).Deserialize <JsonList>(list);

            string[] idsList  = psl.list;
            bool     issorted = SectorGroupManager.SortRecords(idsList);

            return(Json(issorted));
        }
Beispiel #6
0
        public ActionResult subSectors(int id)
        {
            var sl = SectorManager.GetSectorList(id);

            var sg = SectorGroupManager.GetSectorGroupById(id);
            SectorSubWrapperModel pswm = new SectorSubWrapperModel(sl, sg);

            return(PartialView("_Sectors", pswm));
        }
        public ActionResult AddSectorGroup(SectorGroup newmodel, HttpPostedFileBase uploadfile, HttpPostedFileBase uploadimage)
        {
            var languages = LanguageManager.GetLanguages();
            var list      = new SelectList(languages, "Culture", "Language");

            ViewBag.LanguageList = list;
            if (ModelState.IsValid)
            {
                //if (uploadimage != null && uploadimage.ContentLength > 0)
                //{
                //    using (System.Drawing.Image image = System.Drawing.Image.FromStream(uploadimage.InputStream, true, true))
                //    {
                //        if (image.Width == 48 && image.Height == 48)
                //        {
                //            Random random = new Random();
                //            int rand = random.Next(1000, 99999999);
                //            uploadimage.SaveAs(Server.MapPath("/Content/images/projects/" + Utility.SetPagePlug(newmodel.GroupName) + "_" + rand + Path.GetExtension(uploadimage.FileName)));
                //            newmodel.SectorGroupLogo = "/Content/images/projects/" + Utility.SetPagePlug(newmodel.GroupName) + "_" + rand + Path.GetExtension(uploadimage.FileName);
                //        }
                //        else
                //        {
                //            TempData["ImageSizeError"] = "Eklemiş olduğunuz ikonun boyutları 48x48 olmalıdır...";
                //            return View();
                //        }
                //    }
                //}
                if (Session["ModifiedImageId"] != null)
                {
                    newmodel.SectorGroupLogo = "/Content/images/userfiles/" + Session["ModifiedImageId"].ToString() + Session["WorkingImageExtension"].ToString();
                    ImageHelperNew.DestroyImageCashAndSession(0, 0);
                }
                else
                {
                    newmodel.SectorGroupLogo = "/Content/images/front/noimage.jpeg";
                }
                newmodel.PageSlug      = Utility.SetPagePlug(newmodel.GroupName);
                newmodel.TimeCreated   = DateTime.Now;
                ViewBag.ProcessMessage = SectorGroupManager.AddSectorGroup(newmodel);
                ModelState.Clear();

                return(View());
            }
            else
            {
                return(View());
            }
        }
Beispiel #8
0
        string FillLanguagesList()
        {
            string lang = "";
            string id   = "";

            if (RouteData.Values["lang"] == null)
            {
                lang = "tr";
            }
            else
            {
                lang = RouteData.Values["lang"].ToString();
            }

            var languages = LanguageManager.GetLanguages();
            var list      = new SelectList(languages, "Culture", "Language", lang);

            ViewBag.LanguageList = list;

            var groups = SectorGroupManager.GetSectorGroupList(lang);

            if (RouteData.Values["id"] == null)
            {
                if (groups != null && groups.Count != 0)
                {
                    id = groups.First().SectorGroupId.ToString();
                }
                else
                {
                    id = "0";
                }
            }
            else
            {
                id = RouteData.Values["id"].ToString();
            }


            var grouplist = new SelectList(groups, "SectorGroupId", "GroupName", id);

            ViewBag.GroupList = grouplist;

            return(id);
        }
Beispiel #9
0
        //
        // GET: /Sector/

        public ActionResult Index()
        {
            MainContext db   = new MainContext();
            Tags        stag = db.Tags.Where(x => x.PageId == 7 && x.Lang == lang).FirstOrDefault();

            if (stag != null)
            {
                ViewBag.Title       = stag.Title;
                ViewBag.Description = stag.Description;
                ViewBag.Keywords    = stag.Keyword;
            }


            var Sector_group_list = SectorGroupManager.GetSectorGroupListForFront(lang);
            //Sector Sector = new Sector();
            //OurSectors ourSectors = new OurSectors();
            //SectorGroup sectorgrp = new SectorGroup();
            //int index = 0;
            //if (RouteData.Values["sid"] != null)
            //{
            //    Sector = SectorManager.GetSectorById(Convert.ToInt32(RouteData.Values["sid"].ToString()));
            //    ViewBag.grpname = SectorGroupManager.GetSectorGroupById(Sector.SectorGroupId).GroupName;
            //    index = Sector_group_list.Select((v, i) => new { Group = v, index = i }).First(d => d.Group.SectorGroupId == Sector.SectorGroupId).index;
            //}
            //else if (RouteData.Values["gid"] != null)
            //{
            //    sectorgrp = SectorGroupManager.GetSectorGroupById(Convert.ToInt32(RouteData.Values["gid"].ToString()));
            //    index = Sector_group_list.Select((v, i) => new { Group = v, index = i }).First(d => d.Group.SectorGroupId == sectorgrp.SectorGroupId).index;
            //}
            //else
            //{
            //    ourSectors = SectorManager.GetOurSectors(lang);
            //}

            //Sector_group_list = ServiceGroupManager.Swap(Sector_group_list, 0, index);

            SectorWrapperModel swm = new SectorWrapperModel(null, Sector_group_list, null, null, null);

            return(View(swm));
        }
        public JsonResult EditStatus(int id)
        {
            bool isupdate = SectorGroupManager.UpdateStatus(id);

            return(Json(isupdate));
        }
Beispiel #11
0
        public PartialViewResult topsectors()
        {
            var sectors = SectorGroupManager.GetSectorGroupListForFront(lang).Take(16);

            return(PartialView("_topsectors", sectors));
        }