You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.2 KiB
63 lines
2.2 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Models
|
|
{
|
|
public class DyelotsProvider : IProvider<Dyelots>
|
|
{
|
|
private readonly BatchDyeingCentralEntities db = new BatchDyeingCentralEntities();
|
|
|
|
public int Delete(Dyelots t)
|
|
{
|
|
if (t == null) return 0;
|
|
var model = db.Dyelots.ToList().FirstOrDefault(item => t.Dyelot == item.Dyelot);
|
|
if (model == null) return 0;
|
|
db.Dyelots.Remove(model);
|
|
int count = db.SaveChanges();
|
|
return count;
|
|
}
|
|
|
|
public int Insert(Dyelots t)
|
|
{
|
|
if (t == null) return 0;
|
|
if (String.IsNullOrEmpty(t.Dyelot)) return 0;
|
|
db.Dyelots.Add(t);
|
|
int count = db.SaveChanges();
|
|
return count;
|
|
|
|
}
|
|
|
|
public List<Dyelots> Select()
|
|
{
|
|
string sqlselect= "select TOP (300) * from Dyelots Where CreationTime > '" + DateTime.Now.ToString("yyyy-MM-dd") + "'";
|
|
return db.Dyelots.SqlQuery(sqlselect).ToList();
|
|
}
|
|
|
|
public List<Dyelots> Selectsql(Dyelots t)//以单号查询
|
|
{
|
|
string sqlselect = "select * from Dyelots Where Dyelot = " + "'" + t.Dyelot.ToString() + "'";
|
|
return db.Dyelots.SqlQuery(sqlselect).ToList();
|
|
}
|
|
|
|
public List<Dyelots> Selecttime(Dyelots t)//以时间查询
|
|
{
|
|
string sqlselect = "select * from Dyelots Where CreationTime < " + "'" + t.EndTime.ToString()
|
|
+ "' and CreationTime > '" + t.StartTime.ToString() + "'";
|
|
return db.Dyelots.SqlQuery(sqlselect).ToList();
|
|
}
|
|
|
|
public List<Dyelots> SelectMachine(Dyelots t)//以时间及机台查询
|
|
{
|
|
string sqlselect = "select * from Dyelots Where CreationTime < " + "'" + t.EndTime.ToString()
|
|
+ "' and CreationTime > '" + t.StartTime.ToString() + "' and Machine = '" + t.Machine.ToString() + "'";
|
|
return db.Dyelots.SqlQuery(sqlselect).ToList();
|
|
}
|
|
public int Update(Dyelots t)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|
|
|