コード例 #1
0
ファイル: HomeController.cs プロジェクト: khangnv111/1400.vn
        public ActionResult ArticleHotPartial()
        {
            int Total = 0;
            var lst   = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(5, 0, "", 0, "", "", 1, 1, 5, out Total);

            return(PartialView(lst));
        }
コード例 #2
0
        public ActionResult ArticleOneCatePartial(string UrlRedirect, int?Page)
        {
            int RecordPerPage = 10;
            int curPage       = 1;

            if (Page != null)
            {
                curPage = (int)Page;
            }

            int Total = 0;
            var lst   = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(1000, 0, "", 0, UrlRedirect, "", -1, curPage, RecordPerPage, out Total);

            ViewBag.TotalRecord = Total;
            ViewBag.currentPage = curPage;

            int totalPage = 1;

            if (Total % RecordPerPage == 0)
            {
                totalPage = (int)(Total / RecordPerPage);
            }
            else
            {
                totalPage = (int)(Total / RecordPerPage + 1);
            }

            ViewBag.TotalPage   = totalPage;
            ViewBag.UrlRedirect = UrlRedirect;

            return(PartialView(lst));
        }
コード例 #3
0
        public ActionResult VideoImage()
        {
            int Total1 = 0;
            //var article = new Article();
            var article = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(1, 0, "", 9, "", "", -1, 1, 1, out Total1).FirstOrDefault();

            ViewBag.Article = article;
            NoMark rw = new NoMark();

            if (article != null)
            {
                var rewrite = rw.ReWrite(article.Title, article.ArticleID);
                ViewBag.rewrite = rewrite;
            }

            int Total2 = 0;
            //var list_video = new List<Article>();
            var list_video = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(4, 0, "", 11, "", "", -1, 1, 4, out Total2);

            ViewBag.list_video = list_video;

            int Total3 = 0;
            //var list_album = new List<Article>();
            var list_album = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(4, 0, "", 10, "", "", -1, 1, 4, out Total3);

            ViewBag.list_album = list_album;

            return(View());
        }
コード例 #4
0
        public ActionResult MessageHistoryPartial(string Keyword, int CurrentPage)
        {
            int      RecordPerPage = 5;
            int      Total         = 0;
            DateTime start         = DateTime.Now;
            var      list          = AbstractDAOFactory.Instance().CreateMessageDAO().SP_Get_MO(Keyword, CurrentPage, RecordPerPage, out Total);
            DateTime end           = DateTime.Now;
            TimeSpan t             = end - start;
            int      s             = t.Seconds;

            NLogLogger.LogInfo("thoi gian call db =" + s.ToString());
            ViewBag.TotalRecord = Total;
            ViewBag.currentPage = CurrentPage;

            int totalPage = 1;

            if (Total % RecordPerPage == 0)
            {
                totalPage = (int)(Total / RecordPerPage);
            }
            else
            {
                totalPage = (int)(Total / RecordPerPage + 1);
            }

            ViewBag.TotalPage = totalPage;

            return(PartialView(list));
        }
コード例 #5
0
        public ActionResult ProgramPassPartial(int Year)
        {
            int Total = 0;
            var list  = AbstractDAOFactory.Instance().CreateProgramDAO().SP_Event_OldGetList_Web(0, "", -1, Year, 1, 1000, out Total);

            return(PartialView(list));
        }
コード例 #6
0
        public ActionResult SendSuggest(string Email, string Mobile, string Content)
        {
            int Result = 0;

            AbstractDAOFactory.Instance().CreateSuggestDAO().SP_Suggestion_Create(Email, Mobile, Content, out Result);
            return(Json(new { success = Result }));
        }
コード例 #7
0
        // GET: Program
        public ActionResult ProgramProcess()
        {
            int Total = 0;
            var list  = AbstractDAOFactory.Instance().CreateProgramDAO().SP_Event_GetList_Web(0, "", -1, 1, 1000, out Total);

            return(View(list));
        }
コード例 #8
0
        // GET: Article
        public ActionResult Index(string UrlRewrite, int?Page)
        {
            int curPage = 1;

            if (Page != null)
            {
                curPage = (int)Page;
            }
            int Total   = 0;
            var lst     = new List <Article>();
            var article = new Article();

            ViewBag.CateName = "";
            lst = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(10, 0, "", 0, UrlRewrite, "", -1, curPage, 10, out Total);
            if (lst != null && lst.Count > 0)
            {
                article = lst[0];
            }
            else
            {
                article = null;
            }
            var lst_menu = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Menu_GetByUrlRedirect(UrlRewrite);

            if (lst_menu != null && lst_menu.Count > 0)
            {
                ViewBag.CateName = lst_menu[0].MenuName;
            }
            ViewBag.Article     = article;
            ViewBag.UrlRedirect = UrlRewrite;

            return(View(lst));
        }
