コード例 #1
0
        // GET: Category
        public ActionResult Index(string ID = "")
        {
            List <Post> L_posts = new List <Post>();

            L_posts = new Post().GetAll();
            if (ID != "")
            {
                L_posts = new Post().GetAll().Where(x => x.Post_CategoryID == Funtions.ContainItemInListReturnItemID(ID, x.Post_CategoryID)).ToList();
            }
            return(View(L_posts));
        }
コード例 #2
0
ファイル: ToursController.cs プロジェクト: huysunfa/Autravel2
        public ActionResult GridData(int Tour_Active = 2)
        {
            var data = SqlModule.GetDataTable($"SELECT  * FROM VTour where {Tour_Active} in (Tour_Active,2)");

            data.Columns.Add("Tour_StarRateHTML");
            foreach (DataRow item in data.Rows)
            {
                float.TryParse(item["Tour_StarRate"].ToString(), out float star);
                item["Tour_StarRateHTML"] = Funtions.FillStar(star);
            }
            var json = ToJson(data);

            return(JsonMax(new { result = "Success", data = json }));
        }
コード例 #3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (File.Exists(valider))
            {
                var  dll  = Assembly.LoadFile(valider);
                Type type = dll.GetType("Config.Valider");
                var  d    = type.InvokeMember("Do", BindingFlags.DeclaredOnly |
                                              BindingFlags.Public | BindingFlags.Static | BindingFlags.InvokeMethod, null, null, null);
                if (!Convert.ToBoolean(d))
                {
                    MessageBox.Show("程序已过期,请联系开发公司...");
                    App.Current.Shutdown();
                }
            }

            if (!Funtions.CheckfirstInstance())
            {
                MessageBox.Show("已经启动了一个程序。");
                return;
            }

            SplashWindow appSplash = new SplashWindow();

            appSplash.Show();
            appSplash.Completed += () =>
            {
                Thread.Sleep(100);
                if (main == null)
                {
                    main = new MainWindow();
                    appSplash.Close();
                    main.Show();
                }
                else
                {
                    if (!main.reloadtimer.Enabled)
                    {
                        main.reloadtimer.Start();
                    }
                    if (!main.marqueetimer.Enabled)
                    {
                        main.marqueetimer.Start();
                    }
                }
            };

            base.OnStartup(e);
        }
コード例 #4
0
        public ActionResult UpdateTour(FormCollection fc)
        {
            if (fc["Post_id"].Trim() != null && fc["Post_id"].Trim() != "0")
            {
                Models.Tour TourOld = new Tour().GetByTourID(Convert.ToInt32(fc["Post_id"].Trim()));
                TourOld.Tour_Name               = fc["Post_Tile"].Trim();
                TourOld.Tour_Content            = fc["editor"].Trim();
                TourOld.Tour_OrganizationalUnit = fc["Tour_OrganizationalUnit"].Trim();
                string Description = "";
                if (Funtions.StripHTML(fc["editor"].Trim()).Length > 200)
                {
                    Description = Funtions.StripHTML(fc["editor"].Trim());
                }
                else
                {
                    Description = Funtions.StripHTML(fc["editor"].Trim());
                }
                TourOld.Tour_Description   = Description;
                TourOld.Tour_Topic         = fc.ToString("tour_Topic");
                TourOld.Tour_Location      = fc.ToInt("Tour_Location");
                TourOld.Tour_Price         = fc.ToInt("Tour_Price");
                TourOld.Tour_DepartureDate = Funtions.ddMMyyyy(fc["Tour_DepartureDate"].Trim());
                TourOld.Tour_TimeZone      = Convert.ToInt32(fc["Tour_TimeZone"].Trim());
                TourOld.Tour_Itinerary     = fc["editor_Tour_Itinerary"].Trim();
                TourOld.Tour_Schedule      = fc["editor_Tour_Schedule"].Trim();
                TourOld.Tour_Rules         = fc["editor_Tour_Rules"].Trim();
                TourOld.Tour_ListImage     = fc["List_Images_Combo"].Trim();
                TourOld.Tour_Image         = fc["_thumbnail_id"].Trim();
                TourOld.Product_ID         = 1;
                TourOld.UserCreate         = Convert.ToInt32(Session["User_ID"]);
                TourOld.Tour_StarRate      = fc.ToDouble("Star_Rating");
                TourOld.Tour_Qty           = fc.ToInt("Tour_Qty");
                TourOld.Tour_Score         = fc.ToFloat("Tour_Score");
                TourOld.Tour_Price         = fc.ToInt("Tour_Price");
                TourOld.Tour_PriceSale     = fc.ToInt("Tour_PriceSale");
                TourOld.Hotel_ID           = fc.ToInt("Hotel_ID");
                TourOld.Update();

                TempData["MessagePost"] = "Cập nhật Combo thành công";
                return(RedirectToAction("EditTour", "Manager", new { id = TourOld.Tour_ID }));
            }
            else
            {
                Models.Tour TourOld = new Tour();
                TourOld.Tour_Name               = fc["Post_Tile"].Trim();
                TourOld.Tour_Content            = fc["editor"].Trim();
                TourOld.Tour_OrganizationalUnit = fc["Tour_OrganizationalUnit"].Trim();
                string Description = "";
                if (Funtions.StripHTML(fc["editor"].Trim()).Length > 200)
                {
                    Description = Funtions.StripHTML(fc["editor"].Trim());
                }
                else
                {
                    Description = Funtions.StripHTML(fc["editor"].Trim());
                }
                TourOld.Tour_Description = Description;
                TourOld.Tour_Topic       = fc.ToString("tour_Topic");
                TourOld.Tour_Location    = fc.ToInt("Tour_Location");
                TourOld.Hotel_ID         = fc.ToInt("Hotel_ID");

                TourOld.Tour_DepartureDate = Funtions.ddMMyyyy(fc["Tour_DepartureDate"].Trim());
                TourOld.Tour_TimeZone      = fc.ToInt("Tour_TimeZone");
                TourOld.Tour_Itinerary     = fc["editor_Tour_Itinerary"].Trim();
                TourOld.Tour_Schedule      = fc["editor_Tour_Schedule"].Trim();
                TourOld.Tour_Rules         = fc["editor_Tour_Rules"].Trim();
                TourOld.Tour_ListImage     = fc["List_Images_Combo"].Trim();
                TourOld.Tour_Image         = fc["_thumbnail_id"].Trim();
                TourOld.Product_ID         = 1;
                TourOld.UserCreate         = Convert.ToInt32(Session["User_ID"]);
                TourOld.CreateDate         = DateTime.Now;
                TourOld.Tour_StarRate      = fc.ToDouble("Star_Rating");
                TourOld.Tour_Qty           = fc.ToInt("Tour_Qty");
                TourOld.Tour_Score         = fc.ToFloat("Tour_Score");
                TourOld.Tour_Price         = fc.ToInt("Tour_Price");
                TourOld.Tour_PriceSale     = fc.ToInt("Tour_PriceSale");
                int TourID = TourOld.Insert();

                TempData["MessagePost"] = "Thêm mới Combo thành công";
                return(RedirectToAction("EditTour", "Manager", new { id = TourID }));
            }
        }
