Beispiel #1
0
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static DataTable getDT(DC_WATCHTOWERUSER_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("    from    DC_WATCHTOWERUSER a ");
            sb.AppendFormat("where 1=1");
            if (string.IsNullOrEmpty(sw.DC_WATCHTOWERUSERID) == false)
            {
                sb.AppendFormat("and DC_WATCHTOWERUSERID = '{0}'", ClsSql.EncodeSql(sw.DC_WATCHTOWERUSERID));
            }
            if (string.IsNullOrEmpty(sw.WATCHTOWERID) == false)
            {
                sb.AppendFormat("and WATCHTOWERID = '{0}'", ClsSql.EncodeSql(sw.WATCHTOWERID));
            }
            if (string.IsNullOrEmpty(sw.FTNAME) == false)
            {
                sb.AppendFormat("and FTNAME = '{0}'", ClsSql.EncodeSql(sw.FTNAME));
            }
            if (string.IsNullOrEmpty(sw.BIRTH) == false)
            {
                sb.AppendFormat("and BIRTH = '{0}'", ClsSql.EncodeSql(sw.BIRTH));
            }
            if (string.IsNullOrEmpty(sw.PHOTO) == false)
            {
                sb.AppendFormat("and PHOTO = '{0}'", ClsSql.EncodeSql(sw.PHOTO));
            }
            if (string.IsNullOrEmpty(sw.LINKWAY) == false)
            {
                sb.AppendFormat("and LINKWAY = '{0}'", ClsSql.EncodeSql(sw.LINKWAY));
            }
            if (string.IsNullOrEmpty(sw.SEX) == false)
            {
                sb.AppendFormat("and SEX= '{0}'", ClsSql.EncodeSql(sw.SEX));
            }
            if (string.IsNullOrEmpty(sw.ORDERBY) == false)
            {
                sb.AppendFormat("and ORDERBY = '{0}'", ClsSql.EncodeSql(sw.ORDERBY));
            }
            if (string.IsNullOrEmpty(sw.NATION) == false)
            {
                sb.AppendFormat("and NATION = '{0}'", ClsSql.EncodeSql(sw.NATION));
            }
            if (string.IsNullOrEmpty(sw.NATION) == false)
            {
                sb.AppendFormat("and USERJOB = '{0}'", ClsSql.EncodeSql(sw.USERJOB));
            }
            string  sql = ("select DC_WATCHTOWERUSERID,WATCHTOWERID,FTNAME,BIRTH,SEX,NATION,USERJOB,LINKWAY,PHOTO,ORDERBY") + sb.ToString() + ("order by DC_WATCHTOWERUSERID ");
            DataSet ds  = DataBaseClass.FullDataSet(sql);

            return(ds.Tables[0]);
        }
Beispiel #2
0
        /// <summary>
        /// 单条瞭望塔人员
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static DC_WATCHTOWERUSER_Model getModel(DC_WATCHTOWERUSER_SW sw)
        {
            DataTable dt = BaseDT.DC_WATCHTOWERUSER.getDT(sw);
            DC_WATCHTOWERUSER_Model m = new DC_WATCHTOWERUSER_Model();

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                m.DC_WATCHTOWERUSERID = dt.Rows[i]["DC_WATCHTOWERUSERID"].ToString();
                m.WATCHTOWERID        = dt.Rows[i]["WATCHTOWERID"].ToString();
                m.FTNAME  = dt.Rows[i]["FTNAME"].ToString();
                m.BIRTH   = dt.Rows[i]["BIRTH"].ToString();
                m.SEX     = dt.Rows[i]["SEX"].ToString();
                m.NATION  = dt.Rows[i]["NATION"].ToString();
                m.USERJOB = dt.Rows[i]["USERJOB"].ToString();
                m.LINKWAY = dt.Rows[i]["LINKWAY"].ToString();
                m.PHOTO   = dt.Rows[i]["PHOTO"].ToString();
                m.ORDERBY = dt.Rows[i]["ORDERBY"].ToString();
            }
            dt.Dispose();
            dt.Clear();
            return(m);
        }
Beispiel #3
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static IEnumerable <DC_WATCHTOWERUSER_Model> getListModel(DC_WATCHTOWERUSER_SW sw)
        {
            DataTable dt     = BaseDT.DC_WATCHTOWERUSER.getDT(sw);
            var       result = new List <DC_WATCHTOWERUSER_Model>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DC_WATCHTOWERUSER_Model m = new DC_WATCHTOWERUSER_Model();
                m.DC_WATCHTOWERUSERID = dt.Rows[i]["DC_WATCHTOWERUSERID"].ToString();
                m.WATCHTOWERID        = dt.Rows[i]["WATCHTOWERID"].ToString();
                m.FTNAME  = dt.Rows[i]["FTNAME"].ToString();
                m.BIRTH   = dt.Rows[i]["BIRTH"].ToString();
                m.SEX     = dt.Rows[i]["SEX"].ToString();
                m.NATION  = dt.Rows[i]["NATION"].ToString();
                m.USERJOB = dt.Rows[i]["USERJOB"].ToString();
                m.LINKWAY = dt.Rows[i]["LINKWAY"].ToString();
                m.PHOTO   = dt.Rows[i]["PHOTO"].ToString();
                m.ORDERBY = dt.Rows[i]["ORDERBY"].ToString();
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            return(result);
        }