コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.IsEdit = "0";
            this.CheckUrlKey();
            this.CheckKeyWord();

            string urlKey = this.GetQueryStr("urlKey");
            if (urlKey.IsNullOrEmpty() == false)
            {
                using (DBDataContext db = new DBDataContext(SqlHelper.DB_CONN_STRING))
                {
                    this.EditWord = db.KeyWordsLib.FirstOrDefault(x => x.UrlKey == urlKey);
                    if (this.EditWord != null) this.IsEdit = "1";
                }
            }
            if (this.EditWord == null)
            {
                Int64 nk = MACPrimaryKey.NewKey1;
                this.EditWord = new KeyWordsLib() { UrlKey = nk.ToString() };
            }

            if (!this.IsFormPost()) return;

            Response.Clear();
            Response.Write("<htm><body><script>parent.PostResult('" + this.PostProcess() + "');</script></body></htm>");
            Response.End();
        }
コード例 #2
0
ファイル: UILogs.aspx.cs プロジェクト: 470192616/JzSayGen
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.GetQueryStr("ajax").IsNullOrEmpty()) return;

            List<_Log> ldat = new List<_Log>();
            var curPageIndex = this.GetQueryInt32("page", 1);
            Int32 pSize = 30;
            using (DBDataContext db = new DBDataContext(SqlHelper.DB_CONN_STRING))
            {
                var sql = LinqWhereHelper.True<logsLib>();
                var tmp = db.logsLib.Where(sql);

                var dts = tmp.OrderByDescending(x => x.WaterId).Skip((curPageIndex < 1 ? 0 : curPageIndex - 1) * pSize).Take(pSize).ToList();

                var dit = EnumExten.GetDictionary(typeof(ELogs));
                foreach (var d in dts)
                {
                    ldat.Add(new _Log()
                    {
                        Type = dit.ContainsKey(d.EventKey) ? dit[d.EventKey] : "-",
                        Json = d.EventData,
                        Date = d.EventDate.ToString("yyyy-MM-dd HH:mm:ss")
                    });
                }
            }
            Response.Clear();
            Response.Write(new JavaScriptSerializer().Serialize(ldat));
            Response.End();
        }
コード例 #3
0
 /// <summary>
 /// 
 /// </summary>
 protected void CheckUrlKey()
 {
     string urlKey = this.GetQueryStr("chkUrlKey");
     if (urlKey.IsNullOrEmpty()) return;
     using (DBDataContext db = new DBDataContext(SqlHelper.DB_CONN_STRING))
     {
         var intro = db.KeyWordsLib.FirstOrDefault(x => x.UrlKey == urlKey);
         Response.Clear();
         Response.Write(intro == null ? "0" : "1");
         Response.End();
     }
 }
コード例 #4
0
        protected string PostProcess()
        {
            string cPass1 = this.GetPostStr("cPass1");
            string cPass2 = this.GetPostStr("cPass2");
            string cPass3 = this.GetPostStr("cPass3");
            if (cPass1.IsNullOrEmpty()) return "请输入旧密码";
            if (cPass2.IsNullOrEmpty()) return "请输入新密码";
            if (cPass2.Length < 6) return "新密码长度必须大于5位";
            if (cPass3.IsNullOrEmpty()) return "请输入确认密码";
            if (cPass2 != cPass3) return "新密码和确认密码不同";

            using (DBDataContext db = new DBDataContext(SqlHelper.DB_CONN_STRING))
            {
                var fsu = db.WebSafe.FirstOrDefault(x => x.LoginName == this.Member.UserKey);
                if (fsu == null) return "登录错误,请重新登录";
                if ((cPass1 + fsu.LoginSalt).SHA256().Equals(fsu.LoginPass) == false) return "旧密码输入错误";
                fsu.LoginPass = (cPass2 + fsu.LoginSalt).SHA256();

                db.SubmitChanges();
            }
            return "";
        }
