Пример #1
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";
        }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     myid    = Request.QueryString["id"];
     modules = bmodules.GetListByPage("", "path asc", 0, 100);
     if (!string.IsNullOrEmpty(myid))
     {
         module = modules.Find(c => c.id == Int32.Parse(myid));
         if (module != null)
         {
             myparentid = module.parentid.ToString();
             mypath     = module.path;
         }
     }
 }
Пример #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JC.Model.modules Get(int id)
        {
            object objModel = JC.Common.DataCache.Get(cacName);

            JC.Model.modules md = new Model.modules();
            if (objModel != null)
            {
                List <JC.Model.modules> modelList = (List <JC.Model.modules>)objModel;
                if (modelList != null && modelList.Count > 0)
                {
                    md = modelList.Find(c => c.id == id);
                }
            }
            else
            {
                md = dal.GetModel(id);
            }
            return(md);
        }
Пример #4
0
 // GET: api/Modules/5
 public string Get(int id)
 {
     model = bll.Get(id);
     return(JsonConvert.SerializeObject(model));
 }
Пример #5
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);
        }