Esempio n. 1
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static IEnumerable <DC_ARMY_EQUIP_Model> getModelList(DC_ARMY_EQUIP_SW sw)
        {
            var result = new List <DC_ARMY_EQUIP_Model>();

            DataTable dt   = BaseDT.DC_ARMY_EQUIP.getDT(sw);//列表
            DataTable dt36 = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "36"
            });                                                                              //使用现状

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DC_ARMY_EQUIP_Model m = new DC_ARMY_EQUIP_Model();
                m.DC_ARMY_EQUIP_ID  = dt.Rows[i]["DC_ARMY_EQUIP_ID"].ToString();
                m.DC_ARMY_ID        = dt.Rows[i]["DC_ARMY_ID"].ToString();
                m.EQUIPNAME         = dt.Rows[i]["EQUIPNAME"].ToString();
                m.EQUIPNUM          = dt.Rows[i]["EQUIPNUM"].ToString();
                m.EQUIPMODEL        = dt.Rows[i]["EQUIPMODEL"].ToString();
                m.EQUIPUSESTATE     = dt.Rows[i]["EQUIPUSESTATE"].ToString();
                m.EQUIPUSESTATEName = BaseDT.T_SYS_DICT.getName(dt36, m.EQUIPUSESTATE);
                m.EQUIPSUM          = dt.Rows[i]["EQUIPSUM"].ToString();
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取记录
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static DataTable getDT(DC_ARMY_EQUIP_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" FROM      DC_ARMY_EQUIP");
            sb.AppendFormat(" WHERE   1=1");
            if (string.IsNullOrEmpty(sw.DC_ARMY_EQUIP_ID) == false)
            {
                sb.AppendFormat(" AND DC_ARMY_EQUIP_ID = '{0}'", ClsSql.EncodeSql(sw.DC_ARMY_EQUIP_ID));
            }
            if (string.IsNullOrEmpty(sw.DC_ARMY_ID) == false)
            {
                sb.AppendFormat(" AND DC_ARMY_ID = '{0}'", ClsSql.EncodeSql(sw.DC_ARMY_ID));
            }
            if (string.IsNullOrEmpty(sw.EQUIPNAME) == false)
            {
                sb.AppendFormat(" AND EQUIPNAME = '{0}'", ClsSql.EncodeSql(sw.EQUIPNAME));
            }
            if (string.IsNullOrEmpty(sw.EQUIPNUM) == false)
            {
                sb.AppendFormat(" AND EQUIPNUM = '{0}'", ClsSql.EncodeSql(sw.EQUIPNUM));
            }
            if (string.IsNullOrEmpty(sw.EQUIPMODEL) == false)
            {
                sb.AppendFormat(" AND EQUIPMODEL = '{0}'", ClsSql.EncodeSql(sw.EQUIPMODEL));
            }
            if (string.IsNullOrEmpty(sw.EQUIPUSESTATE) == false)
            {
                sb.AppendFormat(" AND EQUIPUSESTATE = '{0}'", ClsSql.EncodeSql(sw.EQUIPUSESTATE));
            }
            if (string.IsNullOrEmpty(sw.EQUIPSUM) == false)
            {
                sb.AppendFormat(" AND EQUIPSUM = '{0}'", ClsSql.EncodeSql(sw.EQUIPSUM));
            }
            string sql = "";

            sql = "SELECT DC_ARMY_EQUIP_ID, DC_ARMY_ID,EQUIPNAME,EQUIPNUM, EQUIPMODEL, EQUIPUSESTATE, EQUIPSUM"
                  + sb.ToString()
                  + " order by DC_ARMY_ID";

            DataSet ds = DataBaseClass.FullDataSet(sql);

            return(ds.Tables[0]);
        }