コード例 #1
0
        public ActionResult Update(long id, string btnSubmit, string FullName, string SDT, string TimeNote, string City)
        {
            try
            {
                Common.FriendlyUrl friendlyUrl = new Common.FriendlyUrl();

                if (btnSubmit == "Thêm")
                {
                    OrderSitting orderSitting = new OrderSitting();
                    orderSitting.FullName   = FullName;
                    orderSitting.SDT        = SDT;
                    orderSitting.TimeNote   = TimeNote;
                    orderSitting.DateCreate = DateTime.Now;
                    orderSitting.City       = City;

                    orderSittingBusiness.AddNew(orderSitting);
                }
                else
                {
                    var orderSitting = orderSittingBusiness.GetById(id);
                    orderSitting.FullName = FullName;
                    orderSitting.SDT      = SDT;
                    orderSitting.TimeNote = TimeNote;
                    orderSitting.City     = City;

                    orderSittingBusiness.Edit(orderSitting);
                }
                Response.Redirect("/Manage/OrderSitting/Index");
            }
            catch (Exception ex)
            {
                Response.Redirect("/Manage/OrderSitting/Index");
            }
            return(View());
        }
コード例 #2
0
        public ActionResult Update(long id, string btnSubmit, string FileName, string Description, string SoureFile, int CatalogDownloadID)
        {
            try
            {
                Common.FriendlyUrl friendlyUrl = new Common.FriendlyUrl();

                if (btnSubmit == "Thêm")
                {
                    Downloads Download = new Downloads();
                    Download.FileName = FileName;
                    if (SoureFile != "")
                    {
                        Download.SoureFile = SoureFile;
                    }
                    Download.CatalogDownloadID = CatalogDownloadID;
                    string   file = HttpContext.Server.MapPath(SoureFile);
                    FileInfo info = new FileInfo(file);
                    //      int fileCount = Directory.GetFiles(file, "*.*", SearchOption.AllDirectories).Length;
                    Download.Size        = Math.Round(info.Length / 1024f / 1024f, 2);
                    Download.Description = Description;
                    DownloadsBusiness.AddNew(Download);
                }
                else
                {
                    var Download = DownloadsBusiness.GetById(id);
                    Download.FileName = FileName;
                    if (SoureFile != "")
                    {
                        Download.SoureFile = SoureFile;
                    }
                    string   file = HttpContext.Server.MapPath(SoureFile);
                    FileInfo info = new FileInfo(file);
                    //      int fileCount = Directory.GetFiles(file, "*.*", SearchOption.AllDirectories).Length;
                    Download.Size = Math.Round(info.Length / 1024f / 1024f, 2);
                    Download.CatalogDownloadID = CatalogDownloadID;

                    Download.Description = Description;
                    DownloadsBusiness.Edit(Download);
                }
                Response.Redirect("/Manage/Downloads/Index");
            }
            catch (Exception ex)
            {
                Response.Redirect("/Manage/Downloads/Index");
            }
            return(View());
        }
コード例 #3
0
        public ActionResult UpdateCatalogDownloads(long id, string btnSubmit, string CatalogDownloadName, string Description, string Icon)
        {
            try
            {
                Common.FriendlyUrl friendlyUrl = new Common.FriendlyUrl();

                if (btnSubmit == "Thêm")
                {
                    CatalogDownloads catalogDownload = new CatalogDownloads();
                    catalogDownload.CatalogDownloadName = CatalogDownloadName;
                    catalogDownload.ParentId            = -1;
                    if (Icon != "")
                    {
                        catalogDownload.Icon = Icon;
                    }
                    catalogDownload.FriendlyUrl = Common.util.Function.ConvertFileName(CatalogDownloadName);
                    catalogDownload.Status      = 1;
                    catalogDownload.Description = Description;
                    CatalogDownloadsBusiness.AddNew(catalogDownload);
                }
                else
                {
                    var catalogDownload = CatalogDownloadsBusiness.GetById(id);
                    catalogDownload.CatalogDownloadName = CatalogDownloadName;
                    if (Icon != "")
                    {
                        catalogDownload.Icon = Icon;
                    }
                    catalogDownload.Status      = 1;
                    catalogDownload.FriendlyUrl = Common.util.Function.ConvertFileName(CatalogDownloadName);

                    catalogDownload.Description = Description;
                    CatalogDownloadsBusiness.Edit(catalogDownload);
                }
                Response.Redirect("/Manage/Downloads/IndexCatalogDownloads");
            }
            catch (Exception ex)
            {
                Response.Redirect("/Manage/Downloads/IndexCatalogDownloads");
            }
            return(View());
        }
コード例 #4
0
        public ActionResult Update(long id, string btnSubmit, string VideoName, string VideoName_EN, string VideoUrl, string VideoLink, string Description, string SeoTitle, string SeoKeyword, string SeoDescription, string VideoNamecu)
        {
            try
            {
                Common.FriendlyUrl friendlyUrl = new Common.FriendlyUrl();

                if (btnSubmit == "Thêm")
                {
                    Videos video = new Videos();
                    video.VideoName    = VideoName;
                    video.VideoName_EN = VideoName_EN;
                    if (string.IsNullOrEmpty(VideoUrl))
                    {
                        video.VideoUrl = Function.ConvertFileName(VideoName);
                    }
                    else
                    {
                        video.VideoUrl = VideoUrl;
                    }
                    video.VideoLink       = VideoLink;
                    video.VideoDecription = Description;
                    video.SeoTitle        = SeoTitle;
                    video.SeoKeyword      = SeoKeyword;
                    video.SeoDescription  = SeoDescription;
                    video.DateCreate      = DateTime.Now;
                    videosBusiness.AddNew(video);
                    //try
                    //{
                    //    Random rnd = new Random();
                    //    int ngaunhien = rnd.Next(1, 100);
                    //    friendlyUrl.ItemId = video.Id;
                    //    friendlyUrl.Link = video.VideoUrl;

                    //        friendlyUrl.ControllerName = "Videos";
                    //        friendlyUrl.ActionName = "VideoDetail";

                    //    friendlyUrl.NameLink = video.VideoUrl+ngaunhien.ToString() ;
                    //    friendlyUrl.NameSpaces = "BuyGroup365.Controllers";
                    //    friendlyUrl.Order = 0;

                    //    _friendlyUrlBusines.InsertLink(friendlyUrl);
                    //    RefreshFriendly.BindataSiteUrl();
                    //}
                    //catch { }
                }
                else
                {
                    var video = videosBusiness.GetById(id);
                    video.VideoName = VideoName;
                    if (!String.IsNullOrEmpty(VideoUrl))
                    {
                        video.VideoUrl = VideoUrl;
                    }
                    else
                    {
                        video.VideoUrl = Function.ConvertFileName(VideoName);
                    }
                    video.VideoLink       = VideoLink;
                    video.VideoDecription = Description;
                    video.SeoTitle        = SeoTitle;
                    video.SeoKeyword      = SeoKeyword;
                    video.SeoDescription  = SeoDescription;
                    videosBusiness.Edit(video);

                    //try
                    //{
                    //    string linkcu = "";

                    //    if (VideoNamecu != video.VideoUrl)
                    //    {
                    //        linkcu = Function.ConvertUrlString(VideoNamecu);

                    //    }
                    //    else
                    //    {
                    //        linkcu = "";
                    //    }
                    //    Random rnd = new Random();
                    //    int ngaunhien = rnd.Next(1, 100);
                    //    friendlyUrl.ItemId = video.Id;
                    //    friendlyUrl.Link = video.VideoUrl;
                    //    friendlyUrl.ControllerName = "Videos";
                    //    friendlyUrl.ActionName = "VideoDetail";

                    //    friendlyUrl.NameLink = video.VideoUrl +ngaunhien.ToString();
                    //    friendlyUrl.NameSpaces = "BuyGroup365.Controllers";
                    //    friendlyUrl.Order = 0;

                    //    _friendlyUrlBusines.UpdateLink(linkcu, friendlyUrl);
                    //    RefreshFriendly.BindataSiteUrl();
                    //}
                    //catch { }
                }
                Response.Redirect("/Manage/Videos/Index");
            }
            catch (Exception ex)
            {
                Response.Redirect("/Manage/Videos/Index");
            }
            return(View());
        }
