/// <summary> /// Deprecated Method for adding a new object to the Worksheets EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToWorksheets(Worksheet worksheet) { base.AddObject("Worksheets", worksheet); }
/// <summary> /// Create a new Worksheet object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="prodCD">Initial value of the ProdCD property.</param> /// <param name="prodSetid">Initial value of the ProdSetid property.</param> public static Worksheet CreateWorksheet(global::System.Decimal id, global::System.String prodCD, global::System.String prodSetid) { Worksheet worksheet = new Worksheet(); worksheet.ID = id; worksheet.ProdCD = prodCD; worksheet.ProdSetid = prodSetid; return worksheet; }
protected void UpdateJobWorksheet(ProductionJob editJob, EditPrdnJobViewModel viewJob) { bool anyWSRows = viewJob.NotNullAny(n => n.IfNotNull(x => x.EditWorksheet).IfNotNull(x => x.WorksheetOpts)); Worksheet worksheet = editJob.Worksheet; if (worksheet != null) // clear the existing worksheet chars and comps { PrdnDBContext.ExecuteStoreCommand("DELETE FROM FG_WORKSHEET_CHAR WHERE FG_WORKSHEET_ID = :p0", worksheet.ID); PrdnDBContext.ExecuteStoreCommand("DELETE FROM FG_WORKSHEET_COMP WHERE FG_PARENT_COMP_PROD_CD IS NOT NULL AND FG_WORKSHEET_ID = :p0", worksheet.ID); PrdnDBContext.ExecuteStoreCommand("DELETE FROM FG_WORKSHEET_COMP WHERE FG_WORKSHEET_ID = :p0", worksheet.ID); if (anyWSRows) { editJob.AssignWorksheet(worksheet); } else { PrdnDBContext.DeleteObject(worksheet); } } else if (anyWSRows) { worksheet = new Worksheet { ID = PrdnIsisEntities.GetNextWorksheetID() }; editJob.AssignWorksheet(worksheet); } if (anyWSRows) { viewJob.EditWorksheet.WorksheetOpts.ForEach(o => o.AssignTypeProps()); foreach (var opt in viewJob.EditWorksheet.WorksheetOpts.Where(o => (o.Type == OptionType.Component) && o.IsRoot)) { WorksheetComp comp = Mapper.Map<WorksheetOpt, WorksheetComp>(opt); worksheet.WorksheetComps.Add(comp); } foreach (var opt in viewJob.EditWorksheet.WorksheetOpts.Where(o => (o.Type == OptionType.Component) && !o.IsRoot)) { WorksheetComp comp = Mapper.Map<WorksheetOpt, WorksheetComp>(opt); worksheet.WorksheetComps.Add(comp); } foreach (var opt in viewJob.EditWorksheet.WorksheetOpts.Where(o => o.Type == OptionType.Characteristic)) { WorksheetChar chr = Mapper.Map<WorksheetOpt, WorksheetChar>(opt); worksheet.WorksheetChars.Add(chr); } } }
public Worksheet CloneWorksheet(Worksheet ws, decimal cloneID) { if (ws == null) { return null; } Worksheet wsClone = (Worksheet)ws.Clone(); wsClone.ID = cloneID; foreach (WorksheetComp cmp in ws.WorksheetComps.Where(c => c.IsRoot)) { WorksheetComp cmpClone = (WorksheetComp)cmp.Clone(); cmpClone.WorksheetID = cloneID; if (cmp.ParentWorksheetID != null) { cmpClone.ParentWorksheetID = cloneID; } wsClone.WorksheetComps.Add(cmpClone); } foreach (WorksheetChar chr in ws.WorksheetChars.Where(c => c.IsRoot)) { WorksheetChar chrClone = (WorksheetChar)chr.Clone(); chrClone.WorksheetID = cloneID; wsClone.WorksheetChars.Add(chrClone); } foreach (WorksheetComp cmp in ws.WorksheetComps.Where(c => !c.IsRoot)) { WorksheetComp cmpClone = (WorksheetComp)cmp.Clone(); cmpClone.WorksheetID = cloneID; if (cmp.ParentWorksheetID != null) { cmpClone.ParentWorksheetID = cloneID; } wsClone.WorksheetComps.Add(cmpClone); } foreach (WorksheetChar chr in ws.WorksheetChars.Where(c => !c.IsRoot)) { WorksheetChar chrClone = (WorksheetChar)chr.Clone(); chrClone.WorksheetID = cloneID; wsClone.WorksheetChars.Add(chrClone); } return wsClone; }
public void AssignWorksheet(Worksheet worksheet) { if (Worksheet != worksheet) { Worksheet = worksheet; } if (Worksheet != null) { Worksheet.ProdCD = ProdCD; Worksheet.ProdSetid = ProdSetid; } }