using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Runtime.Remoting.Metadata.W3cXsd2001; using System.ServiceModel.Syndication; using System.Web; using System.Web.UI.WebControls; using Model; namespace BLL { public static class SYLicensePublicService { public static ListItem[] drpStatesItem() { return new ListItem[] { new ListItem("全部", "null"), new ListItem("待开工", "1"), new ListItem("作业中", "2"), new ListItem("已关闭", "3"), new ListItem("已取消", "-1"), }; } public static List GetFireWorkList(string projectId, string unitId, int pageIndex, string states, out int count) { List result; using (SUBQHSEDB db = new SUBQHSEDB(Funs.ConnString)) { IQueryable getLists = (from x in db.SY_License_FireWork join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.ProjectId == projectId select new SY_License { WorkId = x.FireWorkId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkType = x.WorkType, WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, }); if (!string.IsNullOrEmpty(states)) { getLists = getLists.Where(p => p.States == states); } if (!string.IsNullOrEmpty(unitId)) { getLists = getLists.Where(p => p.ApplyUnitId == unitId); } count = getLists.Count(); if (pageIndex > 0) { result = getLists.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); } else { result = getLists.ToList(); } } return result; } public static SY_License GetFireWorkById(string fireWorkId) { SY_License result; using (SUBQHSEDB db = new SUBQHSEDB(Funs.ConnString)) { result = (from x in db.SY_License_FireWork join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.FireWorkId == fireWorkId select new SY_License { WorkId = x.FireWorkId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkType = x.WorkType, WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, }).FirstOrDefault(); } return result; } public static SY_License_FireWork GetFireWorkByIds(string fireWorkId) { SY_License_FireWork result; using (SUBQHSEDB db = new SUBQHSEDB(Funs.ConnString)) { result = (from x in db.SY_License_FireWork join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.FireWorkId == fireWorkId select x).FirstOrDefault(); } return result; } public static int AddFireWork(SY_License_FireWork fireWork) { SUBQHSEDB subqhsedb = Funs.DB; SY_License_FireWork newFireWork = new SY_License_FireWork { FireWorkId = SQLHelper.GetNewID(), ProjectId = fireWork.ProjectId, LicenseCode = fireWork.LicenseCode, ApplyUnitId = fireWork.ApplyUnitId, ApplyManId = fireWork.ApplyManId, ApplyDate = fireWork.ApplyDate, WorkPalce = fireWork.WorkPalce, FireWatchManId = fireWork.FireWatchManId, FireWatchManName = fireWork.FireWatchManName, ValidityStartTime = fireWork.ValidityStartTime, ValidityEndTime = fireWork.ValidityEndTime, WorkMeasures = fireWork.WorkMeasures, CancelManId = fireWork.CancelManId, WorkType = fireWork.WorkType, CancelReasons = fireWork.CancelReasons, CancelTime = fireWork.CancelTime, CloseManId = fireWork.CloseManId, CloseReasons = fireWork.CloseReasons, CloseTime = fireWork.CloseTime, NextManId = fireWork.NextManId, SignatureUrl = fireWork.SignatureUrl, States = fireWork.States }; subqhsedb.SY_License_FireWork.InsertOnSubmit(newFireWork); subqhsedb.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId("2E58D4F1-2FF1-450E-8A00-1CE3BBCF8D4B", fireWork.ProjectId, fireWork.ApplyUnitId, fireWork.FireWorkId, fireWork.ApplyDate); return 1; } public static void UpdateFireWork(SY_License_FireWork fireWork) { SUBQHSEDB db = Funs.DB; SY_License_FireWork newFireWork = db.SY_License_FireWork.FirstOrDefault((SY_License_FireWork e) => e.FireWorkId == fireWork.FireWorkId); if (newFireWork != null) { newFireWork.WorkPalce = fireWork.WorkPalce; newFireWork.FireWatchManId = fireWork.FireWatchManId; newFireWork.ValidityStartTime = fireWork.ValidityStartTime; newFireWork.ValidityEndTime = fireWork.ValidityEndTime; newFireWork.WorkMeasures = fireWork.WorkMeasures; newFireWork.CancelManId = fireWork.CancelManId; newFireWork.CancelReasons = fireWork.CancelReasons; newFireWork.CancelTime = fireWork.CancelTime; newFireWork.CloseManId = fireWork.CloseManId; newFireWork.CloseReasons = fireWork.CloseReasons; newFireWork.WorkType = fireWork.WorkType; newFireWork.CloseTime = fireWork.CloseTime; newFireWork.NextManId = fireWork.NextManId; newFireWork.SignatureUrl = fireWork.SignatureUrl; newFireWork.States = fireWork.States; newFireWork.LicenseCode = fireWork.LicenseCode; newFireWork.ApplyUnitId = fireWork.ApplyUnitId; newFireWork.ApplyDate = fireWork.ApplyDate; newFireWork.ApplyManId = fireWork.ApplyManId; db.SubmitChanges(); } } public static void DeleteFireWorkById(string fireWorkId) { SUBQHSEDB db = Funs.DB; SY_License_FireWork fireWork = db.SY_License_FireWork.FirstOrDefault((SY_License_FireWork e) => e.FireWorkId == fireWorkId); if (fireWork != null) { CodeRecordsService.DeleteCodeRecordsByDataId(fireWorkId); db.SY_License_FireWork.DeleteOnSubmit(fireWork); db.SubmitChanges(); } } public static List GetHeightWorkList(string projectId, string unitId, int pageIndex, string states, out int count) { SUBQHSEDB db = Funs.DB; IQueryable getLists = (from x in db.SY_License_HeightWork join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.ProjectId == projectId select new SY_License { WorkId = x.HeightWorkId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkType = x.WorkType, WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, }); if (!string.IsNullOrEmpty(states)) { getLists = getLists.Where(p => p.States == states); } if (!string.IsNullOrEmpty(unitId)) { getLists = getLists.Where(p => p.ApplyUnitId == unitId); } count = getLists.Count(); if (pageIndex > 0) { return getLists.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); } return getLists.ToList(); } public static SY_License GetHeightWorkById(string heightWorkId) { SY_License result; using (SUBQHSEDB db = new SUBQHSEDB(Funs.ConnString)) { result = (from x in db.SY_License_HeightWork join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.HeightWorkId == heightWorkId select new SY_License { WorkId = x.HeightWorkId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkType = x.WorkType, WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, }).FirstOrDefault(); } return result; } public static SY_License_HeightWork GetHeightWorkByIds(string heightWorkId) { SY_License_HeightWork result; using (SUBQHSEDB db = new SUBQHSEDB(Funs.ConnString)) { result = (from x in db.SY_License_HeightWork join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.HeightWorkId == heightWorkId select x).FirstOrDefault(); } return result; } public static void AddHeightWork(SY_License_HeightWork heightWork) { SUBQHSEDB subqhsedb = Funs.DB; SY_License_HeightWork newHeightWork = new SY_License_HeightWork { HeightWorkId = SQLHelper.GetNewID(), ProjectId = heightWork.ProjectId, LicenseCode = heightWork.LicenseCode, ApplyUnitId = heightWork.ApplyUnitId, ApplyManId = heightWork.ApplyManId, ApplyDate = heightWork.ApplyDate, WorkPalce = heightWork.WorkPalce, ValidityStartTime = heightWork.ValidityStartTime, ValidityEndTime = heightWork.ValidityEndTime, WorkMeasures = heightWork.WorkMeasures, EquipmentTools = heightWork.EquipmentTools, CancelManId = heightWork.CancelManId, CancelReasons = heightWork.CancelReasons, CancelTime = heightWork.CancelTime, CloseManId = heightWork.CloseManId, CloseReasons = heightWork.CloseReasons, CloseTime = heightWork.CloseTime, NextManId = heightWork.NextManId, SignatureUrl = heightWork.SignatureUrl, States = heightWork.States }; subqhsedb.SY_License_HeightWork.InsertOnSubmit(newHeightWork); subqhsedb.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId("DA1CAE8E-B5BF-4AC0-9996-AF6CAA412CA9", heightWork.ProjectId, heightWork.ApplyUnitId, heightWork.HeightWorkId, heightWork.ApplyDate); } public static void UpdateHeightWork(SY_License_HeightWork heightWork) { SUBQHSEDB db = Funs.DB; SY_License_HeightWork newHeightWork = db.SY_License_HeightWork.FirstOrDefault((SY_License_HeightWork e) => e.HeightWorkId == heightWork.HeightWorkId); if (newHeightWork != null) { newHeightWork.WorkPalce = heightWork.WorkPalce; newHeightWork.WorkType = heightWork.WorkType; newHeightWork.ValidityStartTime = heightWork.ValidityStartTime; newHeightWork.ValidityEndTime = heightWork.ValidityEndTime; newHeightWork.WorkMeasures = heightWork.WorkMeasures; newHeightWork.EquipmentTools = heightWork.EquipmentTools; newHeightWork.CancelManId = heightWork.CancelManId; newHeightWork.CancelReasons = heightWork.CancelReasons; newHeightWork.CancelTime = heightWork.CancelTime; newHeightWork.CloseManId = heightWork.CloseManId; newHeightWork.CloseReasons = heightWork.CloseReasons; newHeightWork.CloseTime = heightWork.CloseTime; newHeightWork.NextManId = heightWork.NextManId; newHeightWork.SignatureUrl = heightWork.SignatureUrl; newHeightWork.States = heightWork.States; newHeightWork.LicenseCode = heightWork.LicenseCode; newHeightWork.ApplyUnitId = heightWork.ApplyUnitId; newHeightWork.ApplyDate = heightWork.ApplyDate; newHeightWork.ApplyManId = heightWork.ApplyManId; db.SubmitChanges(); } } public static void DeleteHeightWorkById(string heightWorkId) { SUBQHSEDB db = Funs.DB; SY_License_HeightWork heightWork = db.SY_License_HeightWork.FirstOrDefault((SY_License_HeightWork e) => e.HeightWorkId == heightWorkId); if (heightWork != null) { CodeRecordsService.DeleteCodeRecordsByDataId(heightWorkId); db.SY_License_HeightWork.DeleteOnSubmit(heightWork); db.SubmitChanges(); } } public static List GetLimitedSpaceList(string projectId, string unitId, int pageIndex, string states, out int count) { List result; SUBQHSEDB db = Funs.DB; IQueryable getLists = (from x in db.SY_License_LimitedSpace join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.ProjectId == projectId select new SY_License { WorkId = x.LimitedSpaceId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, }); if (!string.IsNullOrEmpty(states)) { getLists = getLists.Where(p => p.States == states); } if (!string.IsNullOrEmpty(unitId)) { getLists = getLists.Where(p => p.ApplyUnitId == unitId); } count = getLists.Count(); if (pageIndex > 0) { result = getLists.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); } else { result = getLists.ToList(); } return result; } public static SY_License GetLimitedSpaceById(string limitedSpaceId) { SUBQHSEDB db = Funs.DB; return (from x in db.SY_License_LimitedSpace join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.LimitedSpaceId == limitedSpaceId select new SY_License { WorkId = x.LimitedSpaceId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, }).FirstOrDefault(); } public static SY_License_LimitedSpace GetLimitedSpaceByIds(string limitedSpaceId) { SUBQHSEDB db = Funs.DB; return (from x in db.SY_License_LimitedSpace join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.LimitedSpaceId == limitedSpaceId select x).FirstOrDefault(); } public static void AddLimitedSpace(SY_License_LimitedSpace limitedSpace) { SUBQHSEDB subqhsedb = Funs.DB; SY_License_LimitedSpace newLimitedSpace = new SY_License_LimitedSpace { LimitedSpaceId = SQLHelper.GetNewID(), ProjectId = limitedSpace.ProjectId, LicenseCode = limitedSpace.LicenseCode, ApplyUnitId = limitedSpace.ApplyUnitId, ApplyManId = limitedSpace.ApplyManId, ApplyDate = limitedSpace.ApplyDate, WorkPalce = limitedSpace.WorkPalce, FireWatchManId = limitedSpace.FireWatchManId, FireWatchManName = limitedSpace.FireWatchManName, ValidityStartTime = limitedSpace.ValidityStartTime, ValidityEndTime = limitedSpace.ValidityEndTime, WorkMeasures = limitedSpace.WorkMeasures, CancelManId = limitedSpace.CancelManId, CancelReasons = limitedSpace.CancelReasons, CancelTime = limitedSpace.CancelTime, CloseManId = limitedSpace.CloseManId, CloseReasons = limitedSpace.CloseReasons, CloseTime = limitedSpace.CloseTime, NextManId = limitedSpace.NextManId, SignatureUrl = limitedSpace.SignatureUrl, States = limitedSpace.States }; subqhsedb.SY_License_LimitedSpace.InsertOnSubmit(newLimitedSpace); subqhsedb.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId("AEC9166D-1C91-45F0-8BFE-D3D0479A28C7", limitedSpace.ProjectId, limitedSpace.ApplyUnitId, limitedSpace.LimitedSpaceId, limitedSpace.ApplyDate); } public static void UpdateLimitedSpace(SY_License_LimitedSpace limitedSpace) { SUBQHSEDB db = Funs.DB; SY_License_LimitedSpace newLimitedSpace = db.SY_License_LimitedSpace.FirstOrDefault((SY_License_LimitedSpace e) => e.LimitedSpaceId == limitedSpace.LimitedSpaceId); if (newLimitedSpace != null) { newLimitedSpace.WorkPalce = limitedSpace.WorkPalce; newLimitedSpace.FireWatchManId = limitedSpace.FireWatchManId; newLimitedSpace.ValidityStartTime = limitedSpace.ValidityStartTime; newLimitedSpace.ValidityEndTime = limitedSpace.ValidityEndTime; newLimitedSpace.WorkMeasures = limitedSpace.WorkMeasures; newLimitedSpace.CancelManId = limitedSpace.CancelManId; newLimitedSpace.CancelReasons = limitedSpace.CancelReasons; newLimitedSpace.CancelTime = limitedSpace.CancelTime; newLimitedSpace.CloseManId = limitedSpace.CloseManId; newLimitedSpace.CloseReasons = limitedSpace.CloseReasons; newLimitedSpace.CloseTime = limitedSpace.CloseTime; newLimitedSpace.NextManId = limitedSpace.NextManId; newLimitedSpace.SignatureUrl = limitedSpace.SignatureUrl; newLimitedSpace.States = limitedSpace.States; newLimitedSpace.LicenseCode = limitedSpace.LicenseCode; newLimitedSpace.ApplyUnitId = limitedSpace.ApplyUnitId; newLimitedSpace.ApplyDate = limitedSpace.ApplyDate; newLimitedSpace.ApplyManId = limitedSpace.ApplyManId; db.SubmitChanges(); } } public static void DeleteLimitedSpaceById(string limitedSpaceId) { SUBQHSEDB db = Funs.DB; SY_License_LimitedSpace limitedSpace = db.SY_License_LimitedSpace.FirstOrDefault((SY_License_LimitedSpace e) => e.LimitedSpaceId == limitedSpaceId); if (limitedSpace != null) { CodeRecordsService.DeleteCodeRecordsByDataId(limitedSpaceId); db.SY_License_LimitedSpace.DeleteOnSubmit(limitedSpace); db.SubmitChanges(); } } public static List GetOpenCircuitList(string projectId, string unitId, int pageIndex, string states, out int count) { SUBQHSEDB db = Funs.DB; IQueryable getLists = (from x in db.SY_License_OpenCircuit join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.ProjectId == projectId select new SY_License { WorkId = x.OpenCircuitId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, RoadName = x.RoadName, NextManId = x.NextManId, }); if (!string.IsNullOrEmpty(states)) { getLists = from x in getLists where x.States == states select x; } if (!string.IsNullOrEmpty(unitId)) { getLists = from x in getLists where x.ApplyUnitId == unitId select x; } count = getLists.Count(); if (pageIndex > 0) { return getLists.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); } return getLists.ToList(); } public static SY_License GetOpenCircuitById(string openCircuitId) { SUBQHSEDB db = Funs.DB; return (from x in db.SY_License_OpenCircuit join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.OpenCircuitId == openCircuitId select new SY_License { WorkId = x.OpenCircuitId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, RoadName = x.RoadName, NextManId = x.NextManId, }).FirstOrDefault(); } public static SY_License_OpenCircuit GetOpenCircuitByIds(string openCircuitId) { SUBQHSEDB db = Funs.DB; return (from x in db.SY_License_OpenCircuit join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.OpenCircuitId == openCircuitId select x).FirstOrDefault(); } public static void AddOpenCircuit(SY_License_OpenCircuit openCircuit) { SUBQHSEDB subqhsedb = Funs.DB; SY_License_OpenCircuit newOpenCircuit = new SY_License_OpenCircuit { OpenCircuitId = SQLHelper.GetNewID(), ProjectId = openCircuit.ProjectId, LicenseCode = openCircuit.LicenseCode, ApplyUnitId = openCircuit.ApplyUnitId, ApplyManId = openCircuit.ApplyManId, ApplyDate = openCircuit.ApplyDate, WorkPalce = openCircuit.WorkPalce, WorkMeasures = openCircuit.WorkMeasures, ValidityStartTime = openCircuit.ValidityStartTime, ValidityEndTime = openCircuit.ValidityEndTime, RoadName = openCircuit.RoadName, SafeMeasures = openCircuit.SafeMeasures, CancelManId = openCircuit.CancelManId, CancelReasons = openCircuit.CancelReasons, CancelTime = openCircuit.CancelTime, CloseManId = openCircuit.CloseManId, CloseReasons = openCircuit.CloseReasons, CloseTime = openCircuit.CloseTime, NextManId = openCircuit.NextManId, SignatureUrl = openCircuit.SignatureUrl, States = openCircuit.States }; subqhsedb.SY_License_OpenCircuit.InsertOnSubmit(newOpenCircuit); subqhsedb.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId("4E607E83-41FC-4F49-B26F-A21CFE38328F", openCircuit.ProjectId, openCircuit.ApplyUnitId, openCircuit.OpenCircuitId, openCircuit.ApplyDate); } public static void UpdateOpenCircuit(SY_License_OpenCircuit openCircuit) { SUBQHSEDB db = Funs.DB; SY_License_OpenCircuit newOpenCircuit = db.SY_License_OpenCircuit.FirstOrDefault((SY_License_OpenCircuit e) => e.OpenCircuitId == openCircuit.OpenCircuitId); if (newOpenCircuit != null) { newOpenCircuit.WorkPalce = openCircuit.WorkPalce; newOpenCircuit.WorkMeasures = openCircuit.WorkMeasures; newOpenCircuit.ValidityStartTime = openCircuit.ValidityStartTime; newOpenCircuit.ValidityEndTime = openCircuit.ValidityEndTime; newOpenCircuit.RoadName = openCircuit.RoadName; newOpenCircuit.SafeMeasures = openCircuit.SafeMeasures; newOpenCircuit.CancelManId = openCircuit.CancelManId; newOpenCircuit.CancelReasons = openCircuit.CancelReasons; newOpenCircuit.CancelTime = openCircuit.CancelTime; newOpenCircuit.CloseManId = openCircuit.CloseManId; newOpenCircuit.CloseReasons = openCircuit.CloseReasons; newOpenCircuit.CloseTime = openCircuit.CloseTime; newOpenCircuit.NextManId = openCircuit.NextManId; newOpenCircuit.SignatureUrl = openCircuit.SignatureUrl; newOpenCircuit.States = openCircuit.States; newOpenCircuit.LicenseCode = openCircuit.LicenseCode; newOpenCircuit.ApplyUnitId = openCircuit.ApplyUnitId; newOpenCircuit.ApplyDate = openCircuit.ApplyDate; newOpenCircuit.ApplyManId = openCircuit.ApplyManId; db.SubmitChanges(); } } public static void DeleteOpenCircuitById(string openCircuitId) { SUBQHSEDB db = Funs.DB; SY_License_OpenCircuit openCircuit = db.SY_License_OpenCircuit.FirstOrDefault((SY_License_OpenCircuit e) => e.OpenCircuitId == openCircuitId); if (openCircuit != null) { CodeRecordsService.DeleteCodeRecordsByDataId(openCircuitId); db.SY_License_OpenCircuit.DeleteOnSubmit(openCircuit); db.SubmitChanges(); } } public static List GetBreakGroundList(string projectId, string unitId, int pageIndex, string states, out int count) { SUBQHSEDB db = Funs.DB; IQueryable getLists = (from x in db.SY_License_BreakGround join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.ProjectId == projectId select new SY_License { WorkId = x.BreakGroundId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, WorkDepth = x.WorkDepth, NextManId = x.NextManId, }); if (!string.IsNullOrEmpty(states)) { getLists = from x in getLists where x.States == states select x; } if (!string.IsNullOrEmpty(unitId)) { getLists = from x in getLists where x.ApplyUnitId == unitId select x; } count = getLists.Count(); if (pageIndex > 0) { return getLists.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); } return getLists.ToList(); } public static SY_License GetBreakGroundById(string breakGroundId) { SUBQHSEDB db = Funs.DB; return (from x in db.SY_License_BreakGround join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.BreakGroundId == breakGroundId select new SY_License { WorkId = x.BreakGroundId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, WorkDepth = x.WorkDepth, NextManId = x.NextManId, }).FirstOrDefault(); } public static SY_License_BreakGround GetBreakGroundByIds(string breakGroundId) { SUBQHSEDB db = Funs.DB; return (from x in db.SY_License_BreakGround join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.BreakGroundId == breakGroundId select x).FirstOrDefault(); } public static void AddBreakGround(SY_License_BreakGround breakGround) { SUBQHSEDB subqhsedb = Funs.DB; SY_License_BreakGround newBreakGround = new SY_License_BreakGround { BreakGroundId = SQLHelper.GetNewID(), ProjectId = breakGround.ProjectId, LicenseCode = breakGround.LicenseCode, ApplyUnitId = breakGround.ApplyUnitId, ApplyManId = breakGround.ApplyManId, ApplyDate = breakGround.ApplyDate, WorkPalce = breakGround.WorkPalce, WorkDepth = breakGround.WorkDepth, ValidityStartTime = breakGround.ValidityStartTime, ValidityEndTime = breakGround.ValidityEndTime, WorkMeasures = breakGround.WorkMeasures, CancelManId = breakGround.CancelManId, CancelReasons = breakGround.CancelReasons, CancelTime = breakGround.CancelTime, CloseManId = breakGround.CloseManId, CloseReasons = breakGround.CloseReasons, CloseTime = breakGround.CloseTime, NextManId = breakGround.NextManId, SignatureUrl = breakGround.SignatureUrl, States = breakGround.States }; subqhsedb.SY_License_BreakGround.InsertOnSubmit(newBreakGround); subqhsedb.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId("755C6AC9-2E38-4D4F-AF33-33CB1744A907", breakGround.ProjectId, breakGround.ApplyUnitId, breakGround.BreakGroundId, breakGround.ApplyDate); } public static void UpdateBreakGround(SY_License_BreakGround breakGround) { SUBQHSEDB db = Funs.DB; SY_License_BreakGround newBreakGround = db.SY_License_BreakGround.FirstOrDefault((SY_License_BreakGround e) => e.BreakGroundId == breakGround.BreakGroundId); if (newBreakGround != null) { newBreakGround.WorkPalce = breakGround.WorkPalce; newBreakGround.WorkDepth = breakGround.WorkDepth; newBreakGround.ValidityStartTime = breakGround.ValidityStartTime; newBreakGround.ValidityEndTime = breakGround.ValidityEndTime; newBreakGround.WorkMeasures = breakGround.WorkMeasures; newBreakGround.CancelManId = breakGround.CancelManId; newBreakGround.CancelReasons = breakGround.CancelReasons; newBreakGround.CancelTime = breakGround.CancelTime; newBreakGround.CloseManId = breakGround.CloseManId; newBreakGround.CloseReasons = breakGround.CloseReasons; newBreakGround.CloseTime = breakGround.CloseTime; newBreakGround.NextManId = breakGround.NextManId; newBreakGround.SignatureUrl = breakGround.SignatureUrl; newBreakGround.States = breakGround.States; newBreakGround.LicenseCode = breakGround.LicenseCode; newBreakGround.ApplyUnitId = breakGround.ApplyUnitId; newBreakGround.ApplyDate = breakGround.ApplyDate; newBreakGround.ApplyManId = breakGround.ApplyManId; newBreakGround.LicenseCode = breakGround.LicenseCode; newBreakGround.ApplyUnitId = breakGround.ApplyUnitId; newBreakGround.ApplyDate = breakGround.ApplyDate; newBreakGround.ApplyManId = breakGround.ApplyManId; db.SubmitChanges(); } } public static void DeleteBreakGroundById(string breakGroundId) { SUBQHSEDB db = Funs.DB; SY_License_BreakGround breakGround = db.SY_License_BreakGround.FirstOrDefault((SY_License_BreakGround e) => e.BreakGroundId == breakGroundId); if (breakGround != null) { CodeRecordsService.DeleteCodeRecordsByDataId(breakGroundId); CommonService.DeleteAttachFileById(breakGroundId); db.SY_License_BreakGround.DeleteOnSubmit(breakGround); db.SubmitChanges(); } } public static List GetLiftingWorkList(string projectId, string unitId, int pageIndex, string states, out int count) { SUBQHSEDB db = Funs.DB; IQueryable getLists = (from x in db.SY_License_LiftingWork join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.ProjectId == projectId select new SY_License { WorkId = x.LiftingWorkId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, WorkLevel = x.WorkLevel, NextManId = x.NextManId, CancelReasons = x.CancelReasons, CloseReasons = x.CloseReasons, }); if (!string.IsNullOrEmpty(states)) { getLists = from x in getLists where x.States == states select x; } if (!string.IsNullOrEmpty(unitId)) { getLists = from x in getLists where x.ApplyUnitId == unitId select x; } count = getLists.Count(); if (pageIndex > 0) { return getLists.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); } return getLists.ToList(); } public static SY_License GetLiftingWorkById(string liftingWorkId) { SUBQHSEDB db = Funs.DB; return (from x in db.SY_License_LiftingWork join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.LiftingWorkId == liftingWorkId select new SY_License { WorkId = x.LiftingWorkId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, WorkLevel = x.WorkLevel, NextManId = x.NextManId, CancelReasons = x.CancelReasons, CloseReasons = x.CloseReasons, }).FirstOrDefault(); } public static SY_License_LiftingWork GetLiftingWorkByIds(string liftingWorkId) { SUBQHSEDB db = Funs.DB; return (from x in db.SY_License_LiftingWork join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.LiftingWorkId == liftingWorkId select x).FirstOrDefault(); } public static void AddLiftingWork(SY_License_LiftingWork liftingWork) { SUBQHSEDB subqhsedb = Funs.DB; SY_License_LiftingWork newLiftingWork = new SY_License_LiftingWork { LiftingWorkId = SQLHelper.GetNewID(), ProjectId = liftingWork.ProjectId, LicenseCode = liftingWork.LicenseCode, ApplyUnitId = liftingWork.ApplyUnitId, ApplyManId = liftingWork.ApplyManId, ApplyDate = liftingWork.ApplyDate, WorkPalce = liftingWork.WorkPalce, WorkLevel = liftingWork.WorkLevel, ValidityStartTime = liftingWork.ValidityStartTime, ValidityEndTime = liftingWork.ValidityEndTime, WorkMeasures = liftingWork.WorkMeasures, CraneCapacity = liftingWork.CraneCapacity, CancelManId = liftingWork.CancelManId, CancelReasons = liftingWork.CancelReasons, CancelTime = liftingWork.CancelTime, CloseManId = liftingWork.CloseManId, CloseReasons = liftingWork.CloseReasons, CloseTime = liftingWork.CloseTime, NextManId = liftingWork.NextManId, SignatureUrl = liftingWork.SignatureUrl, States = liftingWork.States }; subqhsedb.SY_License_LiftingWork.InsertOnSubmit(newLiftingWork); subqhsedb.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId("A1BE3AB6-9D4A-41E7-8870-E73423165451", liftingWork.ProjectId, liftingWork.ApplyUnitId, liftingWork.LiftingWorkId, liftingWork.ApplyDate); } public static void UpdateLiftingWork(SY_License_LiftingWork liftingWork) { SUBQHSEDB db = Funs.DB; SY_License_LiftingWork newLiftingWork = db.SY_License_LiftingWork.FirstOrDefault((SY_License_LiftingWork e) => e.LiftingWorkId == liftingWork.LiftingWorkId); if (newLiftingWork != null) { newLiftingWork.WorkPalce = liftingWork.WorkPalce; newLiftingWork.WorkLevel = liftingWork.WorkLevel; newLiftingWork.ValidityStartTime = liftingWork.ValidityStartTime; newLiftingWork.ValidityEndTime = liftingWork.ValidityEndTime; newLiftingWork.WorkMeasures = liftingWork.WorkMeasures; newLiftingWork.CraneCapacity = liftingWork.CraneCapacity; newLiftingWork.CancelManId = liftingWork.CancelManId; newLiftingWork.CancelReasons = liftingWork.CancelReasons; newLiftingWork.CancelTime = liftingWork.CancelTime; newLiftingWork.CloseManId = liftingWork.CloseManId; newLiftingWork.CloseReasons = liftingWork.CloseReasons; newLiftingWork.CloseTime = liftingWork.CloseTime; newLiftingWork.NextManId = liftingWork.NextManId; newLiftingWork.SignatureUrl = liftingWork.SignatureUrl; newLiftingWork.States = liftingWork.States; newLiftingWork.LicenseCode = liftingWork.LicenseCode; newLiftingWork.ApplyUnitId = liftingWork.ApplyUnitId; newLiftingWork.ApplyDate = liftingWork.ApplyDate; newLiftingWork.ApplyManId = liftingWork.ApplyManId; db.SubmitChanges(); } } public static void DeleteLiftingWorkById(string liftingWorkId) { SUBQHSEDB db = Funs.DB; SY_License_LiftingWork liftingWork = db.SY_License_LiftingWork.FirstOrDefault((SY_License_LiftingWork e) => e.LiftingWorkId == liftingWorkId); if (liftingWork != null) { CodeRecordsService.DeleteCodeRecordsByDataId(liftingWorkId); db.SY_License_LiftingWork.DeleteOnSubmit(liftingWork); db.SubmitChanges(); } } public static List GetTempElectricityList(string projectId, string unitId, int pageIndex, string states, out int count) { SUBQHSEDB db = Funs.DB; IQueryable getLists = (from x in db.SY_License_TempElectricity join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.ProjectId == projectId select new SY_License { WorkId = x.TempElectricityId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, NextManId = x.NextManId, CancelReasons = x.CancelReasons, }); if (!string.IsNullOrEmpty(states)) { getLists = from x in getLists where x.States == states select x; } if (!string.IsNullOrEmpty(unitId)) { getLists = from x in getLists where x.ApplyUnitId == unitId select x; } count = getLists.Count(); if (pageIndex > 0) { return getLists.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); } return getLists.ToList(); } public static SY_License GetTempElectricityById(string tempElectricityId) { SUBQHSEDB db = Funs.DB; return (from x in db.SY_License_TempElectricity join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.TempElectricityId == tempElectricityId select new SY_License { WorkId = x.TempElectricityId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, NextManId = x.NextManId, CancelReasons = x.CancelReasons, CloseReasons = x.CloseReasons, }).FirstOrDefault(); } public static SY_License_TempElectricity GetTempElectricityByIds(string tempElectricityId) { SUBQHSEDB db = Funs.DB; return (from x in db.SY_License_TempElectricity join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.TempElectricityId == tempElectricityId select x).FirstOrDefault(); } public static void AddTempElectricity(SY_License_TempElectricity tempElectricity) { SUBQHSEDB subqhsedb = Funs.DB; SY_License_TempElectricity newTempElectricity = new SY_License_TempElectricity { TempElectricityId = SQLHelper.GetNewID(), ProjectId = tempElectricity.ProjectId, LicenseCode = tempElectricity.LicenseCode, ApplyUnitId = tempElectricity.ApplyUnitId, ApplyManId = tempElectricity.ApplyManId, ApplyDate = tempElectricity.ApplyDate, WorkPalce = tempElectricity.WorkPalce, WatchManId = tempElectricity.WatchManId, WatchManName = tempElectricity.WatchManName, ValidityStartTime = tempElectricity.ValidityStartTime, ValidityEndTime = tempElectricity.ValidityEndTime, WorkMeasures = tempElectricity.WorkMeasures, CancelManId = tempElectricity.CancelManId, CancelReasons = tempElectricity.CancelReasons, CancelTime = tempElectricity.CancelTime, CloseManId = tempElectricity.CloseManId, CloseReasons = tempElectricity.CloseReasons, CloseTime = tempElectricity.CloseTime, NextManId = tempElectricity.NextManId, SignatureUrl = tempElectricity.SignatureUrl, States = tempElectricity.States }; subqhsedb.SY_License_TempElectricity.InsertOnSubmit(newTempElectricity); subqhsedb.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId("E9EF8980-C60C-4A87-8498-5A0A061844ED", newTempElectricity.ProjectId, newTempElectricity.ApplyUnitId, newTempElectricity.TempElectricityId, newTempElectricity.ApplyDate); } public static void UpdateTempElectricity(SY_License_TempElectricity tempElectricity) { SUBQHSEDB db = Funs.DB; SY_License_TempElectricity newTempElectricity = db.SY_License_TempElectricity.FirstOrDefault((SY_License_TempElectricity e) => e.TempElectricityId == tempElectricity.TempElectricityId); if (newTempElectricity != null) { newTempElectricity.WorkPalce = tempElectricity.WorkPalce; newTempElectricity.WatchManId = tempElectricity.WatchManId; newTempElectricity.ValidityStartTime = tempElectricity.ValidityStartTime; newTempElectricity.ValidityEndTime = tempElectricity.ValidityEndTime; newTempElectricity.WorkMeasures = tempElectricity.WorkMeasures; newTempElectricity.CancelManId = tempElectricity.CancelManId; newTempElectricity.CancelReasons = tempElectricity.CancelReasons; newTempElectricity.CancelTime = tempElectricity.CancelTime; newTempElectricity.CloseManId = tempElectricity.CloseManId; newTempElectricity.CloseReasons = tempElectricity.CloseReasons; newTempElectricity.CloseTime = tempElectricity.CloseTime; newTempElectricity.NextManId = tempElectricity.NextManId; newTempElectricity.SignatureUrl = tempElectricity.SignatureUrl; newTempElectricity.States = tempElectricity.States; newTempElectricity.LicenseCode = tempElectricity.LicenseCode; newTempElectricity.ApplyUnitId = tempElectricity.ApplyUnitId; newTempElectricity.ApplyDate = tempElectricity.ApplyDate; newTempElectricity.ApplyManId = tempElectricity.ApplyManId; db.SubmitChanges(); } } public static void DeleteTempElectricityById(string tempElectricityId) { SUBQHSEDB db = Funs.DB; SY_License_TempElectricity tempElectricity = db.SY_License_TempElectricity.FirstOrDefault((SY_License_TempElectricity e) => e.TempElectricityId == tempElectricityId); if (tempElectricity != null) { CodeRecordsService.DeleteCodeRecordsByDataId(tempElectricityId); db.SY_License_TempElectricity.DeleteOnSubmit(tempElectricity); db.SubmitChanges(); } } public static List GetBlindPlateList(string projectId, string unitId, int pageIndex, string states, out int count) { SUBQHSEDB db = Funs.DB; IQueryable getLists = (from x in db.SY_License_BlindlWork join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.ProjectId == projectId select new SY_License { WorkId = x.BlindWorkId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, NextManId = x.NextManId, CancelReasons = x.CancelReasons, WatchManContact = x.WatchManContact, }); if (!string.IsNullOrEmpty(states)) { getLists = from x in getLists where x.States == states select x; } if (!string.IsNullOrEmpty(unitId)) { getLists = from x in getLists where x.ApplyUnitId == unitId select x; } count = getLists.Count(); if (pageIndex > 0) { return getLists.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); } return getLists.ToList(); } public static SY_License GetBlindPlateById(string blindWorkId) { SUBQHSEDB db = Funs.DB; return (from x in db.SY_License_BlindlWork join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.BlindWorkId == blindWorkId select new SY_License { WorkId = x.BlindWorkId, ApplyUnitId = x.ApplyUnitId, ApplyUnitName = y.UnitName, LicenseCode = x.LicenseCode, ApplyManId = x.ApplyManId, ApplyDate = x.ApplyDate.ToString(), WorkPalce = x.WorkPalce, WorkMeasures = x.WorkMeasures, ValidityStartTime = x.ValidityStartTime.ToString(), ValidityEndTime = x.ValidityEndTime.ToString(), States = x.States, SignatureUrl = x.SignatureUrl, NextManId = x.NextManId, CancelReasons = x.CancelReasons, WatchManContact = x.WatchManContact, }).FirstOrDefault(); } public static SY_License_BlindlWork GetBlindPlateByIds(string blindWorkId) { SUBQHSEDB db = Funs.DB; return (from x in db.SY_License_BlindlWork join y in db.Base_Unit on x.ApplyUnitId equals y.UnitId where x.BlindWorkId == blindWorkId select x).FirstOrDefault(); } public static void AddBlindPlate(SY_License_BlindlWork limitedSpace) { SUBQHSEDB subqhsedb = Funs.DB; SY_License_BlindlWork newLimitedSpace = new SY_License_BlindlWork { BlindWorkId = SQLHelper.GetNewID(), ProjectId = limitedSpace.ProjectId, LicenseCode = limitedSpace.LicenseCode, ApplyUnitId = limitedSpace.ApplyUnitId, ApplyManId = limitedSpace.ApplyManId, ApplyDate = limitedSpace.ApplyDate, WorkPalce = limitedSpace.WorkPalce, FireWatchManId = limitedSpace.FireWatchManId, ValidityStartTime = limitedSpace.ValidityStartTime, ValidityEndTime = limitedSpace.ValidityEndTime, WorkMeasures = limitedSpace.WorkMeasures, CancelManId = limitedSpace.CancelManId, CancelReasons = limitedSpace.CancelReasons, CancelTime = limitedSpace.CancelTime, CloseManId = limitedSpace.CloseManId, CloseReasons = limitedSpace.CloseReasons, CloseTime = limitedSpace.CloseTime, NextManId = limitedSpace.NextManId, SignatureUrl = limitedSpace.SignatureUrl, WatchManContact = limitedSpace.WatchManContact, States = limitedSpace.States }; subqhsedb.SY_License_BlindlWork.InsertOnSubmit(newLimitedSpace); subqhsedb.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId("AEC9166D-1C91-45F0-8BFE-D3D0479A28C7", limitedSpace.ProjectId, limitedSpace.ApplyUnitId, limitedSpace.BlindWorkId, limitedSpace.ApplyDate); } public static void UpdateBlindPlate(SY_License_BlindlWork limitedSpace) { SUBQHSEDB db = Funs.DB; SY_License_BlindlWork newLimitedSpace = db.SY_License_BlindlWork.FirstOrDefault((SY_License_BlindlWork e) => e.BlindWorkId == limitedSpace.BlindWorkId); if (newLimitedSpace != null) { newLimitedSpace.WorkPalce = limitedSpace.WorkPalce; newLimitedSpace.FireWatchManId = limitedSpace.FireWatchManId; newLimitedSpace.ValidityStartTime = limitedSpace.ValidityStartTime; newLimitedSpace.ValidityEndTime = limitedSpace.ValidityEndTime; newLimitedSpace.WorkMeasures = limitedSpace.WorkMeasures; newLimitedSpace.CancelManId = limitedSpace.CancelManId; newLimitedSpace.CancelReasons = limitedSpace.CancelReasons; newLimitedSpace.CancelTime = limitedSpace.CancelTime; newLimitedSpace.CloseManId = limitedSpace.CloseManId; newLimitedSpace.CloseReasons = limitedSpace.CloseReasons; newLimitedSpace.CloseTime = limitedSpace.CloseTime; newLimitedSpace.NextManId = limitedSpace.NextManId; newLimitedSpace.SignatureUrl = limitedSpace.SignatureUrl; newLimitedSpace.WatchManContact = limitedSpace.WatchManContact; newLimitedSpace.States = limitedSpace.States; newLimitedSpace.LicenseCode = limitedSpace.LicenseCode; newLimitedSpace.ApplyUnitId = limitedSpace.ApplyUnitId; newLimitedSpace.ApplyDate = limitedSpace.ApplyDate; newLimitedSpace.ApplyManId = limitedSpace.ApplyManId; db.SubmitChanges(); } } public static void DeleteBlindPlateById(string blindWorkId) { SUBQHSEDB db = Funs.DB; SY_License_BlindlWork limitedSpace = db.SY_License_BlindlWork.FirstOrDefault((SY_License_BlindlWork e) => e.BlindWorkId == blindWorkId); if (limitedSpace != null) { CodeRecordsService.DeleteCodeRecordsByDataId(blindWorkId); db.SY_License_BlindlWork.DeleteOnSubmit(limitedSpace); db.SubmitChanges(); } } public static List getUnitLists(string projectid) { List result; using (SUBQHSEDB db = new SUBQHSEDB(Funs.ConnString)) { result = (from x in db.Base_Unit join y in db.Project_ProjectUnit on x.UnitId equals y.UnitId where y.ProjectId == projectid select new BaseInfoItem { BaseInfoId =x.UnitId, BaseInfoCode=x.UnitCode, BaseInfoName=x.UnitName, }).ToList(); } return result; } public class SY_License { public string WorkId { get; set; } public string ProjectId { get; set; } public string LicenseCode { get; set; } public string RoadName { get; set; } public string WorkDepth { get; set; } public string ApplyUnitId { get; set; } public string ApplyUnitName { get; set; } public string ApplyManId { get; set; } public string ApplyDate { get { return this.applydate; } set { this.applydate = Convert.ToDateTime(value).ToString("yyyy-MM-dd"); } } public string WorkPalce { get; set; } public string FireWatchManId { get; set; } public string FireWatchManName { get; set; } public string WatchManContact { get; set; } public string WorkLevel { get; set; } public string ValidityStartTime { get { return this.validitystartTime; } set { this.validitystartTime = Convert.ToDateTime(value).ToString("yyyy-MM-dd"); } } public string ValidityEndTime { get { return this.validityendTime; } set { this.validityendTime = Convert.ToDateTime(value).ToString("yyyy-MM-dd"); } } public string CancelManId { get; set; } public string WorkType { get; set; } public string WorkMeasures { get { return this.workMeasures; } set { this.workMeasures = HttpUtility.HtmlDecode(value); } } public string CancelReasons { get; set; } public string CloseManId { get; set; } public string CloseReasons { get; set; } public DateTime CancelTime { get; set; } public DateTime CloseTime { get; set; } public string NextManId { get; set; } public string SignatureUrl { get; set; } public string States { get { return this.states; } set { this.states = (drpStatesItem().Where(p => p.Value == value).FirstOrDefault() != null) ? (drpStatesItem().Where(p => p.Value == value).FirstOrDefault().Text) : ""; } } private string applydate; private string validitystartTime; private string validityendTime; private string workMeasures; private string states; } } }