コード例 #5
0
ファイル: TagsController.cs プロジェクト: chiennd0705/MyPham
        public ActionResult Update(long id, string btnSubmit, string TagName, string TagUrl, int Type, string Description, string SeoTitle, string SeoKeyword, string SeoDescription, string TagNamecu, string ShareTitle, string ShareKeyword, string ShareDescription, string ImageSource)
        {
            try
            {
                Common.FriendlyUrl friendlyUrl = new Common.FriendlyUrl();
                string             friendly    = "";
                if (btnSubmit == "Thêm")
                {
                    Tag tag = new Tag();
                    tag.TagName = TagName;

                    tag.TagUrl = friendly;

                    tag.Description      = Description;
                    tag.SeoTitle         = SeoTitle;
                    tag.SeoKeyword       = SeoKeyword;
                    tag.SeoDescription   = SeoDescription;
                    tag.ShareTitle       = ShareTitle;
                    tag.ShareKeyword     = ShareKeyword;
                    tag.ShareDescription = ShareDescription;
                    tag.Type             = Type;
                    tag.DateCreate       = DateTime.Now;
                    tag.ModifyDate       = DateTime.Now;

                    if (ImageSource != "")
                    {
                        tag.ImageSource = ImageSource;
                    }

                    try
                    {
                        Random rnd       = new Random();
                        int    ngaunhien = rnd.Next(1, 100);

                        if (tag.Type == 1)
                        {
                            friendlyUrl.ControllerName = "Home";
                            friendlyUrl.ActionName     = "Tags";
                            friendly = "san-pham/" + Function.ConvertFileName(TagName) + duoilink;
                        }
                        if (tag.Type == 2)
                        {
                            friendlyUrl.ControllerName = "News";
                            friendlyUrl.ActionName     = "Tags";
                            friendly = "tin-tuc/" + Function.ConvertFileName(TagName) + duoilink;
                        }
                        if (tag.Type == 3)
                        {
                            friendlyUrl.ControllerName = "News";
                            friendlyUrl.ActionName     = "author";
                            friendly = "author/" + Function.ConvertFileName(TagName) + duoilink;
                        }
                        tag.TagUrl = friendly;
                        tagsBusiness.AddNew(tag);

                        friendlyUrl.ItemId     = tag.Id;
                        friendlyUrl.Link       = friendly;
                        friendlyUrl.NameLink   = friendly + ngaunhien.ToString();
                        friendlyUrl.NameSpaces = "BuyGroup365.Controllers";
                        friendlyUrl.Order      = 0;

                        _friendlyUrlBusines.InsertLink(friendlyUrl);
                        RefreshFriendly.BindataSiteUrl();
                    }
                    catch { }
                }
                else
                {
                    var tag = tagsBusiness.GetById(id);
                    tag.TagName = TagName;

                    friendly             = Function.ConvertFileName(TagName) + duoilink;
                    tag.TagUrl           = friendly;
                    tag.Description      = Description;
                    tag.SeoTitle         = SeoTitle;
                    tag.SeoKeyword       = SeoKeyword;
                    tag.SeoDescription   = SeoDescription;
                    tag.ShareTitle       = ShareTitle;
                    tag.ShareKeyword     = ShareKeyword;
                    tag.ShareDescription = ShareDescription;
                    tag.Type             = Type;
                    if (ImageSource != "")
                    {
                        tag.ImageSource = ImageSource;
                    }
                    tag.ModifyDate = DateTime.Now;

                    try
                    {
                        string linkcu = "";

                        if (TagNamecu != friendly)
                        {
                            linkcu = Function.ConvertUrlString(TagNamecu);
                        }
                        else
                        {
                            linkcu = "";
                        }
                        Random rnd       = new Random();
                        int    ngaunhien = rnd.Next(1, 100);
                        friendlyUrl.ItemId = tag.Id;

                        if (tag.Type == 1)
                        {
                            friendlyUrl.ControllerName = "Home";
                            friendlyUrl.ActionName     = "Tags";
                            friendly = "san-pham/" + Function.ConvertFileName(TagName) + duoilink;
                        }
                        if (tag.Type == 2)
                        {
                            friendlyUrl.ControllerName = "News";
                            friendlyUrl.ActionName     = "Tags";
                            friendly = "tin-tuc/" + Function.ConvertFileName(TagName) + duoilink;
                        }
                        if (tag.Type == 3)
                        {
                            friendlyUrl.ControllerName = "News";
                            friendlyUrl.ActionName     = "Author";
                            friendly = "author/" + Function.ConvertFileName(TagName) + duoilink;
                        }
                        friendlyUrl.Link       = friendly;
                        tag.TagUrl             = friendly;
                        friendlyUrl.NameLink   = friendly + ngaunhien.ToString();
                        friendlyUrl.NameSpaces = "BuyGroup365.Controllers";
                        friendlyUrl.Order      = 0;

                        _friendlyUrlBusines.UpdateLink(linkcu, friendlyUrl);
                        RefreshFriendly.BindataSiteUrl();
                    }
                    catch { }
                    tagsBusiness.Edit(tag);
                }
                Response.Redirect("/Manage/Tags/Index");
            }
            catch (Exception ex)
            {
                Response.Redirect("/Manage/Tags/Index");
            }
            return(View());
        }
