using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; using System.Web.UI.WebControls; namespace BLL { public class HJGL_RepairService { /// /// 根据委托Id获取用于委托的委托信息 /// /// /// public static Model.HJGL_CH_Repair GetCH_RepairByID(string CH_RepairID) { Model.SGGLDB db = Funs.DB; var view = db.HJGL_CH_Repair.FirstOrDefault(e => e.CH_RepairID == CH_RepairID); return view; } /// /// 增加委托信息 /// /// 委托实体 public static void AddCH_Repair(Model.HJGL_CH_Repair repair) { Model.SGGLDB db = Funs.DB; Model.HJGL_CH_Repair newRepair = new Model.HJGL_CH_Repair(); newRepair.CH_RepairID = repair.CH_RepairID; newRepair.ProjectId = repair.ProjectId; newRepair.TrustItemID = repair.TrustItemID; newRepair.ISO_ID = repair.ISO_ID; newRepair.JOT_ID = repair.JOT_ID; newRepair.NDT_ID = repair.NDT_ID; newRepair.RepairTrustDate = repair.RepairTrustDate; newRepair.BSU_ID = repair.BSU_ID; newRepair.BatchId = repair.BatchId; newRepair.CH_TrustUnit = repair.CH_TrustUnit; newRepair.InstallationId = repair.InstallationId; newRepair.CH_TrustType = repair.CH_TrustType; newRepair.CH_ItemName = repair.CH_ItemName; newRepair.CH_RepairDate = repair.CH_RepairDate; newRepair.CH_RepairNo = repair.CH_RepairNo; newRepair.CH_Tabler = repair.CH_Tabler; newRepair.CH_TableDate = repair.CH_TableDate; newRepair.CH_Printer = repair.CH_Printer; newRepair.CH_PrintDate = repair.CH_PrintDate; newRepair.CH_Remark = repair.CH_Remark; newRepair.CH_AcceptGrade = repair.CH_AcceptGrade; newRepair.CH_NDTCriteria = repair.CH_NDTCriteria; newRepair.CH_SlopeType = repair.CH_SlopeType; newRepair.CH_WeldMethod = repair.CH_WeldMethod; db.HJGL_CH_Repair.InsertOnSubmit(newRepair); db.SubmitChanges(); } /// /// 修改焊接信息 /// /// 焊接实体 public static void UpdateCH_Trust(Model.HJGL_CH_Repair repair) { Model.SGGLDB db = Funs.DB; Model.HJGL_CH_Repair newRepair = db.HJGL_CH_Repair.FirstOrDefault(e => e.CH_RepairID == repair.CH_RepairID); if (newRepair != null) { newRepair.ProjectId = repair.ProjectId; newRepair.TrustItemID = repair.TrustItemID; newRepair.JOT_ID = repair.JOT_ID; newRepair.RepairTrustDate = repair.RepairTrustDate; newRepair.BSU_ID = repair.BSU_ID; newRepair.CH_RepairDate = repair.CH_RepairDate; newRepair.CH_AcceptGrade = repair.CH_AcceptGrade; newRepair.CH_NDTCriteria = repair.CH_NDTCriteria; newRepair.CH_CheckUnit = repair.CH_CheckUnit; newRepair.CH_SlopeType = repair.CH_SlopeType; newRepair.CH_WeldMethod = repair.CH_WeldMethod; newRepair.CH_RepairNo = repair.CH_RepairNo; newRepair.CH_Tabler = repair.CH_Tabler; newRepair.CH_TableDate = repair.CH_TableDate; newRepair.CH_Printer = repair.CH_Printer; newRepair.CH_PrintDate = repair.CH_PrintDate; newRepair.CH_Remark = repair.CH_Remark; db.SubmitChanges(); } } /// /// 委托单打印信息修改 /// /// public static void PrintCH_Repair(Model.HJGL_CH_Repair cH_Repair) { Model.SGGLDB db = Funs.DB; Model.HJGL_CH_Repair newCH_Repair = db.HJGL_CH_Repair.FirstOrDefault(e => e.CH_RepairID == cH_Repair.CH_RepairID); if (newCH_Repair != null) { newCH_Repair.CH_Printer = cH_Repair.CH_Printer; newCH_Repair.CH_PrintDate = cH_Repair.CH_PrintDate; db.SubmitChanges(); } } /// /// 委托单打印信息修改 /// /// public static void RecordPrintCH_Repair(Model.HJGL_CH_Repair cH_Repair) { Model.SGGLDB db = Funs.DB; Model.HJGL_CH_Repair newCH_Repair = db.HJGL_CH_Repair.FirstOrDefault(e => e.CH_RepairID == cH_Repair.CH_RepairID); if (newCH_Repair != null) { newCH_Repair.Record_Printer = cH_Repair.Record_Printer; newCH_Repair.Record_PrintDate = cH_Repair.Record_PrintDate; db.SubmitChanges(); } } /// /// 根据主键删除委托信息 /// /// 委托主键 public static void DeleteRepairByCH_RepairID(string cH_RepairID) { Model.SGGLDB db = Funs.DB; Model.HJGL_CH_Repair cH_Repair = db.HJGL_CH_Repair.FirstOrDefault(e => e.CH_RepairID == cH_RepairID); if (cH_Repair != null) { db.HJGL_CH_Repair.DeleteOnSubmit(cH_Repair); db.SubmitChanges(); } } /// /// /// /// /// public static List GetRepairByProjectId(string projectId) { return (from x in Funs.DB.HJGL_CH_Repair where x.ProjectId == projectId && x.Record_PrintDate == null select x).ToList(); } } }