コード例 #9
0
ファイル: TintucController.cs プロジェクト: jonypan/TestGit2
 public override ActionResult CreateRewrite(ArticleDetail article)
 {
     try
     {
         if (ModelState.IsValid)
         {
             article.Status = 1;
             if (AbstractDAOFactory.Instance().CreateArticleDao().Article_Edit(1, SessionHelper.getAdminSession().userID, article) > 0) //category.Name,category.MetaTitle,(category.ParentID == null ? 0 : (int)category.ParentID.Value
             {
                 return(RedirectToAction("Index"));
             }
             else
             {
                 ModelState.AddModelError("", "Lỗi hệ thống!");
                 return(View(article));
             }
         }
         ModelState.AddModelError("", "Có lỗi!");
         return(View(article));
     }
     catch
     {
         return(View());
     }
 }
コード例 #10
0
 public override ActionResult DeleteRewrite(ProductDetail product)
 {
     try
     {
         product.PublicTime = DateTime.Now;
         if (ModelState.IsValid)
         {
             if (AbstractDAOFactory.Instance().CreateProductDao().Product_Edit(3, SessionHelper.getAdminSession().userID, product) > 0) //category.Name,category.MetaTitle,(category.ParentID == null ? 0 : (int)category.ParentID.Value
             {
                 return(RedirectToAction("Index"));
             }
             else
             {
                 ModelState.AddModelError("", "Lỗi hệ thống!");
                 return(RedirectToAction("Index"));
             }
         }
         ModelState.AddModelError("", "Có lỗi!");
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(RedirectToAction("Index"));
     }
 }
コード例 #11
0
        public ActionResult Create()
        {
            var listCate = AbstractDAOFactory.Instance().CreateCommonDao().GetCate(SessionHelper.getLanguageSession());

            ViewBag.listCate = listCate;
            return(View());
        }
コード例 #12
0
        // POST: Admin/Category/Edit/5

        public override ActionResult EditRewrite(ProductDetail product)
        {
            try
            {
                var listCate = AbstractDAOFactory.Instance().CreateCommonDao().GetCate(SessionHelper.getLanguageSession());
                ViewBag.listCate = listCate;
                if (ModelState.IsValid)
                {
                    if (AbstractDAOFactory.Instance().CreateProductDao().Product_Edit(2, SessionHelper.getAdminSession().userID, product) > 0)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Lỗi hệ thống!");
                        return(View(product));
                    }
                }
                ModelState.AddModelError("", "Có lỗi!");
                return(View(product));
            }
            catch
            {
                return(View());
            }
        }
コード例 #13
0
        public ActionResult MenuPartial()
        {
            int Total = 0;
            var lst   = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Menu_GetList("", 1, 1, out Total);

            return(PartialView(lst));
        }
コード例 #14
0
        public ActionResult ArticleSearch(string keyword, int CurrentPage)
        {
            int RecordPerPage = 10;
            int Total         = 0;
            var lst           = new List <Article>();
            var article       = new Article();

            lst = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(10000, 0, keyword, 0, "", "", -1, CurrentPage, RecordPerPage, out Total);

            ViewBag.TotalRecord = Total;
            ViewBag.currentPage = CurrentPage;

            int totalPage = 1;

            if (Total % RecordPerPage == 0)
            {
                totalPage = (int)(Total / RecordPerPage);
            }
            else
            {
                totalPage = (int)(Total / RecordPerPage + 1);
            }
            ViewBag.TotalPage = totalPage;

            return(PartialView(lst));
        }
コード例 #15
0
ファイル: TintucController.cs プロジェクト: jonypan/TestGit2
        // GET: Admin/Category/Edit/5
        public ActionResult Edit(int id)
        {
            ArticleDetail article  = AbstractDAOFactory.Instance().CreateArticleDao().GetArticleDetail(id);
            var           listCate = AbstractDAOFactory.Instance().CreateCommonDao().GetCate(SessionHelper.getLanguageSession());

            ViewBag.listCate = listCate;
            return(View(article));
        }
コード例 #16
0
        public ActionResult Sanphamen(int page = 1, int pageSize = 10)
        {
            SessionHelper.setLanguageSession("en");
            int totalPage   = 0;
            var listArticle = AbstractDAOFactory.Instance().CreateProductDao().GetCMSListProduct(SessionHelper.getLanguageSession(), 1, 1000, out totalPage);

            return(View(listArticle.ToPagedList(page, pageSize)));
        }
