Ejemplo n.º 1
0
		/// <summary>
		/// 根据条件得到一个对象实体
		/// </summary>
		public DB_Talk.Model.m_StaticRoute GetModel(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("  select top 1 ");
			strSql.Append("  ID, BoxID, vc_NetIP, vc_Mask, vc_GateWayIP, vc_Memo, i_Flag  ");			
			strSql.Append("  from m_StaticRoute ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			DB_Talk.Model.m_StaticRoute model=new DB_Talk.Model.m_StaticRoute();
			DataSet ds=GetDataSet(strSql.ToString());
			if(ds!=null && ds.Tables[0].Rows.Count>0)
			{
                model=DataTableToList(ds)[0];						
				return model;
			}
			else
			{
				return null;
			}
		}
Ejemplo n.º 2
0
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<DB_Talk.Model.m_StaticRoute> DataTableToList(DataSet ds)
		{
			List<DB_Talk.Model.m_StaticRoute> modelList = new List<DB_Talk.Model.m_StaticRoute>();
			if (ds == null) return modelList;
            DataTable dt = ds.Tables[0];
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				DB_Talk.Model.m_StaticRoute model;
				for (int n = 0; n < rowsCount; n++)
				{
				  model = new DB_Talk.Model.m_StaticRoute();	
                  if(dt.Rows[n]["ID"]!=null && dt.Rows[n]["ID"].ToString()!="")
				  {
				      model.ID=int.Parse(dt.Rows[n]["ID"].ToString());
				  }
				  if(dt.Rows[n]["BoxID"]!=null && dt.Rows[n]["BoxID"].ToString()!="")
				  {
				      model.BoxID=int.Parse(dt.Rows[n]["BoxID"].ToString());
				  }
				  if(dt.Rows[n]["vc_NetIP"]!=null && dt.Rows[n]["vc_NetIP"].ToString()!="")
				  {
				     model.vc_NetIP= dt.Rows[n]["vc_NetIP"].ToString();
				  }
				  if(dt.Rows[n]["vc_Mask"]!=null && dt.Rows[n]["vc_Mask"].ToString()!="")
				  {
				     model.vc_Mask= dt.Rows[n]["vc_Mask"].ToString();
				  }
				  if(dt.Rows[n]["vc_GateWayIP"]!=null && dt.Rows[n]["vc_GateWayIP"].ToString()!="")
				  {
				     model.vc_GateWayIP= dt.Rows[n]["vc_GateWayIP"].ToString();
				  }
				  if(dt.Rows[n]["vc_Memo"]!=null && dt.Rows[n]["vc_Memo"].ToString()!="")
				  {
				     model.vc_Memo= dt.Rows[n]["vc_Memo"].ToString();
				  }
				  if(dt.Rows[n]["i_Flag"]!=null && dt.Rows[n]["i_Flag"].ToString()!="")
				  {
				      model.i_Flag=int.Parse(dt.Rows[n]["i_Flag"].ToString());
				  }
				   modelList.Add(model);
				
				}
			}
			return modelList;
		}
Ejemplo n.º 3
0
        //查询静态路由
        public static bool GetStaticRouting(out List<DB_Talk.Model.m_StaticRoute> lst)
        {
            byte[] byteArray = new byte[ArraySizeBig];
            int count = 0;
            bool b = MBoxSDK.ConfigSDK.MBOX_GetStaticRouting(Global.Params.BoxHandle, byteArray, (UInt32)byteArray.Length, ref count);
            lst = new List<DB_Talk.Model.m_StaticRoute>();
            if (b)
            {
                string str = System.Text.Encoding.Default.GetString(byteArray);
                str = str.Replace("\0", "");
                string[] strArray = str.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < strArray.Length; i++)
                {
                    string[] strArray2 = strArray[i].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    DB_Talk.Model.m_StaticRoute m = new DB_Talk.Model.m_StaticRoute();
                    m.vc_NetIP = strArray2[0];
                    m.vc_Mask = strArray2[1];
                    m.vc_GateWayIP = strArray2[2];
                    m.BoxID = Global.Params.BoxID;
                    lst.Add(m);
                }
            }
            return b;

          
           
        }