Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            msite.ext1  = Request.Form["ext1"];
            msite.ext2  = Request.Form["ext2"];
            msite.ext3  = Request.Form["ext3"];
            msite.ext4  = Request.Form["ext4"];
            msite.ext5  = Request.Form["ext5"];
            msite.ext6  = Request.Form["ext6"];
            msite.ext7  = Request.Form["ext7"];
            msite.ext8  = Request.Form["ext8"];
            msite.ext9  = Request.Form["ext9"];
            msite.ext10 = Request.Form["ext10"];


            Model.logs lg = new Model.logs();
            if (msite != null && msite.id != 0)
            {
                bsites.Update(msite);

                lg.loginfo = "表:" + "sites" + ",ID:" + msite.id;
                UserLog("修改", lg);
            }
            else
            {
                var newid = bsites.Add(msite);

                lg.loginfo = "表:" + "sites" + ",ID:" + newid;
                UserLog("增加", lg);
            }

            txtMsg.Attributes["class"] = "callout callout-info";
        }
Пример #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Response.Write(JsonConvert.SerializeObject(Request.Form));
            //Response.Write(JsonConvert.SerializeObject(module));

            module.path     = string.IsNullOrEmpty(Request.Form["path"]) ? "-" : Request.Form["path"];
            module.parentid = int.Parse(string.IsNullOrEmpty(Request.Form["parentid"]) ? "0" : Request.Form["parentid"]);

            module.title = Request.Form["title"];
            module.url   = Request.Form["url"];

            module.content = Server.HtmlEncode(Request.Form["content"]);
            module.blank   = int.Parse(Request.Form["ckBlankHid"]);//是否新窗口打开

            module.pic     = Request.Form["pic"];
            module.orderby = int.Parse(Request.Form["orderby"]);

            Model.logs lg = new Model.logs();
            if (module != null && module.id != 0)
            {
                bmodules.Update(module);

                lg.loginfo = "表:" + mymodule + ",ID:" + module.id;
                UserLog("修改", lg);
            }
            else
            {
                var pathArr = module.path.Trim('-').Split('-');
                if (pathArr.Length == 1 && string.IsNullOrEmpty(pathArr[0]))
                {
                    pathArr[0] = "0";
                }
                module.parentid = (Int32.Parse(pathArr[pathArr.Length - 1]));//倒数第二个

                var latestid = bmodules.Add(module);

                //新增之后,更新细节
                module = bmodules.Get(latestid);

                if (string.IsNullOrEmpty(module.path))
                {
                    module.path = "-";
                }

                module.path = module.path + latestid + '-';
                bmodules.Update(module);

                lg.loginfo = "表:" + mymodule + ",ID:" + latestid;
                UserLog("增加", lg);
            }

            JC.Common.CookieHelper.Del("gUzaiManagerMenu-EndTime");

            //更新扩展信息
            FixModules();

            txtMsg.Style["display"] = "block";

            txtMsg.Attributes["class"] = "callout callout-info";
        }
Пример #3
0
        protected void btnSession_Click(object sender, EventArgs e)
        {
            JC.Model.logs lg = new Model.logs();
            lg.loginfo = "站点Session";
            UserLog("删除", lg);

            Session.Clear();//删除全站session

            txtMsg.Style["display"]    = "block";
            txtMsg.Attributes["class"] = "callout callout-info";
        }
Пример #4
0
        protected void btnCache_Click(object sender, EventArgs e)
        {
            JC.Model.logs lg = new Model.logs();
            lg.loginfo = "站点缓存";
            UserLog("删除", lg);

            JC.Common.DataCache.Clear();

            txtMsg.Style["display"]    = "block";
            txtMsg.Attributes["class"] = "callout callout-info";
        }
Пример #5
0
        protected void btnCookie_Click(object sender, EventArgs e)
        {
            JC.Model.logs lg = new Model.logs();
            lg.loginfo = "本地Cookie";
            UserLog("删除", lg);

            JC.Common.CookieHelper.Clear();//本地Cookie

            txtMsg.Style["display"]    = "block";
            txtMsg.Attributes["class"] = "callout callout-info";
        }