コード例 #17
0
        // GET: Admin/Category/Edit/5
        public ActionResult Edit(int id)
        {
            ProductDetail product  = AbstractDAOFactory.Instance().CreateProductDao().GetProductDetail(id);
            var           listCate = AbstractDAOFactory.Instance().CreateCommonDao().GetCate(SessionHelper.getLanguageSession());

            ViewBag.listCate = listCate;
            return(View(product));
        }
コード例 #18
0
ファイル: TintucController.cs プロジェクト: jonypan/TestGit2
        public ActionResult Tintucvn(int page = 1, int pageSize = 10)
        {
            SessionHelper.setLanguageSession("vi");
            int totalPage   = 0;
            var listArticle = AbstractDAOFactory.Instance().CreateArticleDao().Article_CMS_List(SessionHelper.getLanguageSession(), 1, 1000, out totalPage);

            return(View(listArticle.ToPagedList(page, pageSize)));
        }
コード例 #19
0
        public JsonResult Login(string Username, string Password)
        {
            try
            {
                NLogLogger.LogInfo("Login-->Username:"******"Dữ liệu không được bỏ trống" }));
                }
                var password = Encrypt.Md5(Password.Trim());

                int checkLogin = AbstractDAOFactory.Instance().CreateUsersDAO().Authentication(Username.Trim(), password);
                if (checkLogin == -49)
                {
                    return(Json(new { success = false, statusCode = -102, msg = "Tài khoản của bạn đã bị block" }));
                }
                else if (checkLogin == -50)
                {
                    return(Json(new { success = false, statusCode = -102, msg = "Tài khoản của bạn chưa được cấp quyền" }));
                }
                else if (checkLogin == -53)
                {
                    return(Json(new { success = false, statusCode = -102, msg = "Mật khẩu không chính xác" }));
                }
                else if (checkLogin > 0)
                {
                    var m_Users = AbstractDAOFactory.Instance().CreateUsersDAO().GetByUsername(Username);
                    if (m_Users != null && m_Users.UserID > 0)
                    {
                        var Log = new UsersLog();
                        Log.ClientIP     = Config.GetIP();
                        Log.FunctionID   = 9999;
                        Log.UserID       = m_Users.UserID;
                        Log.LogType      = 1;
                        Log.FunctionName = "Đăng Nhập Hệ Thống";
                        Log.Description  = "Tài khoản " + m_Users.Username + " Đăng nhập hệ thống";
                        var insertLog = AbstractDAOFactory.Instance().CreateUsersLogDAO().InsertUsersLog(Log);

                        if (m_Users.Status)
                        {
                            Session["LoginType"] = 1;
                            string SessionID = Session.SessionID;
                            m_UserValidation.SignIn(m_Users.UserID, m_Users.Username, m_Users.IsAdministrator, SessionID);
                            var UrlRedirect = Config.UrlRoot; // Session["Redirect_Uri"] == null ? Config.UrlRoot : Server.UrlDecode(Session["Redirect_Uri"].ToString());
                            NLogLogger.LogInfo("UrlRedirect : " + UrlRedirect);
                            return(Json(new { success = true, statusCode = 1, msg = "Đăng Nhập Thành Công", url = UrlRedirect }));
                        }
                        return(Json(new { success = false, statusCode = -102, msg = "Tài khoản của bạn đã bị block" }));
                    }
                }
                return(Json(new { success = false, statusCode = -1, msg = "Username hoặc Password không đúng" }));
            }
            catch (Exception ex)
            {
                NLogLogger.PublishException(ex);
                return(Json(new { success = false, statusCode = -99, msg = "Hệ thống bận vui lòng quay lại sau" }));
            }
        }
コード例 #20
0
        public BigJackpotInfo GetBigJackpotInfo()
        {
            var bigJackpotInfo = (BigJackpotInfo)CacheHandler.Get("minipoker_BigJackpotInfo");

            if (bigJackpotInfo == null)
            {
                bigJackpotInfo = AbstractDAOFactory.Instance().CreateMiniPokerBigJackpotDAO().GetBigJackpotInfo();
                CacheHandler.Add("minipoker_BigJackpotInfo", bigJackpotInfo, 10);
            }
            return(bigJackpotInfo);
        }