コード例 #5
0
ファイル: WaterFall.aspx.cs プロジェクト: 470192616/JzSayGen
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.GetQueryStr("createtest").IsNullOrEmpty() == false)
            {
                using (DBDataContext db = new DBDataContext(SqlHelper.DB_CONN_STRING))
                {
                    var dts = db.IntroLib.OrderByDescending(x => x.CreateTS).ToList();
                    string html = UIAscx.RenderView<UCTest>("~/JM/WUCLib/UCTest.ascx", (c) =>
                    {
                        c.ListData = dts;
                    });
                    Response.Clear();
                    Response.Write(html);
                    Response.End();
                }
            }

            if (this.GetQueryStr("ajax") == "1")
            {

                Int32 pSize = 10;
                Int32 p = this.GetQueryInt32("page", 1);
                List<J> ldat = new List<J>();
                if (p < 10)
                {
                    System.Random random = new Random(~unchecked((int)DateTime.Now.Ticks));
                    for (int i = 0; i < pSize; i++)
                    {
                        ldat.Add(new J() { K = (p - 1) * pSize + i, H = random.Next(100, 555) });
                    }
                }
                Response.Clear();
                Response.Write(new JavaScriptSerializer().Serialize(ldat));
                Response.End();
                return;
            }
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.CmdProcess();

            this.SearchStat = this.GetQueryInt32("SearchStat");
            this.SearchName = this.GetQueryStr("SearchName");

            string attachUrl = "";
            this.CurPageIndex = this.GetQueryInt32("page", 1);
            Int32 pSize = 10;
            using (DBDataContext db = new DBDataContext(SqlHelper.DB_CONN_STRING))
            {
                var sql = LinqWhereHelper.True<CategoryLib>();
                //sql = sql.And(x => x.UnionId == this.Member.UnionId);

                if (this.SearchStat > 0)
                {
                    sql = sql.And(x => x.Stat == this.SearchStat);
                    attachUrl = attachUrl + "&SearchStat=" + this.SearchStat.ToString();
                }

                if (this.SearchName.IsNullOrEmpty() == false)
                {
                    sql = sql.And(x => x.Title.Contains(this.SearchName));
                    attachUrl = attachUrl + "&SearchName=" + this.SearchName;
                }

                var tmp = db.CategoryLib.Where(sql);
                Int32 rsCount = tmp.Count();
                UIPagePager pp = new UIPagePager(rsCount, pSize) { AttachUrlParameter = attachUrl };
                this.CurPageCount = pp.PageCount;
                if (this.CurPageIndex < 1 || this.CurPageIndex > this.CurPageCount) this.CurPageIndex = 1;

                this.ListData = tmp.OrderByDescending(x => x.ViewOrder).ThenByDescending(x => x.CreateTS).Skip((this.CurPageIndex - 1) * pSize).Take(pSize).ToList();
                this.PagerStr = pp.Show(this.CurPageIndex);
            }
        }
コード例 #7
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        protected string PostProcess()
        {
            string urlKey = this.GetPostStr("urlKey");
            if (urlKey.IsNullOrEmpty()) return "url必填";
            if (urlKey.IsSubDomain() == false) return "url只能由字母、数字组成";

            string keyWord = this.GetPostStr("KeyWord");
            if (keyWord.IsNullOrEmpty()) return "关键词必填";

            Int32 keyWeight = this.GetPostInt32("KeyWeight");

            string actTip = "";
            using (DBDataContext db = new DBDataContext(SqlHelper.DB_CONN_STRING))
            {
                var editInfo = db.KeyWordsLib.FirstOrDefault(x => x.UrlKey == urlKey);
                if (editInfo == null)
                {
                    actTip = "添加";
                    db.KeyWordsLib.InsertOnSubmit(new KeyWordsLib()
                    {
                        UrlKey = urlKey,
                        KeyWord = keyWord,
                        KeyLength = keyWord.Length,
                        KeyWeight = keyWeight,
                        Stat = EGenStat.Normal.GetInt32(),
                        CreateTS = MACPrimaryKey.GetNowTS,
                        UpdateTS = MACPrimaryKey.GetNowTS
                    });
                }
                else
                {
                    actTip = "修改";
                    editInfo.KeyWeight = keyWeight;
                    editInfo.UpdateTS = MACPrimaryKey.GetNowTS;
                }
                db.SubmitChanges();
            }

            return actTip + "成功";
        }
コード例 #8
0
ファイル: Bridge.cs プロジェクト: 470192616/JzSayGen
        public string LoginSys(string userName, string userPass, string safeCode)
        {
            this.Code = 1;
            if (userName.IsNullOrEmpty()) return "请输入登录账户";
            if (userPass.IsNullOrEmpty()) return "请输入登录密码";

            if (this.CurrentContext.Session["ReLogin"] != null)
            {
                if (safeCode.IsNullOrEmpty()) return "请输入验证码";

                var usc = this.CurrentContext.Session[SafeSessionKey] as string;
                if (string.IsNullOrEmpty(usc)) return "验证码获取失败请刷新验证码";

                if (usc.ToString().Equals(safeCode, StringComparison.OrdinalIgnoreCase) == false) return "验证码输入错误";
            }
            this.CurrentContext.Session["ReLogin"] = "******";

            /*
             admin admin888

            INSERT INTO WebSafe (LoginName,LoginSalt,LoginPass,CreateTS,UpdateTS)
            values ('admin','C3ED740FA8','XE889GwjXRuwQ+NsHvJei4t72bCeboOSFpwzCb25n/Y=',
            20141208154515289,20141208154515289)
             */

            SysLogs.Write(ELogs.TryLogin, userName.GetLeft(40) + ";" + General.GetClientIP + ";" + General.GetClientOS);
            using (DBDataContext db = new DBDataContext(SqlHelper.DB_CONN_STRING))
            {
                var su = db.WebSafe.FirstOrDefault(x => x.LoginName == userName.GetLeft(30));
                if (su == null) return "登录账户不存在或登录密码错误";
                string mp = (userPass.GetLeft(30) + su.LoginSalt).SHA256();
                if (su.LoginPass.Equals(mp) == false) return "登录账户不存在或登录密码错误";

                MemberPassPort.SigIn(new MemberPassPort()
                {
                    UserKey = su.LoginName
                }, this.CurrentContext);
                SysLogs.Write(ELogs.Login);
            }

            this.Code = 0;
            return "";
        }