Пример #6
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            var name = txtName.Value;
            var pwd  = txtPwd.Value;

            if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(pwd))
            {
                //Common.LogHelper.Info(name + ":" + pwd);

                //读取用户帐号
                JC.Model.users my = busers.GetList().Where(c => ((c.email == name || c.username == name) && c.pwd.ToUpper() == DESEncrypt.MD5Encrypt(pwd).ToUpper())).FirstOrDefault();

                if (my != null)
                {
                    if (my.isadmin == 1)
                    {
                        if (ckRember.Checked == true)
                        {
                            CookieHelper.Set("JCRemberMe", my.username ?? my.email);
                        }
                        else
                        {
                            CookieHelper.Del("JCRemberMe");
                        }
                        Session[userKey] = my;
                        CookieHelper.Set(userKey, my.id + "|" + my.username + '|' + my.email + '|' + my.avator + '|' + my.isadmin);

                        //更新登录次数
                        my.logtime += 1;
                        busers.Update(my);

                        var lg = new Model.logs();
                        UserLog("登录", lg);

                        UserLogRemove();

                        Response.Redirect("/manager/index");
                    }
                    else
                    {
                        lblMsg.InnerText = "网站管理员才可以登录后台!";
                    }
                }
                else
                {
                    lblMsg.InnerText = "登录密码错误!";
                }
            }
            else
            {
                lblMsg.InnerText = "邮箱和密码必须填写!";
            }
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //保存日志
            JC.Model.logs lg = new Model.logs();
            UserLog("退出", lg);

            JC.Common.CookieHelper.Del("gUzaiManagerMenu-EndTime");
            JC.Common.CookieHelper.Del("JCUser");
            Session.Remove(userKey);
            Session.Abandon();
            Response.Redirect("/manager/login");
        }
Пример #8
0
        //清楚日志
        public static void UserLogRemove()
        {
            var logday = msite.logday;
            var boo    = blogs.DelWhere(" postdate <  date('now','start of day','-" + logday + " days') ");

            if (boo)
            {
                //记录日志
                Model.logs lg = new Model.logs();
                lg.loginfo = "表:" + "logs" + ",范围:前" + logday + "天日志";
                UserLog("删除", lg);
            }
        }
Пример #9
0
        public static void UserLog(string tag, Model.logs lg)
        {
            var obj     = Common.JsonHelper.GetJsonSiteObject();
            var logname = (List <string>)obj["manager"]["logs"]["name"].ToObject(typeof(List <string>));
            var logcode = (List <string>)obj["manager"]["logs"]["code"].ToObject(typeof(List <string>));
            var tagcode = logcode[logname.IndexOf(tag)];

            var my = (Model.users)HttpContext.Current.Session[userKey];

            if (my != null)
            {
                //保存日志
                lg.postdate = DateTime.Now;
                lg.username = my.username;
                lg.logtype  = tag + ":" + tagcode;
                lg.loginfo  = tag + (lg.loginfo ?? "");
                blogs.Add(lg);
            }
        }
Пример #10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Response.Write(JsonConvert.SerializeObject(Request.Form));
            //Response.Write(JsonConvert.SerializeObject(post));

            post.keywords = Request.Form["keywords"];
            post.pic      = Request.Form["pic"];

            post.enable = int.Parse(Request.Form["enableHid"]);

            post.ext1 = Request.Form["ext1"];                   //链接地址
            post.ext2 = Request.Form["ext2"];                   //联系人信息(QQ,邮箱)
            post.ext3 = Request.Form["ext3"];                   //链接位置(下拉菜单)

            post.blank   = int.Parse(Request.Form["blankHid"]); //新窗口打开
            post.orderby = int.Parse(Request.Form["orderby"]);  //排序

            post.modifydate = DateTime.Now;
            post.postby     = !string.IsNullOrEmpty(post.postby) ? post.postby : muser.username;

            Model.logs lg = new Model.logs();
            if (post != null && post.id != 0)
            {
                bposts.Update(post);

                lg.loginfo = "表:" + mymodule + ",ID:" + post.id;
                UserLog("修改", lg);
            }
            else
            {
                post.postdate = DateTime.Now;
                post.ext      = mymodule;//VIP code,for extend fields
                var newid = bposts.Add(post);

                lg.loginfo = "表:" + mymodule + ",ID:" + newid;
                UserLog("增加", lg);
            }

            txtMsg.Style["display"] = "block";

            txtMsg.Attributes["class"] = "callout callout-info";
        }
