Exemplo n.º 1
0
        public ActionResult AddSolutionPartner(SolutionPartner newmodel, HttpPostedFileBase uploadfile)
        {
            var languages = LanguageManager.GetLanguages();
            var list      = new SelectList(languages, "Culture", "Language");

            ViewBag.LanguageList = list;
            if (ModelState.IsValid)
            {
                if (uploadfile != null && uploadfile.ContentLength > 0)
                {
                    Random random = new Random();
                    int    rand   = random.Next(1000, 99999999);
                    new ImageHelper(240, 240).SaveThumbnail(uploadfile, "/Content/images/solutionpartner/", Utility.SetPagePlug(newmodel.SolutionPartnerName) + "_" + rand + Path.GetExtension(uploadfile.FileName));
                    newmodel.Logo = "/Content/images/solutionpartner/" + Utility.SetPagePlug(newmodel.SolutionPartnerName) + "_" + rand + Path.GetExtension(uploadfile.FileName);
                }
                else
                {
                    newmodel.Logo = "/Content/images/front/noimage.jpeg";
                }
                newmodel.SortOrder     = 9999;
                newmodel.TimeCreated   = DateTime.Now;
                ViewBag.ProcessMessage = SolutionPartnerManager.AddSolutionPartner(newmodel);
                ModelState.Clear();
                // Response.Redirect("/yonetim/haberduzenle/" + newsmodel.NewsId);
                return(View());
            }
            else
            {
                return(View());
            }
        }
Exemplo n.º 2
0
        public ActionResult EditSolutionPartner()
        {
            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)
                {
                    SolutionPartner editSolutionPartner = SolutionPartnerManager.GetSolutionPartnerById(nid);
                    return(View(editSolutionPartner));
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                return(View());
            }
        }
Exemplo n.º 3
0
        public static bool AddSolutionPartner(SolutionPartner record)
        {
            using (MainContext db = new MainContext())
            {
                try
                {
                    if (!record.TimeCreated.HasValue)
                    {
                        record.TimeCreated = DateTime.Now;
                    }
                    record.Deleted = false;
                    record.Online  = true;
                    db.SolutionPartner.Add(record);
                    db.SaveChanges();

                    LogtrackManager logkeeper = new LogtrackManager();
                    logkeeper.LogDate    = DateTime.Now;
                    logkeeper.LogProcess = EnumLogType.CozumOrtaklari.ToString();
                    logkeeper.Message    = LogMessages.SolutionPartnerAdded;
                    logkeeper.User       = HttpContext.Current.User.Identity.Name;
                    logkeeper.Data       = record.SolutionPartnerName;
                    logkeeper.AddInfoLog(logger);


                    return(true);
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }
        }
Exemplo n.º 4
0
        public ActionResult EditSolutionPartner(SolutionPartner SolutionPartnermodel, HttpPostedFileBase uploadfile)
        {
            var languages = LanguageManager.GetLanguages();
            var list      = new SelectList(languages, "Culture", "Language");

            ViewBag.LanguageList = list;

            if (ModelState.IsValid)
            {
                if (uploadfile != null && uploadfile.ContentLength > 0)
                {
                    Random random = new Random();
                    int    rand   = random.Next(1000, 99999999);
                    new ImageHelper(240, 240).SaveThumbnail(uploadfile, "/Content/images/solutionpartner/", Utility.SetPagePlug(SolutionPartnermodel.SolutionPartnerName) + "_" + rand + Path.GetExtension(uploadfile.FileName));
                    SolutionPartnermodel.Logo = "/Content/images/solutionpartner/" + Utility.SetPagePlug(SolutionPartnermodel.SolutionPartnerName) + "_" + rand + Path.GetExtension(uploadfile.FileName);
                }


                if (RouteData.Values["id"] != null)
                {
                    int  nid      = 0;
                    bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
                    if (isnumber)
                    {
                        SolutionPartnermodel.SolutionPartnerId = nid;
                        ViewBag.ProcessMessage = SolutionPartnerManager.EditSolutionPartner(SolutionPartnermodel);
                        return(View(SolutionPartnermodel));
                    }
                    else
                    {
                        ViewBag.ProcessMessage = false;
                        return(View(SolutionPartnermodel));
                    }
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                return(View());
            }

            return(View());
        }
Exemplo n.º 5
0
        public static bool EditSolutionPartner(SolutionPartner SolutionPartnermodel)
        {
            using (MainContext db = new MainContext())
            {
                try
                {
                    SolutionPartner record = db.SolutionPartner.Where(d => d.SolutionPartnerId == SolutionPartnermodel.SolutionPartnerId && d.Deleted == false).SingleOrDefault();
                    if (record != null)
                    {
                        record.Content             = SolutionPartnermodel.Content;
                        record.Link                = SolutionPartnermodel.Link;
                        record.SolutionPartnerName = SolutionPartnermodel.SolutionPartnerName;
                        record.Language            = SolutionPartnermodel.Language;
                        if (!string.IsNullOrEmpty(SolutionPartnermodel.Logo))
                        {
                            record.Logo = SolutionPartnermodel.Logo;
                        }
                        record.Content = SolutionPartnermodel.Content;
                        db.SaveChanges();

                        LogtrackManager logkeeper = new LogtrackManager();
                        logkeeper.LogDate    = DateTime.Now;
                        logkeeper.LogProcess = EnumLogType.CozumOrtaklari.ToString();
                        logkeeper.Message    = LogMessages.SolutionPartnerEdited;
                        logkeeper.User       = HttpContext.Current.User.Identity.Name;
                        logkeeper.Data       = record.SolutionPartnerName;
                        logkeeper.AddInfoLog(logger);

                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }
        }
Exemplo n.º 6
0
 public static SolutionPartner GetSolutionPartnerById(int nid)
 {
     using (MainContext db = new MainContext())
     {
         try
         {
             SolutionPartner record = db.SolutionPartner.Where(d => d.SolutionPartnerId == nid).SingleOrDefault();
             if (record != null)
             {
                 return(record);
             }
             else
             {
                 return(null);
             }
         }
         catch (Exception ex)
         {
             return(null);
         }
     }
 }
Exemplo n.º 7
0
 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);
                 SolutionPartner sortingrecord = db.SolutionPartner.SingleOrDefault(d => d.SolutionPartnerId == mid);
                 sortingrecord.SortOrder = Convert.ToInt32(row);
                 db.SaveChanges();
                 row++;
             }
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }