public int CopyStrandsFromTemplate( RecProductionCast record ) { var rec = new RecProductionFormStrandStd { Factory = record.Factory, Project = record.Project, Name = record.Form }; var svc = new ProjectManager(); var list = svc.LoadProductionFormStrandStd( rec ); if (list == null || list.Count == 0) { return 0; } list = (from o in list where o.IsUsed select o).ToList(); foreach (var std in list) { var strand = new RecProductionCastStrand { Factory = record.Factory, Project = record.Project, CastId = record.CastId, StrandPos = std.StrandPos, StrandX = std.StrandX, StrandY = std.StrandY, StrandQuality = std.StrandQuality, StrandDimension = std.StrandDimension, StrandPrestressing = std.StrandPrestressing }; this.InsertProductionCastStrand( strand, null, null ); } return list.Count; }
/// <summary> /// Load standard strands into strand list /// </summary> /// <param name="record"></param> /// <returns></returns> public List<RecProductionCastStrand> LoadStandardStrands( RecProductionFormStrandStd record ) { var strands = new List<RecProductionCastStrand>(); var svc = new ProjectManager(); var list = svc.LoadProductionFormStrandStd( record ); list = ( from o in list where o.IsUsed select o ).ToList(); foreach( var std in list ) { var strand = new RecProductionCastStrand() { Factory = record.Factory, Project = record.Project, StrandPos = std.StrandPos, CastId = 0, // Since it is not created yet }; strands.Add( strand ); } return strands; }
/// <summary> /// Returns no of strands /// </summary> /// <param name="castunit"></param> /// <returns></returns> private int GetNumberOfStrands( RecProductionFormStd castunit ) { var nbrOfStrands = 0; if( castunit == null || string.IsNullOrEmpty( castunit.Factory ) || string.IsNullOrEmpty( castunit.Project ) ) { return nbrOfStrands; } var svc = new ProjectManager(); var recStrand = new RecProductionFormStrandStd { Factory = castunit.Factory, Project = castunit.Project, Name = castunit.Name }; var strands = svc.LoadProductionFormStrandStd( recStrand ); if( null != strands ) { nbrOfStrands = (from o in strands where o.IsUsed select o).Count(); } return nbrOfStrands; }
/// <summary> /// LoadFormStrands /// </summary> /// <param name="forms"></param> /// <param name="filter"></param> private void LoadFormStrands( IEnumerable<RecProductionFormStd> forms, Filter filter ) { if( null == forms ) { return; } foreach( var recProductionFormStd in forms ) { if( recProductionFormStd.FormType == FormType.Bed && recProductionFormStd.StrandType == StrandType.Bed ) { // Load for strands var stdSvc = new ProjectManager(); var recStrand = new RecProductionFormStrandStd { Factory = filter.Factory, Project = filter.Project, Name = recProductionFormStd.Name }; var strands = stdSvc.LoadProductionFormStrandStd( recStrand ); if( null != strands ) { strands = (from o in strands where o.IsUsed select o).ToList(); } recProductionFormStd.Strands = strands; } else if( recProductionFormStd.FormType == FormType.Bed && ( recProductionFormStd.ElementType.Equals( "HD/F" ) || recProductionFormStd.ElementType.Equals( "D/F" ) ) ) { recProductionFormStd.Strands = LoadHollowcoreStrands( recProductionFormStd, filter); } } }