Beispiel #1
0
        /// <summary>
        /// 得到实体对象
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public Model.Admin GetModel(string where)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from Admin ");
            if (where != "")
            {
                strSql.Append(" where " + where);
            }
            Model.Admin model = new Model.Admin();
            DataSet     ds    = DbHelperSQLite.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.RecordID desc");
            }
            strSql.Append(")AS Row, T.*  from SysParamInfo T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return(DbHelperSQLite.Query(strSql.ToString()));
        }
Beispiel #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.ScriptInfo GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select RecordID,ScriptName,ScriptDetails from ScriptInfo ");
            strSql.Append(" where ");
            SQLiteParameter[] parameters =
            {
            };

            Model.ScriptInfo model = new Model.ScriptInfo();
            DataSet          ds    = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.SysParamInfo GetModel(int RecordID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select RecordID,ItemName,ItemValue1,ItemValue2 from SysParamInfo ");
            strSql.Append(" where RecordID=@RecordID");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@RecordID", DbType.Int32, 4)
            };
            parameters[0].Value = RecordID;

            Model.SysParamInfo model = new Model.SysParamInfo();
            DataSet            ds    = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Agent GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,TrueName,Phone,Words,ComID,Account,PassWord,QQ,WeChat,Xiaoqu from Agent ");
            strSql.Append(" where ID=@ID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ID", DbType.Int32, 8)
            };
            parameters[0].Value = ID;

            Model.Agent model = new Model.Agent();
            DataSet     ds    = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.SiteConfig GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,Key,Value from SiteConfig ");
            strSql.Append(" where ID=@ID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ID", DbType.Int32, 8)
            };
            parameters[0].Value = ID;

            Model.SiteConfig model = new Model.SiteConfig();
            DataSet          ds    = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Company GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,Name,Address,Phone,OpenTime,Summary from Company ");
            strSql.Append(" where ID=@ID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ID", DbType.Int32, 8)
            };
            parameters[0].Value = ID;

            Model.Company model = new Model.Company();
            DataSet       ds    = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Admin GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,LoginName,Password,Power,NickName from Admin ");
            strSql.Append(" where ID=@ID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ID", DbType.Int32, 8)
            };
            parameters[0].Value = ID;

            Model.Admin model = new Model.Admin();
            DataSet     ds    = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #9
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Branch GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,BranchName,BranchAddress,BranchPhone,BranchDetail from Branch ");
            strSql.Append(" where ID=@ID");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ID", DbType.Int32, 4)
            };
            parameters[0].Value = ID;

            Model.Branch model = new Model.Branch();
            DataSet      ds    = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #10
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.ExchangeInfo GetModel(int RecordID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select RecordID,HotKeyID,ExchangeText,ShiftKey,MainKey from ExchangeInfo ");
            strSql.Append(" where RecordID=@RecordID");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@RecordID", DbType.Int32, 4)
            };
            parameters[0].Value = RecordID;

            Model.ExchangeInfo model = new Model.ExchangeInfo();
            DataSet            ds    = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #11
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.House GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,Type,JingPin,Qu,XiaoQu,Ceng,ZongCeng,Shi,Ting,Wei,MianJi,ZhuangXiu,Jianyu,JiaGe,JiaGeDanwei,Chaoxiang,Chanquan,JieGou,ZhuJiMa,FyHao,DengJiTime,JJR,JJRPhone,Title,Detail from House ");
            strSql.Append(" where ID=@ID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ID", DbType.Int32, 8)
            };
            parameters[0].Value = ID;

            Model.House model = new Model.House();
            DataSet     ds    = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(new Model.House().DefaultHouse());
            }
        }
Beispiel #12
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Pic GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,ImageURL,AID,Type,Number,Title,Summary from Pic ");
            strSql.Append(" where ID=@ID");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ID", DbType.Int32, 4)
            };
            parameters[0].Value = ID;

            Model.Pic model = new Model.Pic();
            DataSet   ds    = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }