public ProgressAssignment UpdateIWPComponentprogressAssignment(ProgressAssignment list, bool isUsingMpp) { //string userName = string.Empty; //string password = string.Empty; //if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password)) //{ // string[] P6LoginInfo = (new P6Manager()).GetP6Login(); // userName = P6LoginInfo[0]; // password = P6LoginInfo[1]; //} if (isUsingMpp) { // project id, so get last project loaded in projectschedule. //MppHelper.Instance.GetProjectInstance(list.fiwp.ProjectID); } List<FiwpmaterialDTO> fiwpMaterial_new = new List<FiwpmaterialDTO>(); List<FiwpmaterialDTO> fiwpMaterial_old = new List<FiwpmaterialDTO>(); //first update all progresses. if (list.progress != null && list.progress.Count > 0 && list.fiwp != null) { //bool dochange = false; string updatedBy = list.progress[0].UpdatedBy; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew)) { try { list.progress = UpdateProgressAssignment(list.progress); //현재시점에서는 Device에서 ScheduleLineItem의 공사기간을 넘지못하도록 막고있기때문에 쓰이지 않는코드 - 2014.04.12 /* DoCheckProjectScheduleConstrain(dbname, list.fiwp, userName, password); if (!string.IsNullOrEmpty(list.fiwp.ExceptionMessage)) { if (list.fiwp.ExceptionMessage.Contains("Update ProjectSchedule")) dochange = true; else if (!string.IsNullOrEmpty(list.fiwp.ExceptionMessage)) throw new Exception(list.fiwp.ExceptionMessage); }*/ scope.Complete(); } catch (Exception ex) { if (scope != null) scope.Dispose(); throw new Exception("Fail to update ProgressAssignment", ex); } } if (list.fiwp != null) { #region "Update FIWP info to P6" //Component를 Assign함으로써 TotalManhours와 EstimatedWorker가 변경된다. //이 로직을 구현하기 위해 당 method리턴 후에 //Device에서 다른 UpdateIwpPeriod를 호출하고 있다. //추후 당method에 삽입하는 형태로 통합이 필요하다. - 2014.04.12 //switch (list.fiwp.DTOStatus) //{ // //case (int)RowStatus.New: // // DoProcessFIWPWBS(dbname, list.fiwp, userName, password); // // break; // case (int)RowStatus.Update: // DoUpdateFIWPToP6(list.fiwp, userName, password); // break; // //case (int)RowStatus.Delete: // // DoRemoveFIWPFromP6(dbname, list.fiwp, userName, password); // // break; //} //List<FiwpDTO> fiwps = new List<FiwpDTO>(); //fiwps.Add(list.fiwp); //fiwps = SaveIwp(fiwps); //if (fiwps != null && fiwps.Count > 0) // list.fiwp = fiwps[0]; //현재시점에서는 Device에서 ScheduleLineItem의 공사기간을 넘지못하도록 막고있기때문에 쓰이지 않는코드 - 2014.04.12 //if (dochange) // UpdateFIWPOutcomeProjectScheduleAndP6(dbname, list.fiwp, userName, password); #endregion "Update FIWP info to P6" #region "Insert/Update FIWP Material List" try { List<FiwpmaterialDTO> fiwpMateriallist = new List<FiwpmaterialDTO>(); List<FiwpmaterialDTO> tempList = new List<FiwpmaterialDTO>(); tempList = GetFiwpMaterialByFIWP(list.fiwp.FiwpID, list.fiwp.ProjectID, list.fiwp.DisciplineCode); if (tempList != null && tempList.Count() > 0) fiwpMaterial_old = tempList; tempList = GetMaterialForFiwpMaterialUpdating(list.fiwp.FiwpID, list.fiwp.ProjectID, list.fiwp.DisciplineCode); if (tempList != null && tempList.Count() > 0) fiwpMaterial_new = tempList; foreach (FiwpmaterialDTO newRow in fiwpMaterial_new) { FiwpmaterialDTO fiwpmaterial = new FiwpmaterialDTO(); var result = fiwpMaterial_old.Where(x => newRow.EstMHLibID == x.EstMHLibID).FirstOrDefault(); if (result != null) { fiwpmaterial = result; fiwpmaterial.Qty = newRow.Qty; fiwpmaterial.UOMLUID = newRow.UOMLUID; fiwpmaterial.DTOStatus = (int)RowStatusNo.Update; fiwpmaterial.UpdatedBy = updatedBy; } else { fiwpmaterial = newRow; fiwpmaterial.DTOStatus = (int)RowStatusNo.New; fiwpmaterial.UpdatedBy = updatedBy; } fiwpmaterial.FIWPID = list.fiwp.FiwpID; fiwpMateriallist.Add(fiwpmaterial); } if (fiwpMateriallist.Count > 0) fiwpMateriallist = (new TrueTask.Assemble()).SaveFiwpMaterial(fiwpMateriallist); //SaveFiwpMaterial(fiwpMateriallist); } catch (Exception ex) { throw ex; } #endregion "Insert/Update FIWP Material List" #region useless //#region "Insert/Update FIWP QAQC List" //try //{ // List<FiwpqaqcDTO> fiwpqaqcs = new List<FiwpqaqcDTO>(); // #region "Old" // /* // List<MTODTO> mtoList = (new DALC.ProgressDAL()).GetProgressByCwpFiwp(dbname, list.fiwp.ProjectID, list.fiwp.ModuleID, list.fiwp.CWPID, list.fiwp.FiwpID); // List<LibqaqcformtemplateDTO> libqaqcList = (new DALC.LibqaqcformtemplateDAL()).GetLibqaqcformtemplateByProject(dbname, list.fiwp.ProjectID); // List<QaqcformtemplateDTO> qaqctemplateList = (new DALC.QaqcformtemplateDAL()).GetQaqcformtemplateByFormtypeNameProject(dbname, QAQCFormType.IWP, string.Empty, list.fiwp.ProjectID); // List<FiwpqaqcDTO> fiwpqaqcList = (new DALC.FiwpqaqcDAL()).GetFiwpqaqcByFIWP(dbname, list.fiwp.FiwpID); // foreach (MTODTO progress in list.progress) // { // List<LibqaqcformtemplateDTO> libqaqcs = new List<LibqaqcformtemplateDTO>(); // MTODTO mto = mtoList.Where(x => x.ProgressID == progress.ProgressID).FirstOrDefault(); // libqaqcs = libqaqcList.Where(x => x.LibID == mto.LibEstManhrsID && x.TaskCategoryID == mto.TaskCategoryID).ToList(); // foreach (LibqaqcformtemplateDTO libqaqc in libqaqcs) // { // int Qty = 1; // QaqcformtemplateDTO qaqctemplate = qaqctemplateList.Where(x => x.QAQCFormTemplateID == libqaqc.QAQCFormTemplateID).FirstOrDefault(); // List<FiwpqaqcDTO> oldfiwpqaqcs = fiwpqaqcList.Where(x => x.QAQCFormTemplateID == libqaqc.QAQCFormTemplateID).ToList(); // if (qaqctemplate.QAQCTypeLUID == QAQCType.Tag) // { // var mtos = mtoList.Where(x => x.LibEstManhrsID == libqaqc.LibID && x.TaskCategoryID == libqaqc.TaskCategoryID).GroupBy(y => y.EngTagNumber).Select(z => z.Key).ToList(); // Qty = mtos.Count(); // } // if (oldfiwpqaqcs.Count() > 0) // { // oldfiwpqaqcs.ForEach(x => { x.Qty = Qty; x.UpdatedBy = list.fiwp.UpdatedBy; x.UpdatedDate = DateTime.Now; x.DTOStatus = (int)RowStatus.Update; }); // fiwpqaqcs.AddRange(oldfiwpqaqcs); // } // else // { // FiwpqaqcDTO newfiwpqaqc = new FiwpqaqcDTO(); // newfiwpqaqc.FIWPID = list.fiwp.FiwpID; // newfiwpqaqc.CWPID = list.fiwp.CWPID; // newfiwpqaqc.ProjectID = list.fiwp.ProjectID; // newfiwpqaqc.ModuleID = list.fiwp.ModuleID; // newfiwpqaqc.Qty = Qty; // newfiwpqaqc.QAQCFormTemplateID = libqaqc.QAQCFormTemplateID; // newfiwpqaqc.QAQCFormTypeLUID = QAQCFormType.IWP; // newfiwpqaqc.UpdatedBy = list.fiwp.UpdatedBy; // newfiwpqaqc.UpdatedDate = DateTime.Now; // newfiwpqaqc.DTOStatus = (int)RowStatus.New; // fiwpqaqcs.Add(newfiwpqaqc); // } // } // } // */ // #endregion // fiwpqaqcs = ProjectWriter.CreateFiwpQaqc(dbname, list.fiwp, list.progress);// (new Element.Reveal.Server.DALC.FiwpqaqcDAL()).SaveFiwpqaqc(dbname, fiwpqaqcs, RowStatus.None); //} //catch (Exception ex) //{ // throw ex; //} //#endregion "Insert/Update FIWP QAQC List" //#region "Sync FIWP_ProjectSchedule Resource to P6" //SyncScheduleFIWPResourceToP6(dbname, list.fiwp.FiwpID, list.fiwp.ProjectID, list.fiwp.ModuleID, userName, password); //#endregion "Sync FIWP_ProjectSchedule Resource to P6" #endregion } } return list; }
//public ExtSchedulerDTO UpdateFiwpManpower(ExtSchedulerDTO fiwpMPower, int projectscheduleId, int projectId, string disciplineCode) //{ // return (new Element.Reveal.Server.BALC.ScheduleWriter()).UpdateFiwpManPower(fiwpMPower, projectscheduleId, projectId, Helper.RemoveJsonParameterWrapper(disciplineCode)); //} //public ExtSchedulerDTO JsonUpdateFiwpManpower(ExtSchedulerDTO fiwpMPower, string projectscheduleId, string projectId, string disciplineCode) //{ // return (new Element.Reveal.Server.BALC.ScheduleWriter()).UpdateFiwpManPower(fiwpMPower, Int32.Parse(projectscheduleId), Int32.Parse(projectId), Int32.Parse(disciplineCode)); //} //public void UpdateManhoursEstimateByCostCode(int cwpId, int costcodeId, int projectId, string disciplineCode, decimal manhourRate, decimal baseQty, string updatedBy, string UpdateQty) //{ // (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateManhoursEstimateByCostCode(cwpId, costcodeId, projectId, Helper.RemoveJsonParameterWrapper(disciplineCode), manhourRate, baseQty, updatedBy, UpdateQty); //} //public void JsonUpdateManhoursEstimateByCostCode(string cwpId, string costcodeId, string projectId, string disciplineCode, string manhourRate, string baseQty, string updatedBy, string UpdateQty) //{ // (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateManhoursEstimateByCostCode(Int32.Parse(cwpId), Int32.Parse(costcodeId), Int32.Parse(projectId), Int32.Parse(disciplineCode), decimal.Parse(manhourRate), decimal.Parse(baseQty), updatedBy, UpdateQty); //} //public void UpdateComponentWithAssociatedTag(int projectid, string disciplineCode, int tab, string isolineno, int componentid, int systemid) //{ // (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateComponentWithAssociatedTag(projectid, Helper.RemoveJsonParameterWrapper(disciplineCode), tab, isolineno, componentid, systemid); //} //public void UpdateComponentWithSystem(int projectId, string disciplineCode, int tab, string firstid, string second, string third, int taskid, int isSystemEmpty, int systemId) //{ // (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateComponentWithSystemID(projectId, Helper.RemoveJsonParameterWrapper(disciplineCode), tab, firstid, second, third, taskid, isSystemEmpty, systemId); //} //public void JsonUpdateComponentWithSystem(string projectId, string disciplineCode, string tab, string firstid, string second, string third, string taskid, string isSystemEmpty, string systemId) //{ // (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateComponentWithSystemID(Int32.Parse(projectId), Int32.Parse(disciplineCode), Int32.Parse(tab), firstid, second, third, Int32.Parse(taskid), Int32.Parse(isSystemEmpty), Int32.Parse(systemId)); //} //public void UpdateMaterialWithReelNo(int cwpId, int fiwpId, int projectId, string disciplineCode, string filterName, string filterValue, string newReelNo) //{ // (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateMaterialWithReelNo(cwpId, fiwpId, projectId, Helper.RemoveJsonParameterWrapper(disciplineCode), filterName, filterValue, newReelNo); //} //public void JsonUpdateMaterialWithReelNo(string cwpId, string fiwpId, string projectId, string disciplineCode, string filterName, string filterValue, string newReelNo) //{ // (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateMaterialWithReelNo(Int32.Parse(cwpId), Int32.Parse(fiwpId), Int32.Parse(projectId), Int32.Parse(disciplineCode), filterName, filterValue, newReelNo); //} //public void UpdateProgressWithCWP(int cwpId, int materialCategoryId, int taskCategoryId, int projectId, string disciplineCode, int newCWPID) //{ // (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateProgressWithCWP(cwpId, materialCategoryId, taskCategoryId, projectId, Helper.RemoveJsonParameterWrapper(disciplineCode), newCWPID); //} //public void JsonUpdateProgressWithCWP(string cwpId, string materialCategoryId, string taskCategoryId, string projectId, string disciplineCode, string newCWPID) //{ // (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateProgressWithCWP(Int32.Parse(cwpId), Int32.Parse(materialCategoryId), Int32.Parse(taskCategoryId), Int32.Parse(projectId), Int32.Parse(disciplineCode), Int32.Parse(newCWPID)); //} //public void UpdateProgressCostCode(int cwpId, int materialcategoryid, int taskcategoryid, int componenttasktype, string engtag, int costcode, int projectid, string disciplineCode) //{ // (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateProgressCostCode(cwpId, materialcategoryid, taskcategoryid, componenttasktype, engtag, costcode, projectid, Helper.RemoveJsonParameterWrapper(disciplineCode)); //} //public void JsonUpdateProgressCostCode(string cwpId, string materialcategoryid, string taskcategoryid, string componenttasktype, string engtag, string costcode, string projectid, string disciplineCode) //{ // (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateProgressCostCode(Int32.Parse(cwpId), Int32.Parse(materialcategoryid), Int32.Parse(taskcategoryid), Int32.Parse(componenttasktype), engtag, Int32.Parse(costcode), Int32.Parse(projectid), Int32.Parse(disciplineCode)); //} //public List<ProgressDTO> UpdateProgressComponents(List<ProgressDTO> progress) //{ // return (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateComponentProgressProjectSchedule(progress); //} //public List<ProgressDTO> JsonUpdateProgressComponents(List<ProgressDTO> progress) //{ // return (new Element.Reveal.Server.BALC.ProjectWriter()).UpdateComponentProgressProjectSchedule(progress); //} //public ProgressAssignment UpdateProjectScheduleAssignment(ProgressAssignment progress, string userName, string password) //{ // return (new Element.Reveal.Server.BALC.ScheduleWriter()).UpdateProjectScheduleAssignment(progress, userName, password); //} //public ProgressAssignment JsonUpdateProjectScheduleAssignment(ProgressAssignment progress, string userName, string password) public ProgressAssignment JsonUpdateProjectScheduleAssignment(ProgressAssignment progress) { return (new Element.Sigma.Web.Biz.TrueTask.Build()).UpdateProjectScheduleAssignment(progress, Helper.isUsingMpp); }
public ProgressAssignment UpdateProjectScheduleAssignment(ProgressAssignment list, bool isUsingMpp) { if (isUsingMpp) { // project id, so get last project loaded in projectschedule. //MppHelper.Instance.GetProjectInstanceByLastLoaded(); } //This method is not able to do transcation process due to P6 updates //First is updating all progresses for schedule assignments list.progress = UpdateProgressAssignment(list.progress); ////Create or Update ResourceAssingment for the project schedule ////Return projectschedule after synchronizeing wiht P6 activity information //list.schedule = UpdateProjectSchedueAndP6(dbname, list.schedule, userName, password); //Update to projectschedule List<ProjectscheduleDTO> schedules = new List<ProjectscheduleDTO>(); schedules.Add(list.schedule); schedules = SaveProjschedule(schedules); if (schedules.Count > 0) list.schedule = schedules[0]; //#region "Sync ProjectSchedule Resource to P6" //SyncScheduleResourceToP6ByProjectSchedule(dbname, list.schedule.ProjectScheduleID, list.schedule.ProjectID, list.schedule.ModuleID, userName, password); //#endregion "Sync ProjectSchedule Resource to P6" return list; }
//public ScaffoldAndRequest SaveScaffoldrequest(ScaffoldAndRequest dto) //{ // return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveScaffoldrequest(dto); //} //public List<SystemDTO> SaveSystem(List<SystemDTO> system) //{ // return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveSystem(system); //} //public List<SystemDTO> SaveSystemProjectWizard(List<SystemDTO> system) //{ // return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveSystem(system); //} //public SystemDTO SaveSingleSystem(SystemDTO system) //{ // List<SystemDTO> list = new List<SystemDTO>(); // list.Add(system); // list = (new Element.Reveal.Server.BALC.ProjectWriter()).SaveSystem(list); // return list.FirstOrDefault(); //} //public List<AreaDTO> SaveArea(List<AreaDTO> area) //{ // return (new Element.Reveal.Server.BALC.ProjectWriter()).SaveArea(area); //} //public List<TimesheetDTO> SaveTimesheet(List<TimesheetDTO> timesheet, List<MTODTO> progresses, decimal workhour, int timeallocationId) //{ // return (new Element.Reveal.Server.BALC.ScheduleWriter()).SaveTimesheet(timesheet, progresses, workhour, timeallocationId); //} //public List<TimesheetDTO> JsonSaveTimesheet(List<TimesheetDTO> timesheet, List<MTODTO> progresses, string workhour, string timeallocationId) //{ // return (new Element.Reveal.Server.BALC.ScheduleWriter()).SaveTimesheet(timesheet, progresses, decimal.Parse(workhour), Int32.Parse(timeallocationId)); //} //public List<TimesheetDTO> SaveTimeAllocationRestore(int timeallocationId) //{ // return (new Element.Reveal.Server.BALC.ScheduleWriter()).SaveTimeAllocationRestore(timeallocationId); //} //public bool SaveDailyTimehseet(DateTime workDate, int dataId, int isDirect, int dailyTimesheetId, int status, string updatedBy, int projectId, string disciplineCode) //{ // return (new Element.Reveal.Server.BALC.ScheduleWriter()).SaveDailyTimesheet(workDate, dataId, isDirect, dailyTimesheetId, status, updatedBy, projectId, Helper.RemoveJsonParameterWrapper(disciplineCode), Cookies.GetSPCredential()); //} //public bool JsonSaveDailyTimehseet(string workDate, string intDataId, string intFlag, string dailyTimesheetId, string status, string updatedBy, string projectId, string disciplineCode) //{ // return (new Element.Reveal.Server.BALC.ScheduleWriter()).SaveDailyTimesheet(DateTime.Parse(workDate), Int32.Parse(intDataId), Int32.Parse(intFlag), Int32.Parse(dailyTimesheetId), Int32.Parse(status), updatedBy, Int32.Parse(projectId), Int32.Parse(disciplineCode), Cookies.GetSPCredential()); //} //public ProgressAssignment UpdateFIWPProgressAssignment(ProgressAssignment progress, string userName, string password) //{ // return (new Element.Reveal.Server.BALC.ScheduleWriter()).UpdateFIWPProgressAssignment(progress, userName, password); //} public ProgressAssignment JsonUpdateFIWPProgressAssignment(ProgressAssignment progress) { return (new Element.Sigma.Web.Biz.TrueTask.Build()).UpdateIWPComponentprogressAssignment(progress, Helper.isUsingMpp); }