Пример #11
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Response.Write(JsonConvert.SerializeObject(Request.Form));
            //Response.Write(JsonConvert.SerializeObject(post));

            post.postby  = Request.Form["postby"];
            post.content = Server.HtmlEncode(Request.Form["content"]);

            post.ext1 = Request.Form["ext1"];                   //手机号
            post.ext2 = Request.Form["ext2"];                   //邮箱

            post.read = Int32.Parse(Request.Form["ckReadHid"]); //已查看

            post.modifydate = DateTime.Now;
            post.postby     = !string.IsNullOrEmpty(post.postby) ? post.postby : muser.username;

            Model.logs lg = new Model.logs();
            if (post != null && post.id != 0)
            {
                bposts.Update(post);

                lg.loginfo = "表:" + mymodule + ",ID:" + post.id;
                UserLog("修改", lg);
            }
            else
            {
                post.postdate = DateTime.Now;
                post.ext      = mymodule;//VIP code,for extend fields
                var newid = bposts.Add(post);

                lg.loginfo = "表:" + mymodule + ",ID:" + newid;
                UserLog("增加", lg);
            }

            txtMsg.Style["display"]    = "block";
            txtMsg.Attributes["class"] = "callout callout-info";
        }
Пример #12
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Response.Write(JsonConvert.SerializeObject(Request.Form));
            //Response.Write(JsonConvert.SerializeObject(post));

            post.title   = Request.Form["title"];
            post.content = Request.Form["content"];

            post.enable = int.Parse(Request.Form["enableHid"]); //是否有效

            post.blank = int.Parse(Request.Form["blankHid"]);   //新窗口打开
            //post.orderby = int.Parse(Request.Form["orderby"]);//排序

            post.ext1 = Request.Form["ext1"];//链接位置(下拉菜单)

            //piclist

            SortedDictionary <int, string> picsb = new SortedDictionary <int, string>();//排序字典,实现默认排序

            for (int i = 0; i < msite.picmaxlength; i++)
            {
                //处理排序
                var orderby = Request.Form["piclist" + (i + 1) + "orderby"];

                //txt,link,picsrc,target,orderby
                var txt = Request.Form["piclist" + (i + 1) + "txt"];
                if (!string.IsNullOrEmpty(txt))
                {
                    txt = txt.Replace(",", ",");
                }
                var link   = Request.Form["piclist" + (i + 1) + "link"];
                var picsrc = Request.Form["piclist" + (i + 1)];
                var target = Request.Form["piclist" + (i + 1) + "targetHid"];

                target = target == "1" ? "_blank" : "_self";

                if (!string.IsNullOrEmpty(picsrc) && !string.IsNullOrEmpty(link) && picsrc != msite.nopic)
                {
                    picsb.Add(Int32.Parse(orderby), txt + "," + link + "," + picsrc + "," + target + "," + orderby + "|");
                }
            }

            var sb = new StringBuilder();

            foreach (var item in picsb)
            {
                sb.Append(item.Value);
            }
            post.piclist = sb.ToString().Trim('|');

            post.modifydate = DateTime.Now;
            post.postby     = !string.IsNullOrEmpty(post.postby) ? post.postby : muser.username;

            Model.logs lg = new Model.logs();
            if (post != null && post.id != 0)
            {
                bposts.Update(post);

                lg.loginfo = "表:" + "sites" + ",ID:" + msite.id;
                UserLog("修改", lg);
            }
            else
            {
                post.postdate = DateTime.Now;
                post.ext      = mymodule;//VIP code,for extend fields

                //JC.Common.LogHelper.Info(JsonConvert.SerializeObject(post));

                int newid = bposts.Add(post);

                lg.loginfo = "表:" + "sites" + ",ID:" + newid;
                UserLog("增加", lg);
            }

            txtMsg.Style["display"] = "block";

            txtMsg.Attributes["class"] = "callout callout-info";
        }
