本文整理汇总了C#中WSV.DAL.DataBase类的典型用法代码示例。如果您正苦于以下问题:C# DataBase类的具体用法?C# DataBase怎么用?C# DataBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataBase类属于WSV.DAL命名空间,在下文中一共展示了DataBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Data_Add
/// <summary>
/// ���������
/// </summary>
/// <param name="s_Pr"></param>
/// <returns></returns>
public static string Data_Add(string s_Pr)
{
string CodeA = "";
DataBase db = new DataBase();
DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
SqlParameter[] prams ={
db.MakeInParam("@Flag", SqlDbType.VarChar,50,s_Pr)
};
SqlDataReader dr = null;
try
{
db.GetDataReader(visitor, prams, out dr, "D_Add");
if (dr.Read())
{
CodeA = dr["Code"].ToString();
}
dr.Close();
}
catch (Exception ex)
{ throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
return CodeA;
}
示例2: BillInfoSql
/// <summary>
/// 查询出所有的数据
/// </summary>
/// <returns>返回数据源</returns>
public static string BillInfoSql(string Code)
{
string retSql = "";
DataBase db = new DataBase();
DataBaseVisitor visitor = new BillInfoDAL();
SqlDataReader myread;
try
{
db.GetDataReader(visitor, null, out myread, "BillInfoSql");
while(myread.Read())
{
retSql += "," + myread["DBName"].ToString().Trim()+" as " + myread["Name"].ToString().Trim();
}
myread.Close();
retSql= retSql.Substring(1);
retSql = "Select " + retSql + " From V_D_Saver_D Where Code='"+Code.Trim()+"'";
}
catch (Exception ex)
{
throw ex;
}
finally
{
db.Dispose();
}
return retSql;
}
示例3: BillPrint
/// <summary>
/// 查询出所有的数据
/// </summary>
/// <returns>返回数据源</returns>
public static DataSet BillPrint(string Code,string TableName)
{
string retSql = "";
DataBase db = new DataBase();
DataBaseVisitor visitor = new BillInfoDAL();
DataSet ds = new DataSet();
try
{
ds = db.ReturnDataSet(BillInfoSql(Code), TableName);
//在程序中表示的名字给Capion
int i=0;
foreach (DataRow row in BillInfoColName().Tables[0].Rows)
{
ds.Tables[TableName].Columns[i].Caption = row[0].ToString().Trim();
i++;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
db.Dispose();
}
return ds;
}
示例4: MaxID
/// <summary>
/// 最大ID
/// </summary>
/// <param name="Content"></param>
/// <returns></returns>
public static long MaxID()
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new WSV.DAL.MyLog.DL_Run();
long ret_V = 0;
try
{
SqlDataReader dr;
db.GetDataReader(visitor,null,out dr, "MaxID");
if (dr.Read())
{
if(dr[0] !=null)
ret_V = long.Parse(dr[0].ToString());
}
ret_V += 1;
//ds = db.ReturnDataSet(visitor, prams, "Select");
}
catch (Exception ex)
{ return 0; throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
return ret_V;
}
示例5: Insert
/// <summary>
/// 插入一条操作记录,并返回他的编号
/// </summary>
/// <param name="Content"></param>
/// <returns></returns>
public static string Insert(string Content)
{
string ret_Code = MaxID().ToString();
DataBase db = new DataBase();
DataBaseVisitor visitor = new WSV.DAL.MyLog.DL_Run();
SqlParameter[] prams ={
db.MakeInParam("@ID", SqlDbType.BigInt,8, long.Parse(ret_Code)),
db.MakeInParam("@Code", SqlDbType.VarChar,50,ret_Code),
db.MakeInParam("@Work", SqlDbType.VarChar,50, Content),
db.MakeInParam("@InTime", SqlDbType.DateTime,8, DateTime.Now),
db.MakeInParam("@OperCode", SqlDbType.VarChar,50, Model.User.LUser.Code),
db.MakeInParam("@TableNum", SqlDbType.VarChar,50, Model.User.LUser.TableNum)
};
try
{
db.TransactSql(visitor, "Insert", prams);
}
catch (Exception ex)
{ throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
return ret_Code;
}
示例6: Insert
/// <summary>
/// 添加数据
/// </summary>
/// <param name="Item">model</param>
/// <returns>"0101"表示成功,"0"表示失败</returns>
public static string Insert(D_CarCodeModel Item)
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new D_CarCodeVisitor();
bool bSuc = false;
int nEffectRows = 0;
SqlParameter[] prams ={
db.MakeInParam("@ID", SqlDbType.BigInt,50, PublicFun.PublicFun.MaxId("D_CarCode")),
db.MakeInParam("@Code", SqlDbType.VarChar,50, Item.Code),
db.MakeInParam("@CarCode", SqlDbType.VarChar,50, Item.CarCode),
db.MakeInParam("@Tare", SqlDbType.Float,12, Item.Tare),
db.MakeInParam("@Driver", SqlDbType.VarChar,50, Item.Driver),
};
try
{
bSuc = db.TransactSql(visitor, "Insert", prams, out nEffectRows);
}
catch (Exception ex) { throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
if (bSuc && nEffectRows > 0)
return "0101";
else
return "0";
}
示例7: Update
/// <summary>
/// 修改数据
/// </summary>
/// <param name="Item">model</param>
/// <returns></returns>
public static bool Update(D_Bill Item)
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new BillDAL();
bool Flag = false, ReFlag = false;
int N = 0;
SqlParameter[] prams ={
db.MakeInParam("@BillName", SqlDbType.VarChar,50, Item.BillName),
db.MakeInParam("@PrintTitle", SqlDbType.VarChar,50, Item.PrintTitle),
db.MakeInParam("@Preview", SqlDbType.Bit,50, Item.Preview),
db.MakeInParam("@Id", SqlDbType.BigInt,0,Item.Id)
};
try
{
ReFlag = db.TransactSql(visitor, "Update", prams, out N);
}
catch (Exception ex)
{
throw ex;
}
finally
{
db.Dispose();
}
if (ReFlag && N > 0)
{
Flag = true;
}
return Flag;
}
示例8: AddMaintenance
public static string AddMaintenance(Model.MyLog.DL_Maintenance DL_MainItem)
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new WSV.DAL.MyLog.OperData();
bool bSuc = false;
int nEffectRows = 0;
SqlParameter[] prams ={
db.MakeInParam("@ID", SqlDbType.Float,50, DL_MainItem.ID),
db.MakeInParam("@TableNum", SqlDbType.VarChar,50,DL_MainItem.TableNum),
db.MakeInParam("@SaverCode", SqlDbType.VarChar,50, DL_MainItem.SaverCode),
db.MakeInParam("@WorkCode", SqlDbType.VarChar,50, DL_MainItem.WorkCode),
db.MakeInParam("@OperCode", SqlDbType.VarChar,50, DL_MainItem.OperCode),
};
try
{
bSuc = db.TransactSql(visitor, "AddMaintenance", prams, out nEffectRows);
}
catch (Exception ex) { throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
if (bSuc && nEffectRows > 0)
return "0101";
else
return "0";
}
示例9: CheckKey
/// <summary>
/// 检查主键
/// </summary>
/// <param name="Tab">表名</param>
/// <param name="key">要检查的字段名</param>
/// <param name="value">要检查的值</param>
/// <param name="Id">Id等于0代表添加操作,否则就是修改操作</param>
public static bool CheckKey(string Tab, string key, string value, long Id)
{
bool Flag = false;
DataBase db = new DataBase();
SqlDataReader dr = null;
try
{
if (Id == 0)
{
db.GetDataReader(out dr, "select * from " + Tab + " where " + key + "='" + value + "'");
if (dr.Read()) { Flag = true; }
}
else
{
db.GetDataReader(out dr, "select * from " + Tab + " where Id<>" + Id + " and " + key + "='" + value + "'");
if (dr.Read()) { Flag = true; }
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
dr.Close();
db.Dispose();
}
return Flag;
}
示例10: SelectByName
/// <summary>
/// 根据名字查询编号
/// </summary>
/// <returns></returns>
public static string SelectByName(string Name)
{
string Code = "";
DataBase db = new DataBase();
DataBaseVisitor visitor = new DC_BaseVisitor();
SqlDataReader dr = null;
SqlParameter[] prams ={
db.MakeInParam("@Name", SqlDbType.VarChar,50, Name),
};
try
{
db.GetDataReader(visitor, prams, out dr, "SelectByName");
if (dr.Read())
{
Code = dr["Code"].ToString();
}
}
catch (Exception ex)
{ throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
return Code;
}
示例11: Insert
/// <summary>
/// �������
/// </summary>
/// <param name="Item">model</param>
/// <returns></returns>
public static string Insert(Model.Count.D_StatProjectModel Item)
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new DAL.Count.D_StatProjectDal();
bool bSuc = false;
int nEffectRows = 0;
SqlParameter[] prams ={
db.MakeInParam("@ID", SqlDbType.VarChar,50, PublicFun.PublicFun.MaxId("D_StatProject")),
db.MakeInParam("@Code", SqlDbType.VarChar,50,PublicFun.PublicFun.MaxId("D_StatProject")),
db.MakeInParam("@Name", SqlDbType.VarChar,50, Item.Name),
};
try
{
bSuc = db.TransactSql(visitor, "Insert", prams, out nEffectRows);
}
catch (Exception ex) { throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
if (bSuc && nEffectRows > 0)
return "0101";
else
return "0";
}
示例12: Update
/// <summary>
/// 修改数据
/// </summary>
/// <param name="Item">model</param>
/// <returns></returns>
public static string Update(DC_BaseModel Item)
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new DC_BaseVisitor();
bool bSuc = false;
int nEffectRows = 0;
SqlParameter[] prams ={
db.MakeInParam("@Code", SqlDbType.VarChar,50, Item.Code),
db.MakeInParam("@Name", SqlDbType.VarChar,50, Item.Name),
db.MakeInParam("@AS", SqlDbType.VarChar,50, Item.AS),
db.MakeInParam("@Flag", SqlDbType.VarChar,50, Item.Flag),
db.MakeInParam("@Rank", SqlDbType.VarChar,50, Item.Rank),
db.MakeInParam("@ID", SqlDbType.VarChar,50, Item.ID),
};
try
{
bSuc = db.TransactSql(visitor, "Update", prams, out nEffectRows);
}
catch (Exception ex) { throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
if (bSuc && nEffectRows > 0)
return "0101";
else
return "0";
}
示例13: AddCurve
public static bool AddCurve(string Code, WSV.Model.Weight.WeightModel value)
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new DAL.MyLog.DL_WeightVisitor();
bool retvalue = true;
SqlParameter[] prams ={
db.MakeInParam("@Code",SqlDbType.VarChar,50,Code)
};
SqlDataReader Reader = null;
try
{
db.GetDataReader(visitor, prams, out Reader, "AddCurve");
if (Reader.Read())
{
value.StateFun.Curve = (byte[])Reader["Curve"];
}
else
{
retvalue = false;
}
}
catch (Exception e)
{
db.Dispose();
return false;
}
finally
{
db.Dispose();
}
return retvalue;
}
示例14: CheckRolePower
/// <summary>
/// 查询角色是否拥有某个权限
/// </summary>
/// <param name="RoleCode">角色编号</param>
/// <param name="PowerCode">权限编号</param>
/// <returns></returns>
public static bool CheckRolePower(string RuleName)
{
if (LUser.Id <= 2)
return true;
DataBase db = new DataBase();
DataBaseVisitor visitor = new RoleDAL();
bool Flag = false;
SqlParameter[] prams ={
db.MakeInParam("@RoleCode", SqlDbType.VarChar,50,LUser.Role),
db.MakeInParam("@RuleName", SqlDbType.VarChar,50,RuleName)
};
try
{
SqlDataReader dr;
db.GetDataReader(visitor, prams, out dr, "CheckRolePower");
if (dr.Read())
{
Flag = true;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
db.Dispose();
}
return Flag;
}
示例15: Update
public static string Update(Model.Video.D_Video Item)
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new DAL.Video.VideoVisitor();
bool bSuc = false;
int nEffectRows = 0;
SqlParameter[] prams ={
db.MakeInParam("@VIDEOname",SqlDbType .Char ,10,Item.VIDEO_name),
db.MakeInParam("@VIDEOtable",SqlDbType .VarChar ,50,Item.VIDEO_table ),
db.MakeInParam("@VIDEOStandard",SqlDbType.Int ,4,Item.VIDEO_Standard ),
db.MakeInParam("@VIDEOSource",SqlDbType.Int,4,Item.VIDEO_Source ),
db.MakeInParam("@VIDEOBrightness",SqlDbType.Int,4,Item.VIDEO_Brightness ),
db.MakeInParam("@VIDEOContrast",SqlDbType.Int,4,Item.VIDEO_Contrast ),
db.MakeInParam("@VIDEOHue",SqlDbType.Int,4,Item.VIDEO_Hue ),
db.MakeInParam("@VIDEOSaturation",SqlDbType.Int,4,Item.VIDEO_Saturation ),
db.MakeInParam("@VIDEOSuality",SqlDbType.Int,4,Item.VIDEO_Suality)
};
try
{
bSuc = db.TransactSql(visitor, "Set_Video", prams, out nEffectRows);
}
catch (Exception ex) { throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
if (bSuc && nEffectRows > 0)
return "0101";
else
return "0";
}