コード例 #21
0
        public List <BigJackpotHistory> GetBigJackpotHistory()
        {
            List <BigJackpotHistory> bigJackpotHis = (List <BigJackpotHistory>)CacheHandler.Get("minipoker_BigJackpotHis");

            if (bigJackpotHis == null)
            {
                bigJackpotHis = AbstractDAOFactory.Instance().CreateMiniPokerBigJackpotDAO().GetBigJackpotHistory();
                CacheHandler.Add("minipoker_BigJackpotHis", bigJackpotHis, 30);
            }
            return(bigJackpotHis);
        }
コード例 #22
0
        protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                var account = new VTCeBank.SSO.Utils.Account(Request);
                NLogLogger.LogInfo("account.AccountName: " + account.AccountName);

                if (string.IsNullOrEmpty(account.AccountName))
                {
                    // Response.Redirect(SSOMAIL.SsoHelper.URLLoginMail);
                }
                else
                {
                    var pos = account.AccountName.IndexOf("@");
                    if (pos > 0)
                    {
                        account.AccountName = account.AccountName.Substring(0, pos);
                    }
                    var m_Users = AbstractDAOFactory.Instance().CreateUsersDAO().GetByUsername(account.AccountName);
                    if (m_Users != null && m_Users.UserID > 0)
                    {
                        var Log = new UsersLog();
                        Log.FunctionID   = 9999;
                        Log.ClientIP     = Config.GetIP();
                        Log.UserID       = m_Users.UserID;
                        Log.LogType      = 1;
                        Log.FunctionName = "Đăng Nhập Hệ Thống";
                        Log.Description  = "Tài khoản " + m_Users.Username + " Đăng nhập hệ thống";
                        var insertLog = AbstractDAOFactory.Instance().CreateUsersLogDAO().InsertUsersLog(Log);

                        if (m_Users.Status)
                        {
                            //Session[SessionsManager.SESSION_USERID] = m_Users.UserID;
                            //Session[SessionsManager.SESSION_USERNAME] = m_Users.Username;
                            //Session["LoginType"] = 0;
                            string SessionID = Session.SessionID;
                            m_UserValidation.SignIn(m_Users.UserID, m_Users.Username, m_Users.IsAdministrator, SessionID);
                            Url = Session["Redirect_Uri"] == null ? UrlRoot : Server.UrlDecode(Session["Redirect_Uri"].ToString());
                            Response.Redirect(Url);
                        }
                        Response.Redirect("Common/ErrorPermission");
                    }
                    Response.Redirect("Common/ErrorPermission");
                }
            }
            catch (Exception ex)
            {
                NLogLogger.PublishException(ex);
            }
            finally
            {
                Response.End();
            }
        }
コード例 #23
0
        public List <Notification> GetNotification()
        {
            List <Notification> cached = (List <Notification>)CacheHandler.Get("Notification");

            if (cached != null)
            {
                return(cached);
            }
            cached = AbstractDAOFactory.Instance().CreateGateDAO().GetNotification("");
            CacheHandler.Add("Notification", cached, 180);
            return(cached);
        }
コード例 #24
0
        public List <Jackpot> GetAllJackpot()
        {
            List <Jackpot> jackpotList = (List <Jackpot>)CacheHandler.Get("Jackpot_JackpotList");

            if (jackpotList == null)
            {
                jackpotList = AbstractDAOFactory.Instance().CreateJackpotDAO().GetAllJackpot();
                if (jackpotList != null)
                {
                    CacheHandler.Add("Jackpot_JackpotList", jackpotList, 5);
                }
            }
            return(jackpotList);
        }
コード例 #25
0
    /// <summary>
    /// Kiểm tra quyền theo chức năng truy cập -> nếu có quyền ? lưu session permission : return error
    /// </summary>
    /// <param name="fid"></param>
    /// <returns></returns>
    public bool CheckPermissionUser(string Action, int UserId, bool IsAdmin = false)
    {
        try
        {
            if (string.IsNullOrEmpty(Action))
            {
                return(false);
            }
            var m_function = AbstractDAOFactory.Instance().CreateFunctionDAO().
                             GetFunctionByActionName(Action);
            if (m_function == null || m_function.FunctionID <= 0)
            {
                return(false);
            }

            var permission = new UserFunction();
            //Nếu user là admin -> full quyền
            if (IsAdmin)
            {
                permission.FunctionID   = m_function.FunctionID;
                permission.FunctionName = m_function.FunctionName;
                permission.ActionName   = Action;
                permission.UserID       = UserId;
                permission.IsGrant      = true;
                permission.IsInsert     = true;
                permission.IsUpdate     = true;
                permission.IsDelete     = true;
            }
            else //Lấy quyền của user khi truy cập chức năng
            {
                permission = AbstractDAOFactory.Instance().CreateUserRoleDAO().
                             CheckPermission(UserId, Action);
            }

            if (permission == null || permission.FunctionID == 0)
            {
                HttpContext.Current.Session.Abandon();
                return(false);
            }
            HttpContext.Current.Session[SessionsManager.SESSION_PERMISSION] = permission;

            HttpContext.Current.Session[SessionsManager.SESSION_HISTORY] = permission.FunctionID;
            return(true);
        }
        catch (Exception ex)
        {
            NLogLogger.LogInfo(ex.ToString());
            return(false);
        }
    }
