using Model;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
namespace BLL
{
public class CheckFineService
{
public static Model.SGGLDB db = Funs.DB;
///
/// 根据质量检查与控制Id删除一个质量检查与控制信息
///
///
public static void DeleteCheckList(string id)
{
Model.SGGLDB db = Funs.DB;
Model.Check_CheckFine CheckFine = db.Check_CheckFine.First(e => e.CheckFineId == id);
db.Check_CheckFine.DeleteOnSubmit(CheckFine);
db.SubmitChanges();
}
///
/// 添加质量检查与控制
///
///
public static void AddCheckFine(Model.Check_CheckFine CheckControl)
{
Model.SGGLDB db = Funs.DB;
Model.Check_CheckFine newCheckControl = new Model.Check_CheckFine();
newCheckControl.CheckFineId = CheckControl.CheckFineId;
newCheckControl.CheckControlCode = CheckControl.CheckControlCode;
newCheckControl.ProposeUnitId = CheckControl.ProposeUnitId;
newCheckControl.DocCode = CheckControl.DocCode;
newCheckControl.ProjectId = CheckControl.ProjectId;
newCheckControl.UnitWorkId = CheckControl.UnitWorkId;
newCheckControl.UnitId = CheckControl.UnitId;
newCheckControl.CheckDate = CheckControl.CheckDate;
newCheckControl.CheckMan = CheckControl.CheckMan;
newCheckControl.Fee = CheckControl.Fee;
newCheckControl.QuestionDef = CheckControl.QuestionDef;
newCheckControl.LimitDate = CheckControl.LimitDate;
newCheckControl.RectifyOpinion = CheckControl.RectifyOpinion;
newCheckControl.AttachUrl = CheckControl.AttachUrl;
newCheckControl.HandleWay = CheckControl.HandleWay;
newCheckControl.State = CheckControl.State;
newCheckControl.SaveHandleMan = CheckControl.SaveHandleMan;
db.Check_CheckFine.InsertOnSubmit(newCheckControl);
db.SubmitChanges();
}
///
/// 根据质量检查与控制Id获取一个质量检查与控制信息
///
///
public static Model.Check_CheckFine CheckFine(string id)
{
return Funs.DB.Check_CheckFine.FirstOrDefault(e => e.CheckFineId == id);
}
///
/// 修改质量检查与控制
///
///
public static void UpdateCheckControl(Model.Check_CheckFine CheckControl)
{
Model.SGGLDB db = Funs.DB;
Model.Check_CheckFine newCheckControl = db.Check_CheckFine.First(e => e.CheckFineId == CheckControl.CheckFineId);
newCheckControl.DocCode = CheckControl.DocCode;
newCheckControl.ProposeUnitId = CheckControl.ProposeUnitId;
newCheckControl.UnitWorkId = CheckControl.UnitWorkId;
newCheckControl.UnitId = CheckControl.UnitId;
newCheckControl.CheckDate = CheckControl.CheckDate;
newCheckControl.CheckControlCode = CheckControl.CheckControlCode;
newCheckControl.Fee = CheckControl.Fee;
newCheckControl.QuestionDef = CheckControl.QuestionDef;
newCheckControl.LimitDate = CheckControl.LimitDate;
newCheckControl.RectifyOpinion = CheckControl.RectifyOpinion;
newCheckControl.AttachUrl = CheckControl.AttachUrl;
newCheckControl.HandleWay = CheckControl.HandleWay;
newCheckControl.State = CheckControl.State;
newCheckControl.SaveHandleMan = CheckControl.SaveHandleMan;
db.SubmitChanges();
}
public static int GetListCount(string projectId)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
IQueryable q = db.Check_CheckFine;
if (!string.IsNullOrEmpty(projectId))
{
q = q.Where(e => e.ProjectId == projectId);
}
return q.Count();
}
}
}
}