1
This commit is contained in:
@@ -11,8 +11,6 @@ namespace BLL
|
||||
|
||||
public static class Base_FactoryService
|
||||
{
|
||||
public static Model.CNPCDB db = Funs.DB;
|
||||
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
@@ -25,13 +23,14 @@ namespace BLL
|
||||
}
|
||||
public static List<Model.Base_Factory> GetBase_FactoryByModle(Model.Base_Factory table)
|
||||
{
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
var q = from x in db.Base_Factory
|
||||
where
|
||||
(string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) &&
|
||||
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
|
||||
(string.IsNullOrEmpty(table.FactoryCode) || x.FactoryCode.Contains(table.FactoryCode)) &&
|
||||
(string.IsNullOrEmpty(table.FactoryName) || x.FactoryName.Contains(table.FactoryName)) &&
|
||||
(string.IsNullOrEmpty(table.Address) || x.Address.Contains(table.Address))
|
||||
(string.IsNullOrEmpty(table.Address) || x.Address.Contains(table.Address))
|
||||
select x
|
||||
;
|
||||
|
||||
@@ -39,9 +38,8 @@ namespace BLL
|
||||
}
|
||||
public static List<Model.Base_Factory> GetBase_FactoryList()
|
||||
{
|
||||
var q = (from x in db.Base_Factory orderby x.FactoryCode select x).ToList();
|
||||
|
||||
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
var q = (from x in db.Base_Factory orderby x.FactoryCode select x).ToList();
|
||||
return q;
|
||||
}
|
||||
/// 获取分页列表
|
||||
@@ -74,12 +72,14 @@ namespace BLL
|
||||
|
||||
public static Model.Base_Factory GetBase_FactoryById(string FactoryId)
|
||||
{
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
return db.Base_Factory.FirstOrDefault(x => x.FactoryId == FactoryId);
|
||||
}
|
||||
public static string GetBase_FactoryNameById(object FactoryId)
|
||||
public static string GetBase_FactoryNameById(object FactoryId)
|
||||
{
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
string name = string.Empty;
|
||||
if (FactoryId!=null)
|
||||
if (FactoryId != null)
|
||||
{
|
||||
var model = db.Base_Factory.FirstOrDefault(x => x.FactoryId == FactoryId.ToString());
|
||||
if (model != null)
|
||||
@@ -88,15 +88,16 @@ namespace BLL
|
||||
}
|
||||
|
||||
}
|
||||
return name;
|
||||
return name;
|
||||
}
|
||||
public static Model.Base_Factory GetBase_FactoryByCode(string FactoryCode)
|
||||
public static Model.Base_Factory GetBase_FactoryByCode(string FactoryCode)
|
||||
{
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
return db.Base_Factory.FirstOrDefault(x => x.FactoryCode == FactoryCode);
|
||||
}
|
||||
public static void AddBase_Factory(Model.Base_Factory newtable)
|
||||
{
|
||||
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
Model.Base_Factory table = new Model.Base_Factory
|
||||
{
|
||||
FactoryId = newtable.FactoryId,
|
||||
@@ -104,7 +105,7 @@ namespace BLL
|
||||
FactoryCode = newtable.FactoryCode,
|
||||
FactoryName = newtable.FactoryName,
|
||||
Address = newtable.Address,
|
||||
MapCoordinates= newtable.MapCoordinates,
|
||||
MapCoordinates = newtable.MapCoordinates,
|
||||
};
|
||||
db.Base_Factory.InsertOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
@@ -112,7 +113,7 @@ namespace BLL
|
||||
|
||||
public static void AddBulkBase_Factory(List<Model.Base_Factory> newtables)
|
||||
{
|
||||
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
db.Base_Factory.InsertAllOnSubmit(newtables);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
@@ -120,7 +121,7 @@ namespace BLL
|
||||
|
||||
public static void UpdateBase_Factory(Model.Base_Factory newtable)
|
||||
{
|
||||
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
Model.Base_Factory table = db.Base_Factory.FirstOrDefault(x => x.FactoryId == newtable.FactoryId);
|
||||
if (table != null)
|
||||
{
|
||||
@@ -136,7 +137,7 @@ namespace BLL
|
||||
}
|
||||
public static void DeleteBase_FactoryById(string FactoryId)
|
||||
{
|
||||
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
Model.Base_Factory table = db.Base_Factory.FirstOrDefault(x => x.FactoryId == FactoryId);
|
||||
if (table != null)
|
||||
{
|
||||
@@ -148,6 +149,7 @@ namespace BLL
|
||||
|
||||
public static void DeleteALLBase_Factory()
|
||||
{
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
if (db.Base_Factory != null)
|
||||
{
|
||||
db.Base_Factory.DeleteAllOnSubmit(db.Base_Factory);
|
||||
|
||||
Reference in New Issue
Block a user