public static bool EditSectorGroup(SectorGroup SectorGroupmodel) { using (MainContext db = new MainContext()) { try { SectorGroup record = db.SectorGroup.Where(d => d.SectorGroupId == SectorGroupmodel.SectorGroupId).SingleOrDefault(); if (record != null) { record.GroupName = SectorGroupmodel.GroupName; record.PageSlug = SectorGroupmodel.PageSlug; record.GroupContent = SectorGroupmodel.GroupContent; if (SectorGroupmodel.SectorGroupLogo != null) { record.SectorGroupLogo = SectorGroupmodel.SectorGroupLogo; } record.Language = SectorGroupmodel.Language; db.SaveChanges(); return(true); } else { return(false); } } catch (Exception ex) { return(false); } } }
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()); } }
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()); } }
public static bool AddSectorGroup(SectorGroup record) { using (MainContext db = new MainContext()) { try { record.TimeCreated = DateTime.Now; record.SortOrder = 9999; record.Online = true; db.SectorGroup.Add(record); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } } }
public static SectorGroup GetSectorGroupById(int nid) { using (MainContext db = new MainContext()) { try { SectorGroup record = db.SectorGroup.Where(d => d.SectorGroupId == nid).SingleOrDefault(); if (record != null) { return(record); } else { return(null); } } catch (Exception ex) { return(null); } } }
public static bool SortRecords(string[] idsList) { using (MainContext db = new MainContext()) { try { int row = 0; foreach (string id in idsList) { int mid = Convert.ToInt32(id); SectorGroup sortingrecord = db.SectorGroup.SingleOrDefault(d => d.SectorGroupId == mid); sortingrecord.SortOrder = Convert.ToInt32(row); db.SaveChanges(); row++; } return(true); } catch (Exception) { return(false); } } }
public static SectorGroup CreateSectorGroup(int sectorGroupID, string sectorGroupName) { SectorGroup sectorGroup = new SectorGroup(); sectorGroup.SectorGroupID = sectorGroupID; sectorGroup.SectorGroupName = sectorGroupName; return sectorGroup; }
public void AddToSectorGroups(SectorGroup sectorGroup) { base.AddObject("SectorGroups", sectorGroup); }
public ContextMenuInfo(SectorGroup top, SectorGroup bottom, UnmatchingLinedefsType type) { this.top = top; this.bottom = bottom; this.type = type; }
public SectorWrapperModel(IEnumerable <Sector> sectors, IEnumerable <SectorGroup> sectorgroups, Sector sector, OurSectors oursectors, SectorGroup sectorgrp) { this.sectors = sectors; this.sectorgroups = sectorgroups; this.sector = sector; this.oursectors = oursectors; this.sectorgrp = sectorgrp; }
public SectorSubWrapperModel(IEnumerable <Sector> sectors, SectorGroup sectorgroup) { this.sectors = sectors; this.sectorgroup = sectorgroup; //this.productsubgroups = productsubgroups; }