Ejemplo n.º 1
0
        /// <summary>
        ///  错误信息
        /// </summary>
        /// Author  : 俞立钢
        /// Company : 绍兴标点电子技术有限公司
        /// Created : 2014-10-27 14:17:41
        protected void Application_Error(object sender, EventArgs e)
        {
            string    msg;
            Exception exception = Server.GetLastError();

            Response.Clear();
            HttpException httpException = exception as HttpException;
            string        url           = "/Error/Index";

            if (httpException != null)
            {
                switch (httpException.GetHttpCode())
                {
                case 404:
                    url = "/Error/NoFound";
                    break;
                }
                Server.ClearError();
                msg = httpException.Message;
            }
            else
            {
                Server.ClearError();
                msg = exception.Message;
            }
            Log4Dao.InsertLog4(msg);
            Response.Write("<script>top.window.location.href='" + url + "'</script>");
        }
Ejemplo n.º 2
0
        public ActionResult SaveAdd(string newsMenuId, string newsType, string newsTitle, string httpUrl, string attachId, string indexImg, string attachContent1, string attachContent2, string attachContent3, string attachContent4, string content)
        {
            string status = "failue", msg = "保存失败!", json;

            try
            {
                NewsContents contents = new NewsContents();
                contents.Id         = CustomId.GetCustomId();
                contents.NewsMenuId = newsMenuId;
                contents.NewsTitle  = newsTitle;
                contents.NewsType   = newsType.StringToInt();
                switch (contents.NewsType)
                {
                case 2015014:
                    contents.AttachContent1 = attachContent1;
                    contents.AttachContent2 = attachContent2;
                    contents.AttachContent3 = attachContent3;
                    contents.AttachContent4 = attachContent4;
                    contents.IndexImg       = indexImg;
                    contents.NewsContent    = content;
                    break;

                case 2015015:
                    contents.HttpUrl = httpUrl;
                    break;

                case 2015016:
                    contents.AttachId = attachId;
                    break;
                }
                contents.RleaseTime = DateTime.Now;
                contents.NewsStatus = 2015009;//未通过审核
                int i = _newsContentsService.InsertNewsContents(contents);
                if (i > 0)
                {
                    status = "success";
                    msg    = "保存成功!";
                }
            }
            catch (Exception exception)
            {
                msg = "保存出错!";
                Log4Dao.InsertLog4(exception.Message);
            }
            json = PublicFunc.ModelToJson(status, msg);
            return(Content(json));
        }
Ejemplo n.º 3
0
        public ActionResult UpdateEdit(string hiddenId, string newsMenuId, string newsType, string newsTitle, string httpUrl, string attachId, string indexImg, string attachContent1, string attachContent2, string attachContent3, string attachContent4, string content)
        {
            string status = "failue", msg = "更新失败!", json;

            try
            {
                NewsContents contents = new NewsContents();
                contents.Id         = hiddenId;
                contents.NewsMenuId = newsMenuId;
                contents.NewsTitle  = newsTitle;
                contents.NewsType   = newsType.StringToInt();
                switch (contents.NewsType)
                {
                case 2015014:
                    contents.AttachContent1 = attachContent1;
                    contents.AttachContent2 = attachContent2;
                    contents.AttachContent3 = attachContent3;
                    contents.AttachContent4 = attachContent4;
                    contents.IndexImg       = indexImg;
                    contents.NewsContent    = content;
                    break;

                case 2015015:
                    contents.HttpUrl = httpUrl;
                    break;

                case 2015016:
                    contents.AttachId = attachId;
                    break;
                }
                int i = _newsContentsService.UpdateNewsContents(contents);
                if (i > 0)
                {
                    status = "success";
                    msg    = "更新成功!";
                }
            }
            catch (Exception exception)
            {
                msg = "更新出错!";
                Log4Dao.InsertLog4(exception.Message);
            }
            json = PublicFunc.ModelToJson(status, msg);
            return(Content(json));
        }
Ejemplo n.º 4
0
        /// <summary>
        ///  确认
        /// </summary>
        /// <param name="ids">操作的ID</param>
        /// <param name="verifyId">审核结果</param>
        /// Author  : Napoleon
        /// Created : 2015-06-25 11:13:01
        public ActionResult SureVerify(string ids, string verifyId)
        {
            string status = "failue", msg = "确认失败!", json;

            try
            {
                if (_newsContentsService.UpdateNewsVerify(ids, verifyId) > 0)
                {
                    status = "success";
                    msg    = "确认成功!";
                }
            }
            catch (Exception exception)
            {
                msg = "确认出错!";
                Log4Dao.InsertLog4(exception.Message);
            }
            json = PublicFunc.ModelToJson(status, msg);
            return(Content(json));
        }
Ejemplo n.º 5
0
        /// <summary>
        ///  根据ID删除数据
        /// </summary>
        /// Author  : Napoleon
        /// Created : 2015-06-24 15:59:36
        public ActionResult Delete(string ids)
        {
            string status = "failue", msg = "删除失败!", json;

            try
            {
                int i = _newsContentsService.DeleteNewsContents(ids);
                if (i > 0)
                {
                    status = "success";
                    msg    = "删除成功!";
                }
            }
            catch (Exception exception)
            {
                msg = "删除出错!";
                Log4Dao.InsertLog4(exception.Message);
            }
            json = PublicFunc.ModelToJson(status, msg);
            return(Content(json));
        }
Ejemplo n.º 6
0
        /// <summary>
        ///  验证用户信息
        /// </summary>
        /// Author  : Napoleon
        /// Created : 2015-06-06 16:29:44
        public ActionResult CheckUser(string userName, string passWord)
        {
            string status = "failue", msg, json;

            try
            {
                SystemUser user = _service.CheckUserXml(userName, passWord, PublicFields.ProjectId);
                if (user != null)
                {
                    user.WriteCookie(PublicFields.UserCookies);
                    //用户权限
                    SystemUserAndRule rule = _service.GetRuleXml(user.Id, PublicFields.ProjectId);
                    if (rule == null)
                    {
                        msg = "登录失败,该账号不能登录本系统!";
                    }
                    else
                    {
                        rule.RuleId.WriteCookie(PublicFields.RuleIdCookies);
                        status = "success";
                        msg    = "登录成功!";
                    }
                }
                else
                {
                    msg = "登录失败,账号或密码错误!";
                }
            }
            catch (Exception exception)
            {
                msg = "登录出错!";
                Log4Dao.InsertLog4(exception.Message);
            }
            json = PublicFunc.ModelToJson(status, msg);
            return(Content(json));
        }