using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL { public static class WelderViolationService { /// /// 根据主键获取焊工违章信息 /// /// /// public static Model.Welder_Violation GetViolationById(string welderViolationId) { return Funs.DB.Welder_Violation.FirstOrDefault(e => e.WelderViolationId == welderViolationId); } /// /// 根据主键获取焊工违章视图 /// /// /// //public static Model.View_Welder_WelderQualify GetViewWelderQualifyById(string welderQualifyId) //{ // return Funs.DB.View_Welder_WelderQualify.FirstOrDefault(e => e.WelderQualifyId == welderQualifyId); //} /// /// 根据焊工主键获取焊工违章信息 /// /// /// public static List GetWelderViolationByWelderId(string welderId) { return (from x in Funs.DB.Welder_Violation where x.WelderId == welderId select x).ToList(); } /// /// 添加焊工违章信息 /// /// public static void AddWelderViolation(Model.Welder_Violation welderViolation) { Model.Welder_Violation newWelderViolation = new Model.Welder_Violation(); newWelderViolation.WelderViolationId = welderViolation.WelderViolationId; newWelderViolation.WelderId = welderViolation.WelderId; newWelderViolation.UnitId = welderViolation.UnitId; newWelderViolation.WelderViolationTypeId = welderViolation.WelderViolationTypeId; newWelderViolation.ViolationDate = welderViolation.ViolationDate; newWelderViolation.Results = welderViolation.Results; newWelderViolation.SpecialNote = welderViolation.SpecialNote; newWelderViolation.Project = welderViolation.Project; newWelderViolation.RecordMan = welderViolation.RecordMan; Funs.DB.Welder_Violation.InsertOnSubmit(newWelderViolation); Funs.DB.SubmitChanges(); } /// /// 修改焊工违章 /// /// public static void UpdateWelderViolation(Model.Welder_Violation welderViolation) { Model.Welder_Violation newWelderViolation = Funs.DB.Welder_Violation.FirstOrDefault(e => e.WelderViolationId == welderViolation.WelderViolationId); if (newWelderViolation != null) { newWelderViolation.WelderId = welderViolation.WelderId; newWelderViolation.UnitId = welderViolation.UnitId; newWelderViolation.WelderViolationTypeId = welderViolation.WelderViolationTypeId; newWelderViolation.ViolationDate = welderViolation.ViolationDate; newWelderViolation.Results = welderViolation.Results; newWelderViolation.SpecialNote = welderViolation.SpecialNote; newWelderViolation.Project = welderViolation.Project; newWelderViolation.RecordMan = welderViolation.RecordMan; Funs.DB.SubmitChanges(); } } /// /// 根据主键删除焊工违章 /// /// public static void DeleteWelderViolationById(string welderViolationId) { Model.Welder_Violation delWelderViolation = Funs.DB.Welder_Violation.FirstOrDefault(e => e.WelderViolationId == welderViolationId); if (delWelderViolation != null) { Funs.DB.Welder_Violation.DeleteOnSubmit(delWelderViolation); Funs.DB.SubmitChanges(); } } } }