コード例 #6
0
        public ActionResult CreateCate(string categoryname, HttpPostedFileBase icon, HttpPostedFileBase Banner, int statusCatg, int?PromotionListID, int parent, string seoTitle, string seoKeyword, string seoDescription, string description, string ShareTitle, string ShareKeyword, string ShareDescription, string ImageSource)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    CatalogsBusiness catalogsBusiness = new CatalogsBusiness();
                    string           friendly         = "";
                    Random           rd  = new Random();
                    Catalog          obj = new Catalog();
                    // obj.FriendlyUrl = Function.ConvertFileName(categoryname);
                    string friendlyCata = "";
                    if (parent != -1)
                    {
                        var dbCatalogSub = catalogsBusiness.GetById(parent);
                        friendlyCata = dbCatalogSub.FriendlyUrl.Replace(".html", "") + "/";
                    }
                    friendly        = friendlyCata + Function.ConvertFileName(categoryname) + duoilink;
                    obj.FriendlyUrl = friendly;
                    obj.ParentId    = parent;
                    obj.Status      = statusCatg;
                    obj.CatalogName = categoryname;
                    obj.Code        = rd.Next(100000, 999999).ToString();
                    if (icon != null && icon.ContentLength > 0)
                    {
                        // TourInfo entity=new TourInfo();
                        //Random rdImage = new Random();
                        string randomImage = Guid.NewGuid().ToString();
                        //string fileNameImage = Common.util.Function.ConvertFileName(icon.FileName);
                        string pathImage   = HttpContext.Server.MapPath("~/FileUpload");
                        var    strurlimage = Common.util.Function.ResizeImageNew(icon, 300, 300, pathImage, randomImage);
                        Common.util.Function.ResizeImageNew(icon, 500, 500, pathImage, randomImage);
                        Common.util.Function.ResizeImageNew(icon, 1000, 1000, pathImage, randomImage);
                        //  Common.util.Function.ReSizeImage(pathImage, fileNameImage, randomImage, 1000, 1000, icon);
                        obj.Icon = strurlimage;
                    }
                    if (Banner != null && Banner.ContentLength > 0)
                    {
                        // TourInfo entity=new TourInfo();
                        //Random rdImage = new Random();
                        string randomImage = Guid.NewGuid().ToString();
                        //string fileNameImage = Common.util.Function.ConvertFileName(icon.FileName);
                        string pathImage   = HttpContext.Server.MapPath("~/FileUpload");
                        var    strurlimage = Common.util.Function.ResizeImageNew(Banner, 1500, 1500, pathImage, randomImage);
                        //Common.util.Function.ResizeImageNew(Banner, 500, 500, pathImage, randomImage);
                        //Common.util.Function.ResizeImageNew(Banner, 1000, 1000, pathImage, randomImage);
                        //  Common.util.Function.ReSizeImage(pathImage, fileNameImage, randomImage, 1000, 1000, icon);
                        obj.Banner = strurlimage;
                    }
                    if (ImageSource != "")
                    {
                        obj.ImageSource = ImageSource;
                    }
                    obj.SeoKeyword       = seoKeyword;
                    obj.SeoTitle         = seoTitle;
                    obj.SeoDescription   = seoDescription;
                    obj.ShareTitle       = ShareTitle;
                    obj.ShareKeyword     = ShareKeyword;
                    obj.ShareDescription = ShareDescription;
                    obj.Description      = description;
                    //obj.PromotionID = PromotionListID;

                    long Catalogid;
                    _catalogsBusiness.AddNew(obj);
                    Catalogid = obj.Id;
                    try
                    {
                        Common.FriendlyUrl friendlyUrl = new Common.FriendlyUrl();
                        Random             rnd         = new Random();
                        int ngaunhien = rnd.Next(1, 100);
                        friendlyUrl.ItemId         = Catalogid;
                        friendlyUrl.Link           = friendly;
                        friendlyUrl.ControllerName = "Home";
                        friendlyUrl.ActionName     = "Category";
                        friendlyUrl.NameLink       = friendly + ngaunhien.ToString();
                        friendlyUrl.NameSpaces     = "BuyGroup365.Controllers";
                        friendlyUrl.Order          = 0;

                        _friendlyUrlBusines.InsertLink(friendlyUrl);
                        RefreshFriendly.BindataSiteUrl();
                    }
                    catch { }
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Tạo mới không thành công");
                    return(View());
                }
            }
            catch (Exception ex)
            {
                //witrelog
                throw;
            }
        }
コード例 #7
0
        public ActionResult UpdateCatalog(Common.Catalog viewCatalog, long parent, long?PromotionListID, string FriendlyHD, HttpPostedFileBase Icon, HttpPostedFileBase Banner, string ImageSource)
        {
            try
            {
                string           friendly         = "";
                CatalogsBusiness catalogsBusiness = new CatalogsBusiness();
                var dbCatalog = catalogsBusiness.GetById(viewCatalog.Id);
                dbCatalog.ParentId    = parent;
                dbCatalog.Code        = viewCatalog.Code;
                dbCatalog.CatalogName = viewCatalog.CatalogName;

                string friendlyCata = "";
                if (dbCatalog.ParentId != -1)
                {
                    var dbCatalogSub = catalogsBusiness.GetById(dbCatalog.ParentId);
                    friendlyCata = dbCatalogSub.FriendlyUrl.Replace(".html", "") + "/";
                }
                friendly = friendlyCata + Function.ConvertFileName(viewCatalog.CatalogName) + duoilink;

                dbCatalog.FriendlyUrl = friendly;
                if (Icon != null && Icon.ContentLength > 0)
                {
                    // TourInfo entity=new TourInfo();
                    //Random rdImage = new Random();
                    string randomImage = Guid.NewGuid().ToString();
                    //string fileNameImage = Common.util.Function.ConvertFileName(icon.FileName);
                    string pathImage   = HttpContext.Server.MapPath("~/FileUpload");
                    var    strurlimage = Common.util.Function.ResizeImageNew(Icon, 300, 300, pathImage, randomImage);
                    Common.util.Function.ResizeImageNew(Icon, 500, 500, pathImage, randomImage);
                    Common.util.Function.ResizeImageNew(Icon, 1000, 1000, pathImage, randomImage);
                    //  Common.util.Function.ReSizeImage(pathImage, fileNameImage, randomImage, 1000, 1000, icon);
                    dbCatalog.Icon = strurlimage;
                }
                if (Banner != null && Banner.ContentLength > 0)
                {
                    // TourInfo entity=new TourInfo();
                    //Random rdImage = new Random();
                    string randomImage = Guid.NewGuid().ToString();
                    //string fileNameImage = Common.util.Function.ConvertFileName(icon.FileName);
                    string pathImage   = HttpContext.Server.MapPath("~/FileUpload");
                    var    strurlimage = Common.util.Function.ResizeImageNew(Banner, 1500, 1500, pathImage, randomImage);
                    //Common.util.Function.ResizeImageNew(Banner, 500, 500, pathImage, randomImage);
                    //Common.util.Function.ResizeImageNew(Banner, 1000, 1000, pathImage, randomImage);
                    //  Common.util.Function.ReSizeImage(pathImage, fileNameImage, randomImage, 1000, 1000, icon);
                    dbCatalog.Banner = strurlimage;
                }
                if (ImageSource != "")
                {
                    dbCatalog.ImageSource = ImageSource;
                }
                dbCatalog.Description = viewCatalog.Description;
                dbCatalog.Order       = viewCatalog.Order;
                dbCatalog.Status      = viewCatalog.Status;
                //dbCatalog.PromotionID = PromotionListID;
                dbCatalog.IsLast           = viewCatalog.IsLast;
                dbCatalog.SeoTitle         = viewCatalog.SeoTitle;
                dbCatalog.SeoKeyword       = viewCatalog.SeoKeyword;
                dbCatalog.SeoDescription   = viewCatalog.SeoDescription;
                dbCatalog.ShareTitle       = viewCatalog.ShareTitle;
                dbCatalog.ShareKeyword     = viewCatalog.ShareKeyword;
                dbCatalog.ShareDescription = viewCatalog.ShareDescription;

                catalogsBusiness.Edit(dbCatalog);

                try
                {
                    Common.FriendlyUrl friendlyUrl = new Common.FriendlyUrl();
                    Random             rnd         = new Random();
                    int    ngaunhien = rnd.Next(1, 100);
                    string linkcu    = "";

                    if (FriendlyHD != friendly)
                    {
                        linkcu = FriendlyHD;
                    }
                    else
                    {
                        linkcu = "";
                    }
                    friendlyUrl.ItemId         = viewCatalog.Id;
                    friendlyUrl.Link           = friendly;
                    friendlyUrl.ControllerName = "Home";
                    friendlyUrl.ActionName     = "Category";
                    friendlyUrl.NameLink       = friendly + ngaunhien;
                    friendlyUrl.NameSpaces     = "BuyGroup365.Controllers";
                    friendlyUrl.Order          = 0;

                    _friendlyUrlBusines.UpdateLink(linkcu, friendlyUrl);
                    RefreshFriendly.BindataSiteUrl();
                }
                catch { }
                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                throw;
            }
        }