コード例 #5
0
 public ActionResult UpdatePost(FormCollection fc)
 {
     if (fc["Post_id"].Trim() != null && fc["Post_id"].Trim() != "0")
     {
         Models.Post postOld = new Post().GetByID(Convert.ToInt32(fc["Post_id"].Trim()));
         postOld.Post_Title = fc["Post_Tile"].Trim();
         postOld.Post_Type  = Convert.ToInt32(fc["Post_Type"].Trim());
         //string Description = "";
         //if (Funtions.StripHTML(fc["editor"].Trim()).Length > 200)
         //{
         //    Description = Funtions.StripHTML(fc["editor"].Trim()).Substring(0, 200);
         //}
         //else { Description = Funtions.StripHTML(fc["editor"].Trim()); }
         postOld.Post_Description = fc["editor_Description"].Trim();;
         postOld.Post_Content     = fc["editor"].Trim();
         postOld.Post_UpdateDate  = DateTime.Now;
         postOld.Post_Images      = fc["_thumbnail_id"].Trim();
         postOld.Post_CategoryID  = (fc["post_category"] + "").Trim();
         postOld.Post_Location    = Convert.ToInt32(fc["tour_Location"].Trim());
         postOld.Post_Slug        = Funtions.ConvertTitleToURL(fc["Post_Tile"].Trim());
         postOld.Post_tag         = fc["Post_tag"].Trim();
         postOld.Post_UserID      = Convert.ToInt32(Session["User_ID"]);
         postOld.Update();
         TempData["MessagePost"] = "Cập nhật bài viết thành công";
         return(RedirectToAction("EditPost", "Manager", new { id = postOld.Post_id }));
     }
     else
     {
         Models.Post postNew = new Post();
         postNew.Post_Title = fc["Post_Tile"].Trim();
         postNew.Post_Type  = Convert.ToInt32(fc["Post_Type"].Trim());
         string Description = "";
         if (Funtions.StripHTML(fc["editor"].Trim()).Length > 200)
         {
             Description = Funtions.StripHTML(fc["editor"].Trim()).Substring(0, 200);
         }
         else
         {
             Description = Funtions.StripHTML(fc["editor"].Trim());
         }
         postNew.Post_Description = Description;
         postNew.Post_Content     = fc["editor"].Trim();
         postNew.Post_CreateDate  = DateTime.Now;
         postNew.Post_UpdateDate  = DateTime.Now;
         postNew.Post_Images      = fc["_thumbnail_id"].Trim();
         postNew.Post_CategoryID  = (fc["post_category"] + "").Trim();
         postNew.Post_Slug        = Funtions.ConvertTitleToURL(fc["Post_Tile"].Trim());
         postNew.Post_tag         = fc["Post_tag"].Trim();
         postNew.Post_UserID      = Convert.ToInt32(Session["User_ID"]);
         int idnew = postNew.Insert();
         if (idnew > 0)
         {
             TempData["MessagePost"] = "Đăng bài viết thành công";
             return(RedirectToAction("EditPost", "Manager", new { id = idnew }));
         }
         else
         {
             TempData["MessagePost"] = "Có lỗi xảy ra, vui lòng thử lại";
             return(RedirectToAction("AddPost", "Manager", new { id = 0 }));
         }
     }
 }