Пример #13
0
        public void ProcessRequest(HttpContext context)
        {
            var str  = "";
            var user = (Model.users)HttpContext.Current.Session[userKey];

            BLL.logs blogs = new BLL.logs();
            if (user != null)
            {
                context.Response.ContentType = "text/plain";
                var id = context.Request.Form["id"];//ids:2,4,6
                var tb = context.Request.Form["model"];

                if (!string.IsNullOrEmpty(id))
                {
                    if (tb == "users")
                    {
                        BLL.users bl = new BLL.users();
                        bl.Del(id);
                    }
                    else if (tb == "logs")
                    {
                        BLL.logs bl = new BLL.logs();
                        bl.Del(id);
                    }
                    else if (tb == "posts")
                    {
                        BLL.posts bl = new BLL.posts();
                        bl.Del(id);
                    }
                    else if (tb == "menus")
                    {
                        BLL.menus bl = new BLL.menus();

                        //先删除删除扩展信息
                        App_Code.PageBase.FixMenusExt(id);

                        //更新扩展信息
                        App_Code.PageBase.FixMenus();
                    }
                    else if (tb == "modules")
                    {
                        BLL.modules bl = new BLL.modules();

                        //先删除删除扩展信息
                        App_Code.PageBase.FixModulesExt(id);

                        //更新扩展信息
                        App_Code.PageBase.FixModules();
                    }

                    //保存日志
                    Model.logs lg = new Model.logs();
                    lg.loginfo = "表:" + tb + ",ID:" + id;
                    App_Code.PageBase.UserLog("删除", lg);

                    str = "{\"code\":1,\"msg\":\"" + id + "删除成功\"}";
                }
                else
                {
                    str = "{\"code\":0,\"msg\":\"ID传值错误\"}";
                }
            }
            else
            {
                str = "{\"code\":-1,\"msg\":\"权限错误\"}";
            }
            context.Response.Write(str);
        }
