Esempio n. 1
0
 /// <summary>
 /// 编辑一条数据
 /// </summary>
 /// <returns>"true"/"false"</returns>
 private string doUpdate()
 {
     try
     {
         //int productsid = IRequest.GetQueryInt("productsid", 0);
         int userlevelid = IRequest.GetFormInt("UserLevel_Id", 0);
         if (userlevelid > 0)
         {
             using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
             {
                 SqlDb.Dcms_UserLevel userlevel = new SqlDb.Dcms_UserLevel();
                 userlevel.UserLevel_Id = userlevelid;
                 IQuery query = session.GetQuery(userlevel).Where(SqlDb.Dcms_UserLevel._USERLEVEL_ID_.EqulesExp());
                 IList <SqlDb.Dcms_UserLevel> userlevellist = query.GetList <SqlDb.Dcms_UserLevel>();
                 if (userlevellist.Count > 0)
                 {
                     userlevel = userlevellist[0];
                     UpdateModelByForm(userlevel, Request.Form);
                     session.Update(userlevel);
                 }
             }
         }
         return("true");
     }
     catch
     {
         return("false");
     }
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            iframeid = IRequest.GetQueryString("iframeid");
            int    CateId   = IRequest.GetQueryInt("cateid", 0);
            int    Id       = IRequest.GetQueryInt("id", -1);
            string cateName = IRequest.GetQueryString("catename");

            if (Id > 0)
            {
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_UserLevel userlevel = new SqlDb.Dcms_UserLevel();
                    userlevel.UserLevel_Id = Id;
                    IQuery query = session.GetQuery(userlevel).Where(SqlDb.Dcms_UserLevel._USERLEVEL_ID_.EqulesExp());
                    List <SqlDb.Dcms_UserLevel> userlevelList = query.GetList <SqlDb.Dcms_UserLevel>();
                    if (userlevelList.Count > 0)
                    {
                        cateName = userlevelList[0].UserLevel_Title;
                    }
                }
            }
            if (Id == 0)
            {
                this.Page.Title     = "新建" + cateName;
                this.lit_Title.Text = "新建" + cateName;
                UserLevel_Id.Value  = "0";
            }
            else if (Id > 0)
            {
                this.Page.Title     = "编辑" + cateName;
                this.lit_Title.Text = "编辑" + cateName;
                lit_id.Text         = Id.ToString();
                UserLevel_Id.Value  = Id.ToString();
            }
            else
            {
                int thisId = 0;
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_UserLevel userlevel = new SqlDb.Dcms_UserLevel();
                    userlevel.UserLevel_Id = Id;
                    IQuery query = session.GetQuery(userlevel).Where(SqlDb.Dcms_UserLevel._USERLEVEL_ID_.EqulesExp());
                    List <SqlDb.Dcms_UserLevel> userlevelList = query.GetList <SqlDb.Dcms_UserLevel>();
                    if (userlevelList.Count > 0)
                    {
                        thisId = userlevelList[0].UserLevel_Id;
                    }
                }
                this.Page.Title     = "编辑" + cateName;
                this.lit_Title.Text = "编辑" + cateName;
                lit_id.Text         = thisId.ToString();
                UserLevel_Id.Value  = thisId.ToString();
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            iframeid = IRequest.GetQueryString("iframeid");
            int CateId = IRequest.GetQueryInt("cateid", 0);
            int Id = IRequest.GetQueryInt("id", -1);
            string cateName = IRequest.GetQueryString("catename");
            if (Id > 0)
            {
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_UserLevel userlevel = new SqlDb.Dcms_UserLevel();
                    userlevel.UserLevel_Id = Id;
                    IQuery query = session.GetQuery(userlevel).Where(SqlDb.Dcms_UserLevel._USERLEVEL_ID_.EqulesExp());
                    List<SqlDb.Dcms_UserLevel> userlevelList = query.GetList<SqlDb.Dcms_UserLevel>();
                    if (userlevelList.Count > 0)
                    {
                        cateName = userlevelList[0].UserLevel_Title;
                    }
                }
            }
            if (Id == 0)
            {
                this.Page.Title = "新建" + cateName;
                this.lit_Title.Text = "新建" + cateName;
                UserLevel_Id.Value = "0";
            }
            else if (Id > 0)
            {

                this.Page.Title = "编辑" + cateName;
                this.lit_Title.Text = "编辑" + cateName;
                lit_id.Text = Id.ToString();
                UserLevel_Id.Value = Id.ToString();
            }
            else
            {
                int thisId = 0;
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_UserLevel userlevel = new SqlDb.Dcms_UserLevel();
                    userlevel.UserLevel_Id = Id;
                    IQuery query = session.GetQuery(userlevel).Where(SqlDb.Dcms_UserLevel._USERLEVEL_ID_.EqulesExp());
                    List<SqlDb.Dcms_UserLevel> userlevelList = query.GetList<SqlDb.Dcms_UserLevel>();
                    if (userlevelList.Count > 0)
                    {
                        thisId = userlevelList[0].UserLevel_Id;
                    }
                }
                this.Page.Title = "编辑" + cateName;
                this.lit_Title.Text = "编辑" + cateName;
                lit_id.Text = thisId.ToString();
                UserLevel_Id.Value = thisId.ToString();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 按页取数据
        /// </summary>
        /// <returns>json</returns>
        private string doSelect()
        {
            StringBuilder sb = new StringBuilder();
            //取Grid提交来的数据开始
            //int uploadId = IRequest.GetQueryInt("id", 0);
            int    rp      = IRequest.GetFormInt("rp", 10);
            int    page    = IRequest.GetFormInt("page", 1);
            string keyword = Utils.chkSQL(IRequest.GetFormString("query"));
            string qtype   = IRequest.GetFormString("qtype");
            int    cateid  = IRequest.GetQueryInt("cateid", 0);

            //string path = getUploadPathByUploadId(uploadId).Replace("\\", "/");
            //取Grid提交来的数据结束
            using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
            {
                SqlDb.Dcms_UserLevel position = new SqlDb.Dcms_UserLevel();
                //创建查询
                IQuery query = session.GetQuery(position);

                if (keyword.Length > 0)
                {
                    query.Where(SqlDb.Dcms_UserLevel._USERLEVEL_TITLE_.Like('%', keyword, '%'));
                }
                query.OrderBy(SqlDb.Dcms_UserLevel._USERLEVEL_ID_, Direction.DESC);
                //取总记录
                int totalCount = query.Count();
                List <SqlDb.Dcms_UserLevel> userlevelList = query.GetList <SqlDb.Dcms_UserLevel>(page, rp);
                //Json格式
                sb.Append("{\n");
                sb.Append("\"page\":" + page.ToString() + ",\n");
                sb.Append("\"total\":" + totalCount.ToString() + ",\n");
                sb.Append("\"rows\": [\n");
                for (int i = 0; i < userlevelList.Count; i++)
                {
                    sb.Append("{");
                    sb.Append(string.Format("\"id\":\"{0}\",\"cell\":[\"{1}\",\"{2}\",\"{3}\",\"{4}\"]", userlevelList[i].UserLevel_Id.ToString(), userlevelList[i].UserLevel_Id.ToString(), FormatJsonData(userlevelList[i].UserLevel_Title.ToString()), FormatJsonData(userlevelList[i].UserLevel_Key), userlevelList[i].UserLevel_AddTime.ToString("yyyy/MM/dd")));
                    if ((i + 1) == userlevelList.Count)
                    {
                        sb.Append("}\n");
                    }
                    else
                    {
                        sb.Append("},\n");
                    }
                }
                sb.Append("]\n");
                sb.Append("}");
            }
            return(sb.ToString());
        }
