Beispiel #1
0
        public static bool AddProjectGroup(ProjectGroup record)
        {
            using (DeneysanContext db = new DeneysanContext())
            {
                try
                {

                    record.Online = true;
                    record.SortNumber = 9999;
                    db.ProjectGroup.Add(record);
                    db.SaveChanges();

                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
        public ActionResult EdtiGroup(ProjectGroup model, HttpPostedFileBase uploadfile)
        {
            var languages = LanguageManager.GetLanguages();
            var list = new SelectList(languages, "Culture", "Language");
            ViewBag.LanguageList = list;
            if (ModelState.IsValid)
            {
              //ProjectGroup model = new ProjectGroup();
              // model.GroupName = txtname;
              //model.Language = drplanguage;
              if (uploadfile != null && uploadfile.ContentLength > 0)
              {
            Random random = new Random();
            int rand = random.Next(1000, 99999999);

              }
              if (RouteData.Values["id"] != null)
              {
            int nid = 0;
            bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
            if (isnumber)
            {
              model.PageSlug = Utility.SetPagePlug(model.GroupName);
              model.ProjectGroupId = nid;
              ViewBag.ProcessMessage = ProductManager.EditProjectGroup(model);
              return View(model);
            }
            else
            {
              ViewBag.ProcessMessage = false;
              return View(model);
            }
              }

            }
            return View();
        }
Beispiel #3
0
        public static bool EditProjectGroup(ProjectGroup record)
        {
            using (DeneysanContext db = new DeneysanContext())
            {
                try
                {
                    ProjectGroup editrecord = db.ProjectGroup.Where(d => d.ProjectGroupId == record.ProjectGroupId ).SingleOrDefault();
                    if (record != null)
                    {

                        editrecord.GroupName = record.GroupName;
                        editrecord.PageSlug = record.PageSlug;

                        db.SaveChanges();

                        //LogtrackManager logkeeper = new LogtrackManager();
                        //logkeeper.LogDate = DateTime.Now;
                        //logkeeper.LogProcess = EnumLogType.DokumanGrup.ToString();
                        //logkeeper.Message = LogMessages.ProjectGroupAdded;
                        //logkeeper.User = HttpContext.Current.User.Identity.Name;
                        //logkeeper.Data = record.GroupName;
                        //logkeeper.AddInfoLog(logger);

                        return true;
                    }
                    else
                        return false;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
        public ActionResult Index(string drplanguage, string txtname)
        {
            string lang = FillLanguagesList();
            if (ModelState.IsValid)
            {
              ProjectGroup model = new ProjectGroup();
              model.GroupName = txtname;
              model.Language = drplanguage;
              //if (uploadfile != null && uploadfile.ContentLength > 0)
              //{
              //  Random random = new Random();
              //  int rand = random.Next(1000, 99999999);
              //  new ImageHelper(280, 240).SaveThumbnail(uploadfile, "/Content/images/productcategory/", Utility.SetPagePlug(model.GroupName) + "_" + rand + Path.GetExtension(uploadfile.FileName));
              //  model.GroupImage = "/Content/images/productcategory/" + Utility.SetPagePlug(model.GroupName) + "_" + rand + Path.GetExtension(uploadfile.FileName);
              //}
              //else
              //{
              //  model.GroupImage = "/Content/images/front/noimage.jpeg";
              //}

              model.PageSlug = Utility.SetPagePlug(txtname);
              ViewBag.ProcessMessage = ProductManager.AddProjectGroup(model);

              var grouplist = ProductManager.GetProjectGroupList(lang);

              return View(grouplist);

            }
            return View();
        }