//查询所有 public static List <MaterialCls> GetAll() { using (HullShellContainer hs = new HullShellContainer()) { List <MaterialCls> macls = new List <MaterialCls>(); List <Material> MaterialList = hs.MaterialSet.Where(m => m.Id >= 0).ToList(); foreach (var item in MaterialList) { macls.Add(new MaterialCls { Id = item.Id, MaterialName = item.MaterialName, ElasticModulus = item.ElasticModulus, TensileStrength = item.TensileStrength, YieldSrength = item.YieldSrength, UltimateElongation = item.UltimateElongation, ReductionOfArea = item.ReductionOfArea, HardenablityValue = item.HardenablityValue, StrainOfWidthAndThickness = item.StrainOfWidthAndThickness }); } return(macls); } }
//修改,基本信息 public int ModifyStdHullShell(StdHullShellCls StdShell) { using (HullShellContainer hs = new HullShellContainer()) { StdHullShell shs = hs.StdHullShellSet.Where(s => s.PlateModel == StdShell.PlateModel).FirstOrDefault(); shs.PlateModel = StdShell.PlateModel; shs.Thickness = StdShell.Thickness; shs.Width1 = StdShell.Width1; shs.Length1 = StdShell.Length1; shs.TransverseCurvate = StdShell.TransverseCurvate; shs.RiblineAmount = StdShell.RiblineCount; shs.LongitudinalCurvature = StdShell.LongitudinalCurvature; shs.CurvePlateKind = StdShell.CurvePlateKind; shs.Width2 = StdShell.Width2; shs.Length2 = StdShell.Length2; shs.ShipName = StdShell.ShipName; shs.BoundingBox.x_Dir = StdShell.Dir.x; shs.BoundingBox.y_Dir = StdShell.Dir.y; shs.BoundingBox.z_Dir = StdShell.Dir.z; shs.BoundingBox.x_Min = StdShell.Pt_Min.x; shs.BoundingBox.y_Min = StdShell.Pt_Min.y; shs.BoundingBox.z_Min = StdShell.Pt_Min.z; shs.BoundingBox.x_Max = StdShell.Pt_Max.x; shs.BoundingBox.y_Max = StdShell.Pt_Max.y; shs.BoundingBox.z_Max = StdShell.Pt_Max.z; return(hs.SaveChanges()); } }
//增加调形文件 public int AddShapeFile(AdjustShapeFileCls AsFileCls) { using (HullShellContainer hs = new HullShellContainer()) { AdjustShapeFile asf = new AdjustShapeFile { FileName = AsFileCls.FileName }; for (int i = 0; i < AsFileCls.HeightValuesList.Count; i++) { HeightValueList hv = new HeightValueList { R = AsFileCls.HeightValuesList[i].R, C = AsFileCls.HeightValuesList[i].C, Z = AsFileCls.HeightValuesList[i].Z, }; asf.HeightValueList.Add(hv); } hs.AddToAdjustShapeFileSet(asf); return(hs.SaveChanges()); } }
//查询 public ModelParameterCls QueryModelParameter(string _name, int time) { using (HullShellContainer hs = new HullShellContainer()) { ModelingParameter mp = hs.ModelingParameterSet.Where(a => a.StdHullShell.PlateModel == _name && a.ProcessNumbers == time).FirstOrDefault(); ModelParameterCls mpc = new ModelParameterCls(); mpc.EnvTemperation = mp.EnvTemperation; mpc.RecordTime = mp.RecordTime; mpc.Coefficient = mp.Coefficient; mpc.ResilienceValue = mp.ResilienceValue; mpc.ProcessEquipmentName = mp.ProcessingEquipment.EquipMentName; mpc.DetectEquipmentName = mp.DetectEquipment.DetectEquipmentName; mpc.SoftwareName = mp.Software.SoftwareName; mpc.UserName = mp.Admins.UserName; mpc.spc.FileName = mp.ScanPoints.FileName; mpc.asfc.FileName = mp.AdjustShapeFile.FileName; mpc.ifc.FileName = mp.InterpolationFile.FileName; mpc.dlc.Id = mp.DefectsList.Id; return(mpc); } }
//获得所有的用户 public static List <Admins> GetAllAdmins() { using (HullShellContainer hs = new HullShellContainer()) { List <Admins> val = hs.AdminsSet.Where(a => a.Id >= 0).ToList(); return(val); } }
//根据索引删除检测设备 public static int DeleteDetectEuipmentById(int Id) { using (HullShellContainer hs = new HullShellContainer()) { DetectEquipment de = hs.DetectEquipmentSet.Where(d => d.Id == Id).FirstOrDefault(); hs.DeleteObject(de); return(hs.SaveChanges()); } }
//根据id删除 public static int DeleteSoftwareById(int Id) { using (HullShellContainer hs = new HullShellContainer()) { Software sf = hs.SoftwareSet.Where(s => s.Id == Id).FirstOrDefault(); hs.DeleteObject(sf); return(hs.SaveChanges()); } }
public static int DeleteAdminsById(int Id) { using (HullShellContainer hs = new HullShellContainer()) { Admins adm = hs.AdminsSet.Where(a => a.Id == Id).FirstOrDefault(); hs.DeleteObject(adm); return(hs.SaveChanges()); } }
//删除 public static int DeleteAdminsByName(string _name) { using (HullShellContainer hs = new HullShellContainer()) { Admins adm = hs.AdminsSet.Where(a => a.UserName == _name).FirstOrDefault(); hs.DeleteObject(adm); return(hs.SaveChanges()); } }
//删除 public static int DeleteProcessEquipmentByName(string _name) { using (HullShellContainer hs = new HullShellContainer()) { ProcessingEquipment pe = hs.ProcessingEquipmentSet.Where(p => p.EquipMentName == _name).FirstOrDefault(); hs.DeleteObject(pe); return(hs.SaveChanges()); } }
public static int DeleteProcessEquipmentById(int Id) { using (HullShellContainer hs = new HullShellContainer()) { ProcessingEquipment pe = hs.ProcessingEquipmentSet.Where(p => p.Id == Id).FirstOrDefault(); hs.DeleteObject(pe); return(hs.SaveChanges()); } }
public static int DeleteMaterialById(int Id) { using (HullShellContainer hs = new HullShellContainer()) { Material mal = hs.MaterialSet.Where(m => m.Id == Id).FirstOrDefault(); hs.DeleteObject(mal); return(hs.SaveChanges()); } }
//删除 public static int DeleteMaterialByName(string _name) { using (HullShellContainer hs = new HullShellContainer()) { Material mal = hs.MaterialSet.Where(m => m.MaterialName == _name).FirstOrDefault(); hs.DeleteObject(mal); return(hs.SaveChanges()); } }
//修改 public static int ModifyAdmins(AdminsCls adc) { using (HullShellContainer hs = new HullShellContainer()) { Admins adm = hs.AdminsSet.Where(a => a.Id == adc.Id).FirstOrDefault(); adm.UserName = adc.UserName; adm.PassWod = adc.PassWord; adm.Role = adc.Role; return(hs.SaveChanges()); } }
//删除,Id public static int DeleteStdHullShellByName(int Id) { using (HullShellContainer hs = new HullShellContainer()) { StdHullShell shs = hs.StdHullShellSet.Where(s => s.PlateModel == _name).FirstOrDefault(); //删除包围盒 BoundingBox boundbox = shs.BoundingBox; hs.DeleteObject(boundbox); //删除理论点 TheoryPoints tps = shs.TheoryPoints; List <Point> tpsList = tps.Point.ToList(); for (int i = 0; i < tpsList.Count; i++) { hs.DeleteObject(tpsList[i]); } hs.DeleteObject(tps); //删除肋位线点 RiblinePoints rps = shs.RiblinePoints; List <Point> rpList = rps.Point.ToList(); for (int i = 0; i < rpList.Count; i++) { hs.DeleteObject(rpList[i]); } hs.DeleteObject(rps); //删除余量点 ExcessPoints eeps = shs.ExcessPoints; List <Point> eepList = eeps.Point.ToList(); for (int i = 0; i < eepList.Count; i++) { hs.DeleteObject(eepList[i]); } hs.DeleteObject(eeps); //删除边角点 EdgeEdgePoints exps = shs.EdgeEdgePoints; List <Point> expList = exps.Point.ToList(); for (int i = 0; i < expList.Count; i++) { hs.DeleteObject(expList[i]); } hs.DeleteObject(exps); hs.DeleteObject(shs); return(hs.SaveChanges()); } }
//清空 public int ClearModelParameter() { using (HullShellContainer hs = new HullShellContainer()) { List <ModelingParameter> mpList = hs.ModelingParameterSet.Where(a => a.Id >= 0).ToList(); for (int i = 0; i < mpList.Count; i++) { hs.DeleteObject(mpList[i]); } return(hs.SaveChanges()); } }
////////////////////////////////////////////////////////////////////////// //修改 public int ModifyModelParameter(ModelParameterCls mpc) { using (HullShellContainer hs = new HullShellContainer()) { ModelingParameter mp = hs.ModelingParameterSet.Where(m => m.StdHullShell.PlateModel == mpc.StdHullName && m.ProcessNumbers == mpc.ProcessNumbers).FirstOrDefault(); mp.EnvTemperation = mpc.EnvTemperation; mp.RecordTime = mpc.RecordTime; mp.Coefficient = mpc.Coefficient; mp.ResilienceValue = mpc.ResilienceValue; return(hs.SaveChanges()); } }
//清空 public int ClearDetectEquipment() { using (HullShellContainer hs = new HullShellContainer()) { List <DetectEquipment> DeList = hs.DetectEquipmentSet.Where(d => d.Id >= 0).ToList(); for (int i = 0; i < DeList.Count; i++) { hs.DeleteObject(DeList[i]); } return(hs.SaveChanges()); } }
//根据Id修改 public static int ModifySoftWareById(SoftWareCls sw) { using (HullShellContainer hs = new HullShellContainer()) { Software sf = hs.SoftwareSet.Where(s => s.Id == sw.Id).FirstOrDefault(); sf.SoftwareName = sw.SoftWareName; sf.RegisterAlgorithm = sw.RegisterAlgorithm; sf.DiffComputer = sw.DiffComputer; sf.SurfaceReconstruction = sw.SurfaceReconstruction; return(hs.SaveChanges()); } }
//修改 public static int ModifyDetectEquipmentById(DetectEquipmentCls dec) { using (HullShellContainer hs = new HullShellContainer()) { DetectEquipment de = hs.DetectEquipmentSet.Where(d => d.Id == dec.Id).FirstOrDefault(); de.DetectEquipmentName = dec.MeasureDeviceName; de.CameraResolution = dec.CameraResolution; de.PixelSize = dec.PixelSize; de.StdPrecision = dec.StdPrecision; return(hs.SaveChanges()); } }
//清空 public static int ClearProcessEquipment() { using (HullShellContainer hs = new HullShellContainer()) { List <ProcessingEquipment> PeList = hs.ProcessingEquipmentSet.Where(p => p.Id >= 0).ToList(); for (int i = 0; i < PeList.Count; i++) { hs.DeleteObject(PeList[i]); } return(hs.SaveChanges()); } }
//清空 public static int ClearMaterial() { using (HullShellContainer hs = new HullShellContainer()) { List <Material> MaterialList = hs.MaterialSet.Where(m => m.Id >= 0).ToList(); for (int i = 0; i < MaterialList.Count; i++) { hs.DeleteObject(MaterialList[i]); } return(hs.SaveChanges()); } }
//清空 public static int ClearAdmins() { using (HullShellContainer hs = new HullShellContainer()) { List <Admins> AdmList = hs.AdminsSet.Where(a => a.Id >= 0).ToList(); for (int i = 0; i < AdmList.Count; i++) { hs.DeleteObject(AdmList[i]); } return(hs.SaveChanges()); } }
//清空 public static int ClearSoftware() { using (HullShellContainer hs = new HullShellContainer()) { List <Software> SfList = hs.SoftwareSet.Where(s => s.Id >= 0).ToList(); for (int i = 0; i < SfList.Count; i++) { hs.DeleteObject(SfList[i]); } return(hs.SaveChanges()); } }
//查询 public static AdminsCls QueryAdmin(string _name) { using (HullShellContainer hs = new HullShellContainer()) { Admins adm = hs.AdminsSet.Where(a => a.UserName == _name).FirstOrDefault(); AdminsCls adc = new AdminsCls(); adc.Id = adm.Id; adc.UserName = adm.UserName; adc.PassWord = adm.PassWod; adc.Role = adm.Role; return(adc); } }
public static int ModifyProcessEquipmentById(ProcessEquipmentCls pec) { using (HullShellContainer hs = new HullShellContainer()) { ProcessingEquipment pe = hs.ProcessingEquipmentSet.Where(p => p.Id == pec.Id).FirstOrDefault(); pe.EquipMentName = pec.ProcessEquipmentName; pe.PressureHeadLength = pec.PressureHeadLength; pe.DriveMode = pec.DirverMode; pe.HeadNumberOfUpDie = pec.UpDieHeadNumber; pe.HeadNumberOfDownDie = pec.DownDieHeadNumber; return(hs.SaveChanges()); } }
//查询,根据Id查询 public static SoftWareCls QuerySoftWareById(int Id) { using (HullShellContainer hs = new HullShellContainer()) { Software sf = hs.SoftwareSet.Where(s => s.Id == Id).FirstOrDefault(); SoftWareCls sw = new SoftWareCls(); sw.Id = sf.Id; sw.RegisterAlgorithm = sf.RegisterAlgorithm; sw.DiffComputer = sf.DiffComputer; sw.SurfaceReconstruction = sf.SurfaceReconstruction; return(sw); } }
//查询,根据名字 public static DetectEquipmentCls QueryDetectEquipmentByName(string _name) { using (HullShellContainer hs = new HullShellContainer()) { DetectEquipment de = hs.DetectEquipmentSet.Where(d => d.DetectEquipmentName == _name).FirstOrDefault(); DetectEquipmentCls dec = new DetectEquipmentCls(); dec.Id = de.Id; dec.MeasureDeviceName = de.DetectEquipmentName; dec.CameraResolution = de.CameraResolution; dec.PixelSize = de.PixelSize; dec.StdPrecision = de.StdPrecision; return(dec); } }
//增加 public static int AddAdmin(AdminsCls adc) { using (HullShellContainer hs = new HullShellContainer()) { Admins adm = new Admins { UserName = adc.UserName, PassWod = adc.PassWord, Role = adc.Role }; hs.AddToAdminsSet(adm); return(hs.SaveChanges()); } }
//增加软件信息 public static int AddSoftware(SoftWareCls sw) { using (HullShellContainer hs = new HullShellContainer()) { Software sf = new Software { SoftwareName = sw.SoftWareName, RegisterAlgorithm = sw.RegisterAlgorithm, DiffComputer = sw.DiffComputer, SurfaceReconstruction = sw.SurfaceReconstruction }; hs.AddToSoftwareSet(sf); return(hs.SaveChanges()); } }