Esempio n. 5
0
 /// <summary>
 /// 插入一条数据
 /// </summary>
 /// <returns>"true"/"false"</returns>
 private string doInsert()
 {
     try
     {
         using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
         {
             SqlDb.Dcms_UserLevel userlevel = new SqlDb.Dcms_UserLevel();
             userlevel.UserLevel_AddTime = DateTime.Now;
             UpdateModelByForm(userlevel, Request.Form);
             session.Create(userlevel);
         }
         return("true");
     }
     catch
     {
         return("false");
     }
 }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            iframeid = IRequest.GetQueryString("iframeid");
            int CateId = IRequest.GetQueryInt("cateid", 0);
            int Id = IRequest.GetQueryInt("id", -1);
            string cateName = IRequest.GetQueryString("catename");
            StringBuilder sb = new StringBuilder();
            sb.Append("<select name=\"User_LevelKey\" id=\"User_LevelKey\" style=\"width:200px\">\n");
            using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
            {
                SqlDb.Dcms_UserLevel userlevel = new SqlDb.Dcms_UserLevel();
                IQuery query = session.GetQuery(userlevel);
                List<SqlDb.Dcms_UserLevel> userlevelList = query.GetList<SqlDb.Dcms_UserLevel>();
                for (int i = 0; i < userlevelList.Count; i++)
                {
                    sb.Append(string.Format("<option value=\"{0}\">{1}</option>\n", Convert.ToString(userlevelList[i].UserLevel_Key), Convert.ToString(userlevelList[i].UserLevel_Title)));
                }

            }
            sb.Append("</select>");
            lit_UserLevel.Text = sb.ToString();
            if (Id > 0)
            {
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                    user.User_Id = Id;
                    IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_ID_.EqulesExp());
                    List<SqlDb.Dcms_User> userList = query.GetList<SqlDb.Dcms_User>();
                    if (userList.Count > 0)
                    {
                        cateName = userList[0].User_Name;
                    }
                }
            }
            if (Id == 0)
            {
                this.Page.Title = "新建" + cateName;
                this.lit_Title.Text = "新建" + cateName;
                User_Id.Value = "0";
            }
            else if (Id > 0)
            {

                this.Page.Title = "编辑" + cateName;
                this.lit_Title.Text = "编辑" + cateName;
                lit_id.Text = Id.ToString();
                User_Id.Value = Id.ToString();
            }
            else
            {
                int thisId = 0;
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                    user.User_Id = Id;
                    IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_ID_.EqulesExp());
                    List<SqlDb.Dcms_User> userList = query.GetList<SqlDb.Dcms_User>();
                    if (userList.Count > 0)
                    {
                        thisId = userList[0].User_Id;
                    }
                }
                this.Page.Title = "编辑" + cateName;
                this.lit_Title.Text = "编辑" + cateName;
                lit_id.Text = thisId.ToString();
                User_Id.Value = thisId.ToString();
            }
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            iframeid = IRequest.GetQueryString("iframeid");
            int           CateId   = IRequest.GetQueryInt("cateid", 0);
            int           Id       = IRequest.GetQueryInt("id", -1);
            string        cateName = IRequest.GetQueryString("catename");
            StringBuilder sb       = new StringBuilder();

            sb.Append("<select name=\"User_LevelKey\" id=\"User_LevelKey\" style=\"width:200px\">\n");
            using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
            {
                SqlDb.Dcms_UserLevel userlevel = new SqlDb.Dcms_UserLevel();
                IQuery query = session.GetQuery(userlevel);
                List <SqlDb.Dcms_UserLevel> userlevelList = query.GetList <SqlDb.Dcms_UserLevel>();
                for (int i = 0; i < userlevelList.Count; i++)
                {
                    sb.Append(string.Format("<option value=\"{0}\">{1}</option>\n", Convert.ToString(userlevelList[i].UserLevel_Key), Convert.ToString(userlevelList[i].UserLevel_Title)));
                }
            }
            sb.Append("</select>");
            lit_UserLevel.Text = sb.ToString();
            if (Id > 0)
            {
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                    user.User_Id = Id;
                    IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_ID_.EqulesExp());
                    List <SqlDb.Dcms_User> userList = query.GetList <SqlDb.Dcms_User>();
                    if (userList.Count > 0)
                    {
                        cateName = userList[0].User_Name;
                    }
                }
            }
            if (Id == 0)
            {
                this.Page.Title     = "新建" + cateName;
                this.lit_Title.Text = "新建" + cateName;
                User_Id.Value       = "0";
            }
            else if (Id > 0)
            {
                this.Page.Title     = "编辑" + cateName;
                this.lit_Title.Text = "编辑" + cateName;
                lit_id.Text         = Id.ToString();
                User_Id.Value       = Id.ToString();
            }
            else
            {
                int thisId = 0;
                using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
                {
                    SqlDb.Dcms_User user = new SqlDb.Dcms_User();
                    user.User_Id = Id;
                    IQuery query = session.GetQuery(user).Where(SqlDb.Dcms_User._USER_ID_.EqulesExp());
                    List <SqlDb.Dcms_User> userList = query.GetList <SqlDb.Dcms_User>();
                    if (userList.Count > 0)
                    {
                        thisId = userList[0].User_Id;
                    }
                }
                this.Page.Title     = "编辑" + cateName;
                this.lit_Title.Text = "编辑" + cateName;
                lit_id.Text         = thisId.ToString();
                User_Id.Value       = thisId.ToString();
            }
        }
