コード例 #1
0
        private async void UnAssignAdd()
        {
            Login.MasterPage.Loading(true, this);
            //set MTO
            DataLibrary.ProgressAssignment update = new DataLibrary.ProgressAssignment();

            List<DataLibrary.MTODTO> assignedPsdto = new List<DataLibrary.MTODTO>();

            foreach (var var in lvUnAssignedComponent.SelectedItems)
            {
                DataLibrary.MTODTO dto = var as DataLibrary.MTODTO;
                dto.UpdatedBy = Login.UserAccount.PersonnelId;
                dto.ProjectScheduleID = Lib.ScheduleDataSource.selectedSchedule;
                dto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update;
                assignedPsdto.Add(dto);
            }

            update.progress = assignedPsdto;

            //set schedule
            await _commonsource.GetProjectScheduleAllByProjectIDdisciplineCode(_projectid, _disciplineCode);
            if (_commonsource.ProjectSchedule == null)
            {
                Login.MasterPage.Loading(false, this);
                return;
            }

            DataLibrary.ProjectscheduleDTO psdto = _commonsource.ProjectSchedule.Where(x => x.ProjectScheduleID == Lib.ScheduleDataSource.selectedSchedule).SingleOrDefault();
            if (psdto != null)
            {
                psdto.CWPID = Lib.CWPDataSource.selectedCWP;
                psdto.UpdatedBy = Login.UserAccount.PersonnelId;
                psdto.UpdatedDate = DateTime.Now;
                psdto.CreatedDate = psdto.CreatedDate == DateTime.MinValue ? WinAppLibrary.Utilities.Helper.DateTimeMinValue : psdto.CreatedDate;
                update.schedule = psdto;
            }

            var result = await _commonsource.UpdateProjectScheduleAssignment(update);
            await _commonsource.GetDrawingOnMode(Lib.CWPDataSource.selectedCWP, 0, _obj.taskCategoryIdList, _obj.taskTypeLUIDList, _obj.materialIDList, _obj.progressIDList,
                        _obj.searhValue, _projectid, _disciplineCode, -1);
            // await _commonsource.GetDrawingOnMode(Lib.CWPDataSource.selectedCWP, 0, _obj.taskCategoryCodeList, _obj.taskCategoryIdList, _obj.systemIdList, _obj.typeLUIdList,
            //                   _obj.drawingtypeLUIdList, _obj.costcodeIdList, _obj.searchstringList, _obj.compsearchstringList, _obj.locationList, _obj.rfinumberList, null, _obj.searchvalueList
            //                   , _projectid, _disciplineCode, -1);
            await _commonsource.GetComponentProgressByFIWP(0, Lib.ScheduleDataSource.selectedSchedule, _projectid, _disciplineCode);

            //if (lvUnAssignedComponent.SelectedItems.Count == lvUnAssignedComponent.Items.Count)
            //{

            //}
            int drawingId = Convert.ToInt32((lvDrawing.SelectedItem as DataItem).UniqueId);
            lvUnAssignedComponent.ItemsSource = _commonsource.GetGroupedUnAssignedComponent(drawingId);
            lvAssignedComponent.ItemsSource = _commonsource.GetGroupedAssignedComponent();

            tbUnAssignManhours.Text = "Total Man Hours : " + _commonsource.UnAssignedManhour;
            tbUnAssignCnt.Text = "Number of Components : " + _commonsource.UnAssignedCnt;
            tbAssignManhours.Text = "Total Man Hours : " + _commonsource.AssignedManhour;
            tbAssignCnt.Text = "Number of Components : " + _commonsource.AssignedCnt;
            ChangeDateResult(null);            
            //}
            //else
            //{
            //    List<DataGroup> source = _commonsource.GetGroupedDrawing();
            //    this.DefaultViewModel["Drawings"] = source;
            //}

            Login.MasterPage.Loading(false, this);
        }