Пример #14
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Response.Write(JsonConvert.SerializeObject(Request.Form));
            //Response.Write(JsonConvert.SerializeObject(post));

            post.enable = int.Parse(Request.Form["ckEnableHid"]);
            post.tag    = Server.HtmlEncode(Request.Form["tag"]);

            post.title       = Request.Form["title"];
            post.keywords    = JC.Common.Common.ToDBC(Request.Form["keywords"]);
            post.content     = Server.HtmlEncode(Request.Form["content"]);
            post.description = Server.HtmlEncode(string.IsNullOrEmpty(Request.Form["description"]) ? Common.Common.CutString(Common.Common.checkString(Request.Form["content"]).Trim(), 200, false) : Request.Form["description"]);

            if (msite.lang.Contains("英文"))
            {
                post.titleen       = Request.Form["titleen"];
                post.keywordsen    = JC.Common.StringPlus.ToDBC(Request.Form["keywordsen"]);
                post.contenten     = Server.HtmlEncode(Request.Form["contenten"]);
                post.descriptionen = Server.HtmlEncode(string.IsNullOrEmpty(Request.Form["descriptionen"]) ? Common.Common.CutString(Common.Common.checkString(Request.Form["contenten"]).Trim(), 200, false) : Request.Form["descriptionen"]);
            }

            post.pic = Request.Form["pic"];

            //piclist
            var picsb = new StringBuilder();

            for (int i = 0; i < msite.picmaxlength; i++)
            {
                var item = Request.Form["piclist" + (i + 1)];
                if (!string.IsNullOrEmpty(item))
                {
                    if (item != msite.nopic)
                    {
                        picsb.Append(item + "|");
                    }
                }
            }

            if (picsb.Length == 0)
            {
                picsb.Append(msite.nopic);
            }

            post.piclist = picsb.ToString().Trim('|');

            post.hit = int.Parse(Request.Form["hit"]);

            post.top   = int.Parse(Request.Form["ckTopHid"]);
            post.hot   = int.Parse(Request.Form["ckHotHid"]);
            post.intro = int.Parse(Request.Form["ckIntroHid"]);

            post.modifydate = DateTime.Now;
            post.postby     = !string.IsNullOrEmpty(post.postby) ? post.postby : muser.username;

            //扩展信息
            post.ext1 = DateTime.Parse(!string.IsNullOrEmpty(Request.Form["ext1"])? Request.Form["ext1"] : DateTime.Now.ToString()).ToString("yyyy-MM-dd"); //安装日期
            post.ext2 = Request.Form["ext2"];                                                                                                               //使用费用
            post.ext3 = Request.Form["ext3"];                                                                                                               //房型
            post.ext4 = Request.Form["ext4"];                                                                                                               //建筑面积
            post.ext5 = Request.Form["ext5"];                                                                                                               //安装面积
            post.ext6 = Request.Form["ext6"];                                                                                                               //产品类型
            post.ext7 = Request.Form["ext7"];                                                                                                               //客户简评

            //处理typeid
            var pid     = Request.Form["path"];//取最后一个
            var pathArr = pid.Trim('-').Split('-');

            if (pathArr.Length == 1 && string.IsNullOrEmpty(pathArr[0]))
            {
                pathArr[0] = "0";
            }
            var tempid = pathArr[pathArr.Length - 1];

            post.typeid = Int32.Parse(tempid);
            //处理typeid

            Model.logs lg = new Model.logs();
            if (post != null && post.id != 0)
            {
                bposts.Update(post);

                lg.loginfo = "表:" + mymodule + ",ID:" + post.id;
                UserLog("修改", lg);
            }
            else
            {
                post.postdate = DateTime.Now;
                post.ext      = mymodule;//VIP code,for extend fields
                var newid = bposts.Add(post);

                lg.loginfo = "表:" + mymodule + ",ID:" + newid;
                UserLog("增加", lg);
            }

            txtMsg.Style["display"] = "block";

            txtMsg.Attributes["class"] = "callout callout-info";
        }
Пример #15
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Response.Write(JsonConvert.SerializeObject(Request.Form));
            //Response.Write(JsonConvert.SerializeObject(musers));

            user.username = Request.Form["username"];
            user.nickname = Request.Form["nickname"];
            user.email    = Request.Form["email"];
            user.avator   = Request.Form["avator"];

            user.isadmin = int.Parse(Request.Form["isadminHid"]);

            //set pwd
            var pwd     = Request.Form["pwd"];
            var pwdHide = Request.Form["pwdHide"];

            if (pwd != pwdHide)
            {
                //密码已修改
                user.pwd = JC.Common.DESEncrypt.MD5Encrypt(pwd).ToUpper();
            }

            user.ext1  = Request.Form["ext1"];
            user.ext2  = Request.Form["ext2"];
            user.ext3  = Request.Form["ext3"];
            user.ext4  = Request.Form["ext4"];
            user.ext5  = Request.Form["ext5"];
            user.ext6  = Request.Form["ext6"];
            user.ext7  = Request.Form["ext7"];
            user.ext8  = Request.Form["ext8"];
            user.ext9  = Request.Form["ext9"];
            user.ext10 = Request.Form["ext10"];

            Model.logs lg = new Model.logs();
            if (user != null && user.id != 0)
            {
                user.modifydate = DateTime.Now;
                busers.Update(user);

                var ck = Session[userKey];

                if (ck != null)
                {
                    var my = (Model.users)ck;

                    if (my.id == user.id)
                    {
                        //修改当前用户的密码
                        JC.Common.CookieHelper.Del("JCUser");
                        Session.Remove("JCUser");
                        Session.Abandon();
                        Response.Redirect("/manager/login");
                    }
                }

                lg.loginfo = "表:" + "sites" + ",ID:" + msite.id;
                UserLog("修改", lg);
            }
            else
            {
                user.postdate   = DateTime.Now;
                user.modifydate = DateTime.Now;
                int newid = busers.Add(user);

                lg.loginfo = "表:" + "sites" + ",ID:" + newid;
                UserLog("增加", lg);
            }

            txtMsg.Style["display"] = "block";

            txtMsg.Attributes["class"] = "callout callout-info";
        }