Esempio n. 8
0
 /// <summary>
 /// 编辑一条数据
 /// </summary>
 /// <returns>"true"/"false"</returns>
 private string doUpdate()
 {
     try
     {
         //int productsid = IRequest.GetQueryInt("productsid", 0);
         int userlevelid = IRequest.GetFormInt("UserLevel_Id", 0);
         if (userlevelid > 0)
         {
             using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
             {
                 SqlDb.Dcms_UserLevel userlevel = new SqlDb.Dcms_UserLevel();
                 userlevel.UserLevel_Id = userlevelid;
                 IQuery query = session.GetQuery(userlevel).Where(SqlDb.Dcms_UserLevel._USERLEVEL_ID_.EqulesExp());
                 IList<SqlDb.Dcms_UserLevel> userlevellist = query.GetList<SqlDb.Dcms_UserLevel>();
                 if (userlevellist.Count > 0)
                 {
                     userlevel = userlevellist[0];
                     UpdateModelByForm(userlevel, Request.Form);
                     session.Update(userlevel);
                 }
             }
         }
         return "true";
     }
     catch
     {
         return "false";
     }
 }
Esempio n. 9
0
        /// <summary>
        /// 按页取数据
        /// </summary>
        /// <returns>json</returns>
        private string doSelect()
        {
            StringBuilder sb = new StringBuilder();
            //取Grid提交来的数据开始
            //int uploadId = IRequest.GetQueryInt("id", 0);
            int rp = IRequest.GetFormInt("rp", 10);
            int page = IRequest.GetFormInt("page", 1);
            string keyword = Utils.chkSQL(IRequest.GetFormString("query"));
            string qtype = IRequest.GetFormString("qtype");
            int cateid = IRequest.GetQueryInt("cateid", 0);
            //string path = getUploadPathByUploadId(uploadId).Replace("\\", "/");
            //取Grid提交来的数据结束
            using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
            {
                SqlDb.Dcms_UserLevel position = new SqlDb.Dcms_UserLevel();
                //创建查询
                IQuery query = session.GetQuery(position);

                if (keyword.Length > 0)
                {
                    query.Where(SqlDb.Dcms_UserLevel._USERLEVEL_TITLE_.Like('%', keyword, '%'));
                }
                query.OrderBy(SqlDb.Dcms_UserLevel._USERLEVEL_ID_, Direction.DESC);
                //取总记录
                int totalCount = query.Count();
                List<SqlDb.Dcms_UserLevel> userlevelList = query.GetList<SqlDb.Dcms_UserLevel>(page, rp);
                //Json格式
                sb.Append("{\n");
                sb.Append("\"page\":" + page.ToString() + ",\n");
                sb.Append("\"total\":" + totalCount.ToString() + ",\n");
                sb.Append("\"rows\": [\n");
                for (int i = 0; i < userlevelList.Count; i++)
                {
                    sb.Append("{");
                    sb.Append(string.Format("\"id\":\"{0}\",\"cell\":[\"{1}\",\"{2}\",\"{3}\",\"{4}\"]", userlevelList[i].UserLevel_Id.ToString(), userlevelList[i].UserLevel_Id.ToString(), FormatJsonData(userlevelList[i].UserLevel_Title.ToString()), FormatJsonData(userlevelList[i].UserLevel_Key), userlevelList[i].UserLevel_AddTime.ToString("yyyy/MM/dd")));
                    if ((i + 1) == userlevelList.Count)
                    {
                        sb.Append("}\n");
                    }
                    else
                    {
                        sb.Append("},\n");
                    }
                }
                sb.Append("]\n");
                sb.Append("}");
            }
            return sb.ToString();
        }
Esempio n. 10
0
 /// <summary>
 /// 插入一条数据
 /// </summary>
 /// <returns>"true"/"false"</returns>
 private string doInsert()
 {
     try
     {
         using (ISession session = dbContext.Current().GetContext("SqlDb").GetSession())
         {
             SqlDb.Dcms_UserLevel userlevel = new SqlDb.Dcms_UserLevel();
             userlevel.UserLevel_AddTime = DateTime.Now;
             UpdateModelByForm(userlevel, Request.Form);
             session.Create(userlevel);
         }
         return "true";
     }
     catch
     {
         return "false";
     }
 }