Beispiel #1
0
        /// <summary>
        /// Determind what will be name of the next external directory
        /// </summary>
        /// <param name="app">The app.</param>
        /// <param name="deliveryType">(FULL OR DELTA)</param>
        /// <returns></returns>
        public static String GetTheNextExternalDirectory(ApplicationBE app, String deliveryType)
        {
            //path to the root directory
            String rootInternalDirectoryPath = ConstantBE.OUTPUTPATH + '\\' + app.FolderName + "\\Externals";

            //get all sub folders in the root directory
            String[] directories = Directory.GetDirectories(rootInternalDirectoryPath);

            String nextExternalDirectoryName = String.Empty;

            //have not done any external delivery
            //therfore should be 1
            if (directories.Count() == 0)
            {
                //{0}_Liv_{1}_({2})
                nextExternalDirectoryName =  String.Format(ConstantBE.EXTERNALSDIRECTORYFORMAT, app.Quadri, "1", deliveryType);
            }
            else
            {
                //The HARD WAY

                /*
                //empty int collection
                Collection<int> intCol = new Collection<int>();

                //we get the integer part in the folders
                foreach (String dir in directories)
                {
                    //search for the interger part in the string
                    //and extract it
                    var integerPath = Regex.Match(dir, @"\d+");

                    intCol.Add(
                        int.Parse(integerPath.Value));
                }

                //.Max() will return the biggest digit in the collection
                //nextExternalDirectoryName = String.Format(ContantsBE.EXTERNALSDIRECTORYFORMAT, app.Quadri, intCol.Max() + 1, deliveryType);

                */

                //The EASY WAY
                //incrementing the subdirectorycount should be the next number
                //for the delivery folder

                //{0}_Liv_{1}_({2})
                nextExternalDirectoryName = String.Format(ConstantBE.EXTERNALSDIRECTORYFORMAT, app.Quadri, directories.Count() + 1, deliveryType);

            }


            return nextExternalDirectoryName;
        }
Beispiel #2
0
        /// <summary>
        /// Fetch all the applications from the XML file
        /// </summary>
        /// <returns></returns>
        public static Collection<ApplicationBE> GetAllApplications()
        {
            //get the xml file path
            String xmlPath = ConstantBE.CONFIGPATH + '\\' + ConstantBE.APPLICATIONLISTFILE;

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(xmlPath);

            //retrive all  the nodes having tag "Application"
            XmlNodeList xmlNodeList = xmlDoc.SelectNodes("//Applications/Application");

            Collection<ApplicationBE> applicationCol = new Collection<ApplicationBE>();

            foreach (XmlElement item in xmlNodeList)
            {
                ApplicationBE newApp = new ApplicationBE();

                newApp.ID = int.Parse(item.ChildNodes[0].InnerText);
                newApp.Name = item.ChildNodes[1].InnerText;

                //convert it to upper in case it is not in the xml file
                newApp.Quadri = item.ChildNodes[2].InnerText.ToUpper();

                newApp.FolderName = item.ChildNodes[3].InnerText;

                Collection<String> delvCol = new Collection<string>();

                //loop for all deliverables
                foreach (XmlElement delvItem in item.ChildNodes[4])
                {
                    delvCol.Add(delvItem.InnerText);
                }

                newApp.Deliverables = delvCol;

                applicationCol.Add(newApp);
            }

            return applicationCol;
        }