Пример #16
0
        public void ProcessRequest(HttpContext context)
        {
            var str  = "";
            var user = (Model.users)HttpContext.Current.Session[userKey];

            BLL.logs blogs = new BLL.logs();
            if (user != null)
            {
                context.Response.ContentType = "text/plain";
                var id     = context.Request.Form["id"];//ids:2,4,6
                var tb     = context.Request.Form["model"];
                var flag   = context.Request.Form["flag"];
                var flagcn = context.Request.Form["flagcn"];
                var v      = Int32.Parse(context.Request.Form["v"]);

                if (!string.IsNullOrEmpty(id))
                {
                    if (tb == "users")
                    {
                        BLL.users   bl  = new BLL.users();
                        Model.users mod = bl.Get(Int32.Parse(id));
                        if (flag == "isadmin")
                        {
                            mod.isadmin    = v;
                            mod.modifydate = DateTime.Now;
                            bl.Update(mod);
                        }
                    }
                    else if (tb == "posts")
                    {
                        BLL.posts   bl  = new BLL.posts();
                        Model.posts mod = bl.Get(Int32.Parse(id));
                        switch (flag)
                        {
                        case "top":
                            mod.top = v;
                            break;

                        case "hot":
                            mod.hot = v;
                            break;

                        case "intro":
                            mod.intro = v;
                            break;

                        case "read":
                            mod.read = v;
                            break;

                        case "blank":
                            mod.blank = v;
                            break;

                        case "enable":
                            mod.enable = v;
                            break;
                        }
                        mod.modifydate = DateTime.Now;
                        bl.Update(mod);
                    }
                    else if (tb == "modules")
                    {
                        BLL.modules   bl  = new BLL.modules();
                        Model.modules mod = bl.Get(Int32.Parse(id));
                        switch (flag)
                        {
                        case "blank":
                            mod.blank = v;
                            break;
                        }
                        bl.Update(mod);
                    }

                    //保存日志
                    Model.logs lg = new Model.logs();
                    lg.loginfo = "表:" + tb + ",ID:" + id + "设置" + flagcn;
                    App_Code.PageBase.UserLog("修改", lg);

                    str = "{\"code\":1,\"msg\":\"" + id + "修改成功\"}";
                }
                else
                {
                    str = "{\"code\":0,\"msg\":\"ID传值错误\"}";
                }
            }
            else
            {
                str = "{\"code\":-1,\"msg\":\"权限错误\"}";
            }
            context.Response.Write(str);
        }
Пример #17
0
 // GET: api/Logs/5
 public string Get(int id)
 {
     model = bll.Get(id);
     return(JsonConvert.SerializeObject(model));
 }
