/// <summary> /// 添加数据 /// </summary> /// <param name="Item">model</param> /// <returns></returns> public static bool Insert(DC_LoadoMeter Item) { DataBase db = new DataBase(); DataBaseVisitor visitor = new LoadoMeterDAL(); bool Flag = false, ReFlag = false; int N = 0; SqlParameter[] prams ={ db.MakeInParam("@Id", SqlDbType.BigInt,0,PublicFun.PublicFun.MaxId("DC_LoadoMeter")), db.MakeInParam("@TableNum", SqlDbType.VarChar,50, Item.TableNum), db.MakeInParam("@Name", SqlDbType.VarChar,50, Item.Name), db.MakeInParam("@Ip", SqlDbType.VarChar,50, Item.Ip), db.MakeInParam("@Port", SqlDbType.VarChar,50, Item.Port), db.MakeInParam("@Remark", SqlDbType.VarChar,255, Item.Remark) }; try { ReFlag = db.TransactSql(visitor, "Insert", prams, out N); } catch (Exception ex) { throw ex; } finally { db.Dispose(); } if (ReFlag && N > 0) { Flag = true; } return Flag; }
/// <summary> /// 查询出所有的数据 /// </summary> /// <returns>返回数据源</returns> public static DataSet SelectAll(string WhereSql) { DataBase db = new DataBase(); DataBaseVisitor visitor = new LoadoMeterDAL(); DataSet ds = new DataSet(); try { ds = db.ReturnDataSet(visitor, "Select", "DC_LoadoMeter", WhereSql); } catch (Exception ex) { throw ex; } finally { db.Dispose(); } return ds; }