private string GetDeleteSql(PageBaseInfo obj)
        {
            string sql = "delete from {0} where page_id = '{1}'";

            sql = string.Format(sql, _pageTableName, obj.page_id);
            return(sql);
        }
Beispiel #2
0
        /// <summary>
        /// 页面实体解析成页面类
        /// </summary>
        /// <param name="pageObj"></param>
        /// <returns></returns>
        public xinlongyuForm DecodePage(PageInfoDetail pageObj, bool isNavigationWindow)
        {
            //页面基本信息
            PageBaseInfo dtObj = pageObj.data;

            if (object.Equals(dtObj.control_list, null))
            {
                return(null);
            }
            try
            {
                List <ControlDetailForPage> listControlObject = ControlCaster.CastArrayToControl(dtObj.control_list);

                //判断一下解析出来的控件数组是不是为空
                if (object.Equals(listControlObject, null) || listControlObject.Count < 1)
                {
                    return(null);
                }

                var page = this.DecodeListControlObj(listControlObject, isNavigationWindow);
                if (!object.Equals(page, null))
                {
                    page.Title = pageObj.data.page_name;                            //设置标题
                }
                return(page);
            }
            catch (Exception ex)
            {
                Logging.Error(ex.Message);
                return(null);
            }
        }
        /// <summary>
        /// 获取更新的语句
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        private string GetUpdateSql(PageBaseInfo obj)
        {
            string        updateSql = "update {0} set {1} where page_id = '{2}'";
            string        values    = string.Empty;
            StringBuilder sb        = new StringBuilder(500);

            foreach (var prop in obj.GetType().GetFields())
            {
                if (sb.Length < 1)
                {
                    sb.Append(prop.Name + "=" + prop.GetValue(obj));
                }
                else
                {
                    sb.Append("," + prop.Name + "=" + prop.GetValue(obj));
                }
            }
            updateSql = string.Format(updateSql, _pageTableName, sb.ToString(), obj.page_id);
            return(updateSql);
        }
        /// <summary>
        /// 获取页面基本信息
        /// </summary>
        /// <param name="pageid"></param>
        /// <returns></returns>
        private PageBaseInfo GetPageBaseInfo(int pageid)
        {
            string sql = @"select page_id, page_name, page_width, page_height, last_time from hs_new_pages where page_id = '{0}'";

            sql = string.Format(sql, pageid);
            SQLiteDataReader reader = this.ExcuteReader(sql);

            while (reader.Read())
            {
                PageBaseInfo obj = new PageBaseInfo();
                obj.page_id     = int.Parse(reader[0].ToString());
                obj.page_name   = reader[1].ToString();
                obj.page_width  = int.Parse(reader[2].ToString());
                obj.page_height = int.Parse(reader[3].ToString());
                obj.last_time   = int.Parse(reader[4].ToString());
                return(obj);
            }
            reader.Close();
            this._connection.Close();
            return(null);
        }