예제 #1
0
파일: Home.aspx.cs 프로젝트: nvc1406/lolArt
        private void Bind()
        {
            _lstExceptions = new List<LogException>();
            _lstFeedBacks = new List<FeedBack>();
            _listPostsWaitting = new List<Post>();
            LogExceptionController logController = new LogExceptionController();
            FeedBackController feedController = new FeedBackController();
            PostController postController = new PostController();

            var sDate = string.IsNullOrEmpty(_sTimeFeed) ? DateTime.MinValue : DateTime.Parse(_sTimeFeed);
            var eDate = string.IsNullOrEmpty(_eTimeFeed) ? DateTime.MinValue : DateTime.Parse(_eTimeFeed);
            _lstFeedBacks = feedController.GetAllByParam(_emailSearchFeedback, _statusFeedBack, sDate, eDate);
            _listPostsWaitting = postController.GetAllPostWaitting();
            _lstExceptions = logController.GetAllExceptionNotFixed();
        }
예제 #2
0
 public PostController()
 {
     IUnitOfWork unitOfWork = new UnitOfWork.UnitOfWork();
     _exceptionController = new LogExceptionController();
     _postResponsitory = new PostResponsitory(unitOfWork);
 }
예제 #3
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     context.Response.ContentEncoding = Encoding.UTF8;
     UserController user = new UserController();
     LogExceptionController logException = new LogExceptionController();
     ExtractQueryString extractQuery = new ExtractQueryString();
     try
     {
         string txtEmail = context.Request["txtEmail"].Trim();
         string txtPass = context.Request["txtPass"];
         string urlBuilder;
         if (Validate(txtEmail, txtPass))
         {
             var doLogin = user.DoLogin(txtEmail, txtPass);
             if (doLogin)
             {
                 var objUser = user.GetByEmail(txtEmail);
                 if (objUser.UserStatus == EnumKey.AccountBlocked)
                 {
                     urlBuilder = string.Format("status={0}&mail={1}", EnumKey.AccountBlocked,txtEmail);
                     var url =  extractQuery.EncyptionUrl("login.aspx", urlBuilder);
                     context.Response.Redirect(url, false);
                 }
                 else // Phần này cần check thêm quyền.
                 {
                     string perUrl = string.Empty;
                     context.Session["USER_LOGIN"] = objUser.UserId;
                     if (objUser.Role == EnumKey.Administrator) // nếu là admin
                     {
                         perUrl = "Home.aspx";
                     }
                     else if (objUser.Role == EnumKey.Moderator) // là Mod - ng quản lý
                     {
                         perUrl = "Home.aspx";
                     }
                     //urlBuilder = string.Format("status={0}&mail={1}", EnumKey.AccountBlocked, txtEmail);
                     var url = extractQuery.EncyptionUrl(perUrl, string.Empty);
                     context.Response.Redirect(url, false);
                 }
             }
             else
             {
                 urlBuilder = string.Format("status={0}&mail={1}", EnumKey.LoginFail,txtEmail);
                 var url = extractQuery.EncyptionUrl("login.aspx", urlBuilder);
                 context.Response.Redirect(url, false);
             }
         }
         else
         {
             urlBuilder = string.Format("status={0}&mail={1}", EnumKey.EmailFailure,txtEmail);
             var url = extractQuery.EncyptionUrl("login.aspx", urlBuilder);
             context.Response.Redirect(url, false);
         }
     }
     catch (Exception e)
     {
         var mes = GetType() + e.Message;
         logException.InsertException(new LogException { Exception = mes, Time = DateTime.Now });
         context.Response.Redirect("login.aspx",false);
     }
 }
예제 #4
0
 public CategoryController()
 {
     _unitOfWork = new UnitOfWork.UnitOfWork();
     _categoryResponsitory = new CategoryResponsitory(_unitOfWork);
     _logException = new LogExceptionController();
 }
예제 #5
0
 public PageDefaultController()
 {
     IUnitOfWork unitOfWork = new UnitOfWork.UnitOfWork();
     _pageDefaultResponsitory = new PageDefaultResponsitory(unitOfWork);
     _logException = new LogExceptionController();
 }
예제 #6
0
 public UserController()
 {
     _unitOfWork = new UnitOfWork.UnitOfWork();
     _userResponsitory = new UserResponsitory(_unitOfWork);
     _logException = new LogExceptionController();
 }