コード例 #2
0
        //Confirm
        private async void btnSelectedAssign_Click(object sender, RoutedEventArgs e)
        {
            Login.MasterPage.Loading(true, this);

         
            //set fiwp
            DataLibrary.ProgressAssignment update = new DataLibrary.ProgressAssignment();

            List<DataLibrary.MTODTO> assignedPsdto = new List<DataLibrary.MTODTO>();

            List<DataLibrary.FiwpDTO> fiwplist = await (new Lib.ServiceModel.ProjectModel()).GetFiwpByID(Lib.IWPDataSource.selectedHydro);

            DataLibrary.FiwpDTO fiwpdto = new DataLibrary.FiwpDTO();

            if (fiwplist.Count > 0)
                fiwpdto = fiwplist[0];

            if (fiwpdto != null)
            {
                fiwpdto.UpdatedBy = Login.UserAccount.UserName;
                fiwpdto.UpdatedDate = DateTime.Now;
                fiwpdto.CreatedDate = fiwpdto.CreatedDate == DateTime.MinValue ? WinAppLibrary.Utilities.Helper.DateTimeMinValue : fiwpdto.CreatedDate;
                fiwpdto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update;
                update.fiwp = fiwpdto;

            }

            foreach (var var in lvUnAssignedComponent.SelectedItems)
            {
                DataLibrary.MTODTO dto = var as DataLibrary.MTODTO;
                dto.SIWPID = Lib.IWPDataSource.selectedHydro;
                dto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update;
                assignedPsdto.Add(dto);
            }

            update.progress = assignedPsdto;

            //set schedule
            LoadSchedule();
            DataLibrary.ProjectscheduleDTO psdto = _commonsource.ProjectSchedule.Where(x => x.ProjectScheduleID == Lib.ScheduleDataSource.selectedSchedule).SingleOrDefault();
            if (psdto != null)
            {
                psdto.CWPID = Lib.CWPDataSource.selectedCWP;
                psdto.UpdatedBy = Login.UserAccount.UserName;
                psdto.UpdatedDate = DateTime.Now;
                psdto.CreatedDate = psdto.CreatedDate == DateTime.MinValue ? WinAppLibrary.Utilities.Helper.DateTimeMinValue : psdto.CreatedDate;
                update.schedule = psdto;
            }

            var result = await _commonsource.UpdateHydroProgressAssignmentByStartPoint(update, Lib.CommonDataSource.selectedDrawing);

            await _commonsource.GetDrawingForAssignHydroOnMode(Lib.CWPDataSource.selectedCWP, 0, _obj.moduleList, _obj.processsystemList, _obj.lineList, _obj.pidList,
                            new List<int>(), new List<int>(), new List<int>(), new List<DataLibrary.ComboBoxDTO>(), null, new List<string>(), _projectid, _disciplineCode, -1);

            await _commonsource.GetComponentProgressBySIWP(Lib.IWPDataSource.selectedHydro, 0, _projectid, _disciplineCode);

            int drawingId = Convert.ToInt32((lvDrawing.SelectedItem as DataItem).UniqueId);
            lvUnAssignedComponent.ItemsSource = _commonsource.GetGroupedUnAssignedComponent(drawingId);
            lvAssignedComponent.ItemsSource = _commonsource.GetGroupedAssignedComponent();

            tbUnAssignManhours.Text = "Total Man Hours : " + _commonsource.UnAssignedManhour;
            tbUnAssignCnt.Text = "No. of components : " + _commonsource.UnAssignedCnt;
            tbAssignManhours.Text = "Total Man Hours : " + _commonsource.AssignedManhour;
            tbAssignCnt.Text = "No. of components : " + _commonsource.AssignedCnt;

            InitScope();

            Login.MasterPage.Loading(false, this);
        }
コード例 #3
0
        private async void UnAssignAdd()
        {
            Login.MasterPage.Loading(true, this);
            
            //set MTO
            DataLibrary.ProgressAssignment update = new DataLibrary.ProgressAssignment();

            List<DataLibrary.FiwpDTO> fiwplist = await (new Lib.ServiceModel.ProjectModel()).GetFiwpByID(Lib.IWPDataSource.selectedIWP);
            if (fiwplist == null)
            {
                Login.MasterPage.Loading(false, this);
                return;
            }

            DataLibrary.FiwpDTO fiwpdto = new DataLibrary.FiwpDTO();

            if (fiwplist.Count > 0)
                fiwpdto = fiwplist[0];

            if (fiwpdto != null)
            {
                fiwpdto.UpdatedBy = Login.UserAccount.PersonnelId;
                fiwpdto.UpdatedDate = DateTime.Now;
                fiwpdto.CreatedDate = fiwpdto.CreatedDate == DateTime.MinValue ? WinAppLibrary.Utilities.Helper.DateTimeMinValue : fiwpdto.CreatedDate;
                fiwpdto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update;
                fiwpdto.StartDate = WinAppLibrary.Utilities.Helper.DateTimeMinValue;
                fiwpdto.FinishDate = WinAppLibrary.Utilities.Helper.DateTimeMinValue;
                update.fiwp = fiwpdto;
            }

            List<DataLibrary.MTODTO> unassignedPsdto = new List<DataLibrary.MTODTO>();

            foreach (var var in lvAssignedComponent.SelectedItems)
            {
                DataLibrary.MTODTO dto = var as DataLibrary.MTODTO;
                dto.UpdatedBy = Login.UserAccount.PersonnelId;
                dto.FIWPID = 0;
                dto.DTOStatus = (int)DataLibrary.Utilities.RowStatus.Update;
                unassignedPsdto.Add(dto);
            }

            update.progress = unassignedPsdto;

            //set schedule
            LoadSchedule();
            if (_commonsource.ProjectSchedule == null)
            {
                Login.MasterPage.Loading(false, this);
                return;
            }

            DataLibrary.ProjectscheduleDTO psdto = _commonsource.ProjectSchedule.Where(x => x.ProjectScheduleID == Lib.ScheduleDataSource.selectedSchedule).SingleOrDefault();
            if (psdto != null)
            {
                psdto.CWPID = Lib.CWPDataSource.selectedCWP;
                psdto.UpdatedBy = Login.UserAccount.PersonnelId;
                psdto.UpdatedDate = DateTime.Now;
                psdto.CreatedDate = psdto.CreatedDate == DateTime.MinValue ? WinAppLibrary.Utilities.Helper.DateTimeMinValue : psdto.CreatedDate;
                update.schedule = psdto;
            }

            var result = await _commonsource.UpdateFIWPProgressAssignment(update);
           
            await _commonsource.GetDrawingForAssignIWPOnMode(Lib.CWPDataSource.selectedCWP, Lib.ScheduleDataSource.selectedSchedule, 0, _obj.taskCategoryIdList, _obj.taskTypeLUIDList, _obj.materialIDList, _obj.progressIDList,
                      _obj.searhValue, _projectid, _disciplineCode, -1);
            await _commonsource.GetComponentProgressByFIWP(Lib.IWPDataSource.selectedIWP, Lib.ScheduleDataSource.selectedSchedule, _projectid, _disciplineCode);


            //unasign 하려는 assigned component의 drawingid가 drawinglist에 없으면 drawing rebind
            bool state = false;
            foreach (DataItem dto in lvDrawing.Items)
            {
                if (lvAssignedComponent.Items.Count > 0)
                {
                    if (dto.UniqueId == (lvAssignedComponent.Items[0] as DataLibrary.MTODTO).DrawingID.ToString())
                        state = true;
                }
            }

            if (state)
            {
                int drawingId = Convert.ToInt32((lvDrawing.SelectedItem as DataItem).UniqueId);
                lvUnAssignedComponent.ItemsSource = _commonsource.GetGroupedUnAssignedComponent(drawingId, Lib.IWPDataSource.selectedIWP);
                lvAssignedComponent.ItemsSource = _commonsource.GetGroupedAssignedComponent();

                tbUnAssignManhours.Text = "Total Man Hours : " + _commonsource.UnAssignedManhour;
                tbUnAssignCnt.Text = "Number of Components : " + _commonsource.UnAssignedCnt;
                tbAssignManhours.Text = "Total Man Hours : " + _commonsource.AssignedManhour;
                tbAssignCnt.Text = "Number of Components : " + _commonsource.AssignedCnt;
                ChangeDateResult("", null);
            }
            else
            {
                List<DataGroup> source = _commonsource.GetGroupedDrawing();
                this.DefaultViewModel["Drawings"] = source;
            }
            Login.MasterPage.Loading(false, this);
        }