コード例 #9
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        protected string PostProcess()
        {
            string urlKey = this.GetPostStr("urlKey");
            if (urlKey.IsNullOrEmpty()) return "url必填";
            if (urlKey.IsSubDomain() == false) return "url只能由字母、数字组成";

            string title = this.GetPostStr("title");
            if (title.IsNullOrEmpty()) return "标题必填";

            string url = this.GetPostStr("url");

            string icon = this.GetPostStr("cImgNew");
            if (icon.IsNullOrEmpty())
            {
                icon = this.GetPostStr("cImgOld");
            }
            else
            {
                if (icon.StartsWith("/src/Temp/", StringComparison.OrdinalIgnoreCase) == false) return "没有操作权限";

                Int32 pos = icon.LastIndexOf('.');
                if (-1 == pos) return "不是图片文件";

                string eName = icon.Substring(pos).ToLower(); //扩展名
                if (".jpg.png.gif".Contains(eName) == false) return "图片文件必须是jpg、png或者gif格式";

                string tRoot = Server.MapPath("~").Replace("\\", "/").TrimEnd('/');
                if (File.Exists(tRoot + icon) == false) return "图片不存在";

                string wRoot = "/src/" + "" + DateTime.Now.ToString("yyyyMM") + "/";
                if (Directory.Exists(tRoot + wRoot) == false) Directory.CreateDirectory(tRoot + wRoot);

                Int32 v = icon.LastIndexOf('/');
                string fk = icon.Substring(v + 1, 11);

                string iconStr = wRoot + fk + eName;
                File.Copy(tRoot + icon, tRoot + iconStr);
                icon = iconStr;
            }

            string actTip = "";
            using (DBDataContext db = new DBDataContext(SqlHelper.DB_CONN_STRING))
            {
                var editInfo = db.CategoryLib.FirstOrDefault(x => x.UrlKey == urlKey);
                if (editInfo == null)
                {
                    actTip = "添加";
                    Int64? mx = db.CategoryLib.Max(x => (Int64?)x.ViewOrder);
                    db.CategoryLib.InsertOnSubmit(new CategoryLib()
                    {
                        UrlKey = urlKey,
                        Title = title,
                        Icon = icon,
                        AttJson = url,
                        ViewOrder = (mx.HasValue ? mx.Value : 0) + 1,
                        Stat = EGenStat.Normal.GetInt32(),
                        CreateTS = MACPrimaryKey.GetNowTS,
                        UpdateTS = MACPrimaryKey.GetNowTS
                    });
                }
                else
                {
                    actTip = "修改";
                    editInfo.Title = title;
                    editInfo.AttJson = url;
                    editInfo.Icon = icon;
                    editInfo.UpdateTS = MACPrimaryKey.GetNowTS;
                }
                db.SubmitChanges();
            }

            return actTip + "成功";
        }
コード例 #10
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        protected string PostProcess()
        {
            string urlKey = this.GetPostStr("urlKey");
            if (urlKey.IsNullOrEmpty()) return "url必填";
            if (urlKey.IsSubDomain() == false) return "url只能由字母、数字组成";

            string title = this.GetPostStr("title");
            if (title.IsNullOrEmpty()) return "标题必填";

            string intro = this.GetPostStr("intro");
            if (intro.IsNullOrEmpty()) return "内容必填";

            string actTip = "";
            using (DBDataContext db = new DBDataContext(SqlHelper.DB_CONN_STRING))
            {
                var editIntro = db.IntroLib.FirstOrDefault(x => x.UrlKey == urlKey);
                if (editIntro == null)
                {
                    actTip = "添加";
                    db.IntroLib.InsertOnSubmit(new IntroLib()
                    {
                        UrlKey = urlKey,
                        Title = title,
                        Intro = intro,
                        Stat = EGenStat.Normal.GetInt32(),
                        CreateTS = MACPrimaryKey.GetNowTS,
                        UpdateTS = MACPrimaryKey.GetNowTS
                    });
                }
                else
                {
                    actTip = "修改";
                    editIntro.Title = title;
                    editIntro.Intro = intro;
                    editIntro.UpdateTS = MACPrimaryKey.GetNowTS;
                }
                db.SubmitChanges();
            }

            return actTip + "成功";
        }