Пример #18
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Response.Write(JsonConvert.SerializeObject(Request.Form));
            //Response.Write(JsonConvert.SerializeObject(post));

            post.enable = int.Parse(Request.Form["enableHid"]);

            post.title       = Request.Form["title"];
            post.keywords    = JC.Common.Common.ToDBC(Request.Form["keywords"]);
            post.content     = Server.HtmlEncode(Request.Form["content"]);
            post.description = Server.HtmlEncode(string.IsNullOrEmpty(Request.Form["description"]) ? Common.Common.CutString(Common.Common.checkString(Request.Form["content"]).Trim(), 200, false) : Request.Form["description"]);

            if (msite.lang.Contains("英文"))
            {
                post.titleen       = Request.Form["titleen"];
                post.keywordsen    = JC.Common.StringPlus.ToDBC(Request.Form["keywordsen"]);
                post.contenten     = Server.HtmlEncode(Request.Form["contenten"]);
                post.descriptionen = Server.HtmlEncode(string.IsNullOrEmpty(Request.Form["descriptionen"]) ? Common.Common.CutString(Common.Common.checkString(Request.Form["contenten"]).Trim(), 200, false) : Request.Form["descriptionen"]);
            }

            post.pic = Request.Form["pic"];
            post.hit = int.Parse(Request.Form["hit"]);

            post.top   = int.Parse(Request.Form["ckTopHid"]);
            post.hot   = int.Parse(Request.Form["ckHotHid"]);
            post.intro = int.Parse(Request.Form["ckIntroHid"]);

            post.postby     = !string.IsNullOrEmpty(post.postby) ? post.postby : muser.username;
            post.modifydate = DateTime.Now;


            //处理typeid
            var pid     = Request.Form["path"];//取最后一个
            var pathArr = pid.Trim('-').Split('-');

            if (pathArr.Length == 1 && string.IsNullOrEmpty(pathArr[0]))
            {
                pathArr[0] = "0";
            }
            var tempid = pathArr[pathArr.Length - 1];

            post.typeid = Int32.Parse(tempid);
            //处理typeid

            Model.logs lg = new Model.logs();
            if (post != null && post.id != 0)
            {
                bposts.Update(post);

                lg.loginfo = "表:" + mymodule + ",ID:" + post.id;
                UserLog("修改", lg);
            }
            else
            {
                post.postdate = DateTime.Now;
                post.ext      = mymodule;//VIP code,for extend fields
                var newid = bposts.Add(post);

                lg.loginfo = "表:" + mymodule + ",ID:" + newid;
                UserLog("增加", lg);
            }

            txtMsg.Style["display"] = "block";

            txtMsg.Attributes["class"] = "callout callout-info";
        }
Пример #19
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Response.Write(JsonConvert.SerializeObject(Request.Form));
            //Response.Write(JsonConvert.SerializeObject(menu));

            menu.linktag = Request.Form["linktag"];

            menu.path     = string.IsNullOrEmpty(Request.Form["path"]) ? "-" : Request.Form["path"];
            menu.parentid = int.Parse(string.IsNullOrEmpty(Request.Form["parentid"]) ? "0" : Request.Form["parentid"]);

            menu.title       = Request.Form["title"];
            menu.keywords    = JC.Common.Common.ToDBC(Request.Form["keywords"]);
            menu.description = Server.HtmlEncode(Request.Form["description"]);
            menu.content     = Server.HtmlEncode(Request.Form["content"]);

            menu.titleen       = Request.Form["titleen"];
            menu.keywordsen    = JC.Common.StringPlus.ToDBC(Request.Form["keywordsen"]);
            menu.descriptionen = Server.HtmlEncode(Request.Form["descriptionen"]);
            menu.contenten     = Server.HtmlEncode(Request.Form["contenten"]);

            menu.pic     = Request.Form["pic"];
            menu.orderby = int.Parse(Request.Form["orderby"]);

            //-----------------------------------------

            Model.logs lg = new Model.logs();
            if (menu != null && menu.id != 0)
            {
                bmenus.Update(menu);

                lg.loginfo = "表:" + mytablename + ",ID:" + menu.id;
                UserLog("修改", lg);
            }
            else
            {
                var pathArr = menu.path.Trim('-').Split('-');
                if (pathArr.Length == 1 && string.IsNullOrEmpty(pathArr[0]))
                {
                    pathArr[0] = "0";
                }
                menu.parentid = (Int32.Parse(pathArr[pathArr.Length - 1]));//倒数第二个

                var latestid = bmenus.Add(menu);

                //新增之后,更新细节
                menu = bmenus.Get(latestid);

                if (string.IsNullOrEmpty(menu.path))
                {
                    menu.path = "-";
                }

                menu.path = menu.path + latestid + '-';
                bmenus.Update(menu);

                lg.loginfo = "表:" + mytablename + ",ID:" + latestid;
                UserLog("增加", lg);
            }


            //更新扩展信息
            FixMenus();

            txtMsg.Style["display"] = "block";

            txtMsg.Attributes["class"] = "callout callout-info";
        }