Exemplo n.º 1
0
        public void LoadFromExternalProject(ExternalProject iExternalProject)
        {
            if (_IsLoading.Value)
            {
                return;
            }
            using (var locker = new BoolLocker(ref _IsLoading))
            {
                LoadPackageCombo();
                _StatusEnum = StatusEnum.New;
                _MainTask   = null;
                FillControl();

                cboCreationUser.SelectedValue = _Group.CurrentUser.Id;
                txtCreationDate.Text          = DateTime.Now.ToShortDateString();
                txtDescription.Text           = iExternalProject.Description;
                txtName.Text = iExternalProject.ProjectName;

                cboProjectNumber.Text     = iExternalProject.ProjectNumber;
                cboRequestUser.Text       = iExternalProject.Pilote;
                cboTaskType.SelectedValue = MainTaskTypeEnum.ProjectDeveloppement;

                if (iExternalProject.DateObjectiveEnd != null)
                {
                    dtpObjectifDate.Checked = true;
                    dtpObjectifDate.Value   = (DateTime)iExternalProject.DateObjectiveEnd;
                }

                ControlValidator();
                this.Focus();
            }
        }
Exemplo n.º 2
0
        private static void diagnosticForExternalProject()
        {
            //should not trigger warning
            var test = new ExternalProject()
            {
                requiredProperty = 123,
                requiredField    = 456,
            };

            // should trigger warning - multiple prop msg
            new ExternalProject();

            // should show multiple prop msg
            new ExternalProject()
            {
                notRequired = 123,
            };

            // should show singular prop msg
            new ExternalProject()
            {
                notRequired      = 345,
                requiredProperty = 456,
            };
        }
Exemplo n.º 3
0
        public void ProcessedExternalProject(ExternalProject iExternalProject)
        {
            if (iExternalProject == null)
            {
                throw new Exception("Le projet externe est null");
            }
            if (iExternalProject.ExternalProjectId < 1)
            {
                throw new Exception("L'id du projet externe est invalide");
            }

            var entity = DBReleaseDataService.GetExternalProject(iExternalProject.ExternalProjectId);

            entity.IsProcessed = true;
            DBReleaseDataService.UpdateExternalProject(entity);
        }
Exemplo n.º 4
0
        private void UpdatexternalProject(ExternalProject iExternalProject)
        {
            if (iExternalProject == null)
            {
                throw new Exception("Le projet externe est null");
            }
            if (iExternalProject.ExternalProjectId < 1)
            {
                throw new Exception("L'id du projet externe est invalide");
            }

            var newEntity = new T_E_ExternalProject();

            newEntity.Merge(iExternalProject);
            DBReleaseDataService.UpdateExternalProject(newEntity);
        }
Exemplo n.º 5
0
        private long AddExternalProject(ExternalProject iExternalProject)
        {
            if (iExternalProject == null)
            {
                throw new Exception("Le projet externe est null");
            }
            if (iExternalProject.ExternalProjectId != -1)
            {
                throw new Exception("L'id du projet externe est invalide");
            }

            var newEntity = new T_E_ExternalProject();

            newEntity.Merge(iExternalProject);
            return(DBReleaseDataService.AddExternalProject(newEntity));
        }
Exemplo n.º 6
0
        // optional: helper method to upload nepmeas xml files
        public bool UploadXML(ExternalProject project, string measurements, string path)
        {
            // create a new FileStream with the given path
            Stream fs = new FileStream(path, FileMode.Open, FileAccess.Read);

            // create a new uploadName using the provided method NepMeasUpload
            // from the super class
            string uploadName = NepMeasUpload(fs);

            // upload the nepmeas files to neplan cloud using the provided
            // method ImportMeasuredDataFromXMlFile from the super class
            Boolean x = ImportMeasuredDataFromXMlFile(project, uploadName, measurements);

            // close the FileStream
            fs.Close();

            // return the returned Boolean
            return(x);
        }