Beispiel #3
0
        /// <summary>
        /// Get our BL object from the JSON object
        /// </summary>
        /// <param name="jsonObject">The json object.</param>
        /// <returns></returns>
        private BLInformationBE GetBLFromJsonObject(JsonBE jsonObject, String delvType, String nextExternalDirectory)
        {
            BLInformationBE bonDeLivraison = new BLInformationBE();

            ApplicationBE application = new ApplicationBE();

            //assigned the application quadri
            //it is the only variable that is used for the BL
            //no need to assigned the others
            application.Quadri = jsonObject.Step1.ApplicationQuadri;

            bonDeLivraison.App = application;

            //parse the ITF to number
            bonDeLivraison.IFT = int.Parse(jsonObject.Step1.ITFNumber);

            //get the person name and assigned it to the object
            bonDeLivraison.PreparedBy = TransversalDA.GetPersonDetailsByID(jsonObject.Step2.PreparedBy).name;
            bonDeLivraison.ApprovedBy = TransversalDA.GetPersonDetailsByID(jsonObject.Step2.ApprovedBy).name;

            //parse the delivery date date
            DateTime deliveryDate = DateTime.Parse(jsonObject.Step2.DeliveryDate);

            //both dates will be the same !!
            bonDeLivraison.PreparedDate = deliveryDate;
            bonDeLivraison.ApprovedDate = deliveryDate;

            Collection<BLDeliverableBE> bonDeLivraisonDeliverableCol = new Collection<BLDeliverableBE>();

            int countDeliverables = 1;

            foreach (String item in jsonObject.Step1.SVNLinkAndVersion)
            {
                //split the string to an array to get the
                //other items
                String[] splitLinkAndVersionItem = item.Split(';');

                BLDeliverableBE bonDeLivraisonDeliverable = new BLDeliverableBE();

            #warning add version
                bonDeLivraisonDeliverable.ID = countDeliverables;
                bonDeLivraisonDeliverable.Name = splitLinkAndVersionItem[0];
                bonDeLivraisonDeliverable.Etiquette = splitLinkAndVersionItem[1];

                //only for those two we don't put version number
                if ((bonDeLivraisonDeliverable.Name == "DB") || (bonDeLivraisonDeliverable.Name == "K2PROCESS"))
                {
                    bonDeLivraisonDeliverable.Version = String.Empty;
                }
                else
                {
                    bonDeLivraisonDeliverable.Version = jsonObject.Step1.NewVersion.Substring(0, 5);
                }

                //bonDeLivraisonDeliverable.Version = splitLinkAndVersionItem[2];
                bonDeLivraisonDeliverable.Location = DirectoryManagementDA.GetDistributionDirectoryPath(application.Quadri, delvType,
                    bonDeLivraisonDeliverable.Name, bonDeLivraison.IFT.ToString(), nextExternalDirectory);

                bonDeLivraisonDeliverableCol.Add(bonDeLivraisonDeliverable);

                countDeliverables++;
            }

            String[] splitChangeAndQCItem = jsonObject.Step2.ChangeQCAndDescription.Split(';');

            bonDeLivraison.Reference = splitChangeAndQCItem[0];
            bonDeLivraison.ReferenceDescription = splitChangeAndQCItem[1];

            //assigned the deliverable collection
            bonDeLivraison.BLSoftwareDeliverableCol = bonDeLivraisonDeliverableCol;

            Collection<BLDocumentationBE> bonDeLivraisonDocumentationCol = new Collection<BLDocumentationBE>();

            int countDocDeliverables = 1;

            foreach (String item in jsonObject.Step2.Documentation)
            {
                //split the string to an array to get the
                //other items
                String[] splitLinkAndVersionItem = item.Split(';');

                BLDocumentationBE bonDeLivraisonDoc = new BLDocumentationBE();

                bonDeLivraisonDoc.ID = countDocDeliverables;
                bonDeLivraisonDoc.DocName = splitLinkAndVersionItem[0];
                bonDeLivraisonDoc.Location = splitLinkAndVersionItem[1];
                bonDeLivraisonDoc.Remark = splitLinkAndVersionItem[2];

                //we are changin version
                if (jsonObject.Step1.NewVersion != jsonObject.Step1.OldVersion)
                {
                    bonDeLivraisonDoc.Version = jsonObject.Step1.NewVersion.Substring(0, 5);
                }
                else
                {
                    bonDeLivraisonDoc.Version = "1.0.0";
                }

                bonDeLivraisonDocumentationCol.Add(bonDeLivraisonDoc);

                countDocDeliverables++;
            }

            //assigned the document collection
            bonDeLivraison.BLDocumentDeliverableCol = bonDeLivraisonDocumentationCol;

            return bonDeLivraison;
        }