去除静态变量Funs.DB
This commit is contained in:
@@ -11,9 +11,6 @@ namespace BLL
|
||||
|
||||
public static class Base_FactoryService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
@@ -25,7 +22,7 @@ namespace BLL
|
||||
}
|
||||
public static List<Model.Base_Factory> GetBase_FactoryByModle(Model.Base_Factory table)
|
||||
{
|
||||
var q = from x in db.Base_Factory
|
||||
var q = from x in Funs.DB.Base_Factory
|
||||
where
|
||||
(string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) &&
|
||||
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
|
||||
@@ -39,7 +36,7 @@ namespace BLL
|
||||
}
|
||||
public static List<Model.Base_Factory> GetBase_FactoryList()
|
||||
{
|
||||
var q = (from x in db.Base_Factory orderby x.FactoryCode select x).ToList();
|
||||
var q = (from x in Funs.DB.Base_Factory orderby x.FactoryCode select x).ToList();
|
||||
|
||||
|
||||
return q;
|
||||
@@ -74,14 +71,14 @@ namespace BLL
|
||||
|
||||
public static Model.Base_Factory GetBase_FactoryById(string FactoryId)
|
||||
{
|
||||
return db.Base_Factory.FirstOrDefault(x => x.FactoryId == FactoryId);
|
||||
return Funs.DB.Base_Factory.FirstOrDefault(x => x.FactoryId == FactoryId);
|
||||
}
|
||||
public static string GetBase_FactoryNameById(object FactoryId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
if (FactoryId!=null)
|
||||
{
|
||||
var model = db.Base_Factory.FirstOrDefault(x => x.FactoryId == FactoryId.ToString());
|
||||
var model = Funs.DB.Base_Factory.FirstOrDefault(x => x.FactoryId == FactoryId.ToString());
|
||||
if (model != null)
|
||||
{
|
||||
name = model.FactoryName;
|
||||
@@ -92,7 +89,7 @@ namespace BLL
|
||||
}
|
||||
public static Model.Base_Factory GetBase_FactoryByCode(string FactoryCode)
|
||||
{
|
||||
return db.Base_Factory.FirstOrDefault(x => x.FactoryCode == FactoryCode);
|
||||
return Funs.DB.Base_Factory.FirstOrDefault(x => x.FactoryCode == FactoryCode);
|
||||
}
|
||||
public static void AddBase_Factory(Model.Base_Factory newtable)
|
||||
{
|
||||
@@ -106,22 +103,22 @@ namespace BLL
|
||||
Address = newtable.Address,
|
||||
MapCoordinates= newtable.MapCoordinates,
|
||||
};
|
||||
db.Base_Factory.InsertOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
Funs.DB.Base_Factory.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
public static void AddBulkBase_Factory(List<Model.Base_Factory> newtables)
|
||||
{
|
||||
|
||||
db.Base_Factory.InsertAllOnSubmit(newtables);
|
||||
db.SubmitChanges();
|
||||
Funs.DB.Base_Factory.InsertAllOnSubmit(newtables);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
public static void UpdateBase_Factory(Model.Base_Factory newtable)
|
||||
{
|
||||
|
||||
Model.Base_Factory table = db.Base_Factory.FirstOrDefault(x => x.FactoryId == newtable.FactoryId);
|
||||
Model.Base_Factory table = Funs.DB.Base_Factory.FirstOrDefault(x => x.FactoryId == newtable.FactoryId);
|
||||
if (table != null)
|
||||
{
|
||||
table.FactoryId = newtable.FactoryId;
|
||||
@@ -130,28 +127,28 @@ namespace BLL
|
||||
table.FactoryName = newtable.FactoryName;
|
||||
table.Address = newtable.Address;
|
||||
table.MapCoordinates = newtable.MapCoordinates;
|
||||
db.SubmitChanges();
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteBase_FactoryById(string FactoryId)
|
||||
{
|
||||
|
||||
Model.Base_Factory table = db.Base_Factory.FirstOrDefault(x => x.FactoryId == FactoryId);
|
||||
Model.Base_Factory table = Funs.DB.Base_Factory.FirstOrDefault(x => x.FactoryId == FactoryId);
|
||||
if (table != null)
|
||||
{
|
||||
db.Base_Factory.DeleteOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
Funs.DB.Base_Factory.DeleteOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void DeleteALLBase_Factory()
|
||||
{
|
||||
if (db.Base_Factory != null)
|
||||
if (Funs.DB.Base_Factory != null)
|
||||
{
|
||||
db.Base_Factory.DeleteAllOnSubmit(db.Base_Factory);
|
||||
db.SubmitChanges();
|
||||
Funs.DB.Base_Factory.DeleteAllOnSubmit(Funs.DB.Base_Factory);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
public static void InitBase_FactoryDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
|
||||
Reference in New Issue
Block a user