/// <summary> /// Get Project Type Phases /// </summary> /// <returns>Array of phases</returns> public MProjectTypePhase[] GetPhases() { List <MProjectTypePhase> list = new List <MProjectTypePhase>(); String sql = "SELECT * FROM C_Phase WHERE C_ProjectType_ID=" + GetC_ProjectType_ID() + " ORDER BY SeqNo"; try { DataSet ds = DataBase.DB.ExecuteDataset(sql, null, Get_TrxName()); if (ds.Tables.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { list.Add(new MProjectTypePhase(GetCtx(), dr, Get_TrxName())); } } } catch (Exception ex) { log.Log(Level.SEVERE, sql, ex); } // MProjectTypePhase[] retValue = new MProjectTypePhase[list.Count]; retValue = list.ToArray(); return(retValue); }
/// <summary> /// Copy Tasks from other Phase /// </summary> /// <param name="fromPhase">from phase</param> /// <returns>number of tasks copied</returns> public int CopyTasksFrom(MProjectTypePhase fromPhase) { if (fromPhase == null) { return(0); } int count = 0; // Copy Type Tasks MProjectTypeTask[] fromTasks = fromPhase.GetTasks(); for (int i = 0; i < fromTasks.Length; i++) { MProjectTask toTask = new MProjectTask(this, fromTasks[i]); if (toTask.Save()) { count++; } } log.Fine("#" + count + " - " + fromPhase); if (fromTasks.Length != count) { log.Log(Level.SEVERE, "Count difference - TypePhase=" + fromTasks.Length + " <> Saved=" + count); } return(count); }
/// <summary> /// Copy Tasks from other Phase /// </summary> /// <param name="fromPhase">from phase</param> /// <returns>number of tasks copied</returns> public int CopyTasksFrom(MProjectTypePhase fromPhase) { if (fromPhase == null) { return(0); } int count = 0; int tasklinecount = 0; // Copy Type Tasks MProjectTypeTask[] fromTasks = fromPhase.GetTasks(); for (int i = 0; i < fromTasks.Length; i++) { MProjectTask toTask = new MProjectTask(this, fromTasks[i]); if (toTask.Save()) { // check if table exists then only it will copy the task lines if (PO.Get_Table_ID("C_TaskLine") > 0) { tasklinecount = CopyMTaskLines(fromTasks[i].GetC_Task_ID(), toTask.GetC_ProjectTask_ID()); } count++; } } log.Fine("#" + count + " - " + fromPhase + ", #" + tasklinecount); if (fromTasks.Length != count) { log.Log(Level.SEVERE, "Count difference - TypePhase=" + fromTasks.Length + " <> Saved=" + count); } return(count); }
/// <summary> /// Copy Constructor /// </summary> /// <param name="project">parent</param> /// <param name="phase">copy</param> public MProjectPhase(MProject project, MProjectTypePhase phase) : this(project) { // SetC_Phase_ID(phase.GetC_Phase_ID()); // FK SetName(phase.GetName()); SetSeqNo(phase.GetSeqNo()); SetDescription(phase.GetDescription()); SetHelp(phase.GetHelp()); if (phase.GetM_Product_ID() != 0) { SetM_Product_ID(phase.GetM_Product_ID()); } SetQty(phase.GetStandardQty()); }