コード例 #26
0
        public ActionResult Detail(int id)
        {
            try
            {
                int result = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_AddView_Web(id);//Tăng view

                int Total = 0;
                var lst   = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(1, id, "", 0, "", "", -1, 1, 1, out Total);

                //truong hop la album anh
                if (lst[0].MenuID == 10)
                {
                    int TotalImg = 0;
                    var listimg  = AbstractDAOFactory.Instance().CreateCmsDAO().SP_ArticleImage_GetList(1000, 0, id, 1, 1, 1000, out TotalImg);
                    ViewBag.listimg = listimg;
                }
                //end

                ViewBag.Id      = id;
                ViewBag.Title   = "";
                ViewBag.Image   = "";
                ViewBag.Summary = "";
                ViewBag.Keyword = "";
                if (lst != null && lst.Count > 0)
                {
                    ViewBag.Title   = lst[0].Title;
                    ViewBag.Image   = lst[0].Image ?? "";
                    ViewBag.Summary = lst[0].Description;
                    ViewBag.Keyword = lst[0].Description;

                    if (!String.IsNullOrEmpty(lst[0].Detail))
                    {
                        lst[0].Detail = lst[0].Detail.Replace("<img ", "<img class=\"img-responsive\"");
                    }

                    return(View(lst[0]));
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            catch (Exception ex)
            {
                NLogLogger.LogInfo("ERROR in Article/Detail = " + ex.ToString());
                return(RedirectToAction("Index", "Home"));
            }
        }
コード例 #27
0
        public ActionResult ArticleAllPartial(string UrlRewrite_)
        {
            int Total   = 0;
            var lst     = new List <Article>();
            var article = new Article();

            if (UrlRewrite_ == "tin-tuc")
            {
                lst = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(10, 0, "", 5, "", "", -1, 1, 4, out Total);
            }
            else
            {
                lst = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(10, 0, "", 0, UrlRewrite_, "", -1, 1, 4, out Total);
            }
            return(PartialView(lst));
        }
コード例 #28
0
ファイル: HomeController.cs プロジェクト: khangnv111/1400.vn
        public ActionResult VideoPartial(int?menuId)
        {
            try
            {
                int MenuId = menuId == null ? 9 : (int)menuId;
                int Total  = 0;
                var lst    = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(4, 0, "", MenuId, "", "", -1, 1, 4, out Total);

                ViewBag.list = lst;
            }
            catch (Exception e)
            {
                W1400.Utility.NLogLogger.LogInfo("ERROR: " + e.ToString());
            }
            return(PartialView());
        }
コード例 #29
0
        public ActionResult ArticleHomePartial(int CateId)
        {
            int Total   = 0;
            var lst     = new List <Article>();
            var article = new Article();

            if (CateId == -1)
            {
                lst = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(10, 0, "", 5, "", "", -1, 1, 4, out Total);
            }
            else
            {
                lst = AbstractDAOFactory.Instance().CreateArticleDAO().SP_Article_GetList_Web(10, 0, "", CateId, "", "", -1, 1, 4, out Total);
            }
            return(PartialView(lst));
        }
コード例 #30
0
        public ActionResult DetailPartial(int EventID, string FromDate, string ToDate)
        {
            DateTime fromDateTime = !string.IsNullOrWhiteSpace(FromDate) ? DateTime.ParseExact(FromDate, "dd/MM/yyyy", CultureInfo.InvariantCulture) : DateTime.Now;
            DateTime toDateTime   = !string.IsNullOrWhiteSpace(ToDate)? DateTime.ParseExact(ToDate, "dd/MM/yyyy", CultureInfo.InvariantCulture): DateTime.Now;
            int      Total        = 0;
            var      List         = new List <ProgramReport>();

            List = AbstractDAOFactory.Instance().CreateProgramDAO().SP_Event_GetReport_Web(EventID, fromDateTime, toDateTime, out Total);
            if (List != null && List.Count > 0)
            {
                return(PartialView(List));
            }
            else
            {
                return(PartialView());
            }
        }