Exemplo n.º 7
0
            public static ExternalProjectView ConvertTo(ExternalProject iObj)
            {
                if (iObj == null)
                {
                    return(null);
                }

                var newView = new ExternalProjectView();

                newView.Object = iObj;

                newView.DateObjectiveEnd = iObj.DateObjectiveEnd.ToShortDateString();
                newView.Description      = iObj.Description;
                newView.Pilote           = iObj.Pilote;
                newView.Priority         = (iObj.Priority != null) ? iObj.Priority.ToString() : null;
                newView.ProjectName      = iObj.ProjectName;
                newView.ProjectNumber    = iObj.ProjectNumber;
                newView.Status           = iObj.Status.GetName("FR");
                newView.BEImpacted       = iObj.BEImpacted;

                return(newView);
            }
        public List <ExternalProject> GetExternalProjectListFromFile(string iFilePath)
        {
            Process excelProcess = null;
            var     rowIndex     = 3;

            try
            {
                Excel.Application excel = null;
                Excel.Workbook    wkb   = null;

                //Ouverture par process piur killer
                excel = new Excel.Application();
                uint   processId;
                IntPtr h = new IntPtr(excel.Hwnd);
                GetWindowThreadProcessId(h, out processId);
                excelProcess = Process.GetProcessById((int)processId);

                wkb = OpenBook(excel, iFilePath, true, false, false);
                var sheet = wkb.Sheets[1] as Excel.Worksheet;

                var result = new List <ExternalProject>();

                //bouclage sur les lignes
                while (sheet.Cells[rowIndex, PROJECTNUMBERCOLUMNINDEX].Value != null)
                {
                    var newExternalProject = new ExternalProject();

                    //Priority
                    double?priority = sheet.Cells[rowIndex, PRIORITYCOLUMNINDEX].Value;
                    newExternalProject.Priority = (priority != null) ? (int?)Convert.ToInt32(priority) : null;

                    //project Number
                    newExternalProject.ProjectNumber = sheet.Cells[rowIndex, PROJECTNUMBERCOLUMNINDEX].Value;

                    //Status
                    string theStatus = sheet.Cells[rowIndex, STATUSCOLUMNINDEX].Value;
                    if (theStatus.IsNullOrEmpty())
                    {
                        newExternalProject.Status = EquinoxeExtend.Shared.Enum.ExternalProjectStatusEnum.Waiting;
                    }
                    else if (theStatus == "En cours")
                    {
                        newExternalProject.Status = EquinoxeExtend.Shared.Enum.ExternalProjectStatusEnum.InProgress;
                    }
                    else if (theStatus == "Clôturé")
                    {
                        newExternalProject.Status = EquinoxeExtend.Shared.Enum.ExternalProjectStatusEnum.Completed;
                    }
                    else if (theStatus == "Annulé")
                    {
                        newExternalProject.Status = EquinoxeExtend.Shared.Enum.ExternalProjectStatusEnum.Canceled;
                    }
                    else
                    {
                        throw new Exception("Le statut n'est pas supporté");
                    }

                    //Nom projet
                    newExternalProject.ProjectName = sheet.Cells[rowIndex, PROJECTNAMECOLUMNINDEX].Value;

                    //Description
                    newExternalProject.Description = null;//sheet.Cells[rowIndex, DESCRIPTIONCOLUMNINDEX].Value;

                    //Pilote
                    newExternalProject.Pilote = sheet.Cells[rowIndex, PILOTECOLUMNINDEX].Value;

                    //BE
                    string beImpacted = sheet.Cells[rowIndex, BECOLUMNINDEX].Value;
                    newExternalProject.BEImpacted = (beImpacted.IsNullOrEmpty()) ? false : true;

                    //Date cloture prev
                    var dateInit = sheet.Cells[rowIndex, DATEOBJECTIFENDINITCOLUMNINDEX].Value;
                    if (dateInit != null)
                    {
                        newExternalProject.DateObjectiveEnd = (DateTime?)Convert.ToDateTime(dateInit);
                    }
                    else
                    {
                        DateTime?datePrev = sheet.Cells[rowIndex, DATEOBJECTIFENDPREVCOLUMNINDEX].Value;
                        newExternalProject.DateObjectiveEnd = datePrev;
                    }

                    result.Add(newExternalProject);

                    rowIndex += 1;
                }

                wkb.Close(0);
                excel.Quit();

                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                excelProcess.Close();
            }
        }