示例#1
0
        /// <summary>
        /// Loads the files
        /// </summary>
        public void LoadFilesExcel()
        {
            DataTable dtResult = new DataTable();

            dtResult = GetDataTable(_fileName, FILE_SHEET, "Name <> '' AND AttributesList <> ''");

            UMLPackage pack = new UMLPackage();

            pack.Name  = "FileImport";
            pack.Owner = _designModel;
            Packages.Add(pack);

            foreach (DataRow dr in dtResult.Rows)
            {
                UMLFile file = new UMLFile();
                file.Name = dr["Name"].ToString().Trim();
                string test = file.Name.GetType().Name;
                file.Dets  = Convert.ToInt32(dr["Dets"].ToString());
                file.Rets  = Convert.ToInt32(dr["Rets"].ToString());
                file.Type  = dr["Type"].ToString();
                file.Owner = pack;

                string[] attributes = dr["AttributesList"].ToString().Split(',');
                foreach (string a in attributes)
                {
                    UMLAttribute attri = new UMLAttribute();
                    attri.Name  = a.Trim();
                    attri.Owner = file;
                    file.Attributes.Add(attri);
                }
                AddFile(file);
            }
        }
示例#2
0
        /// <summary>
        /// Loads the use cases and collaborations
        /// </summary>
        public void LoadUseCasesCollaborationsExcel()
        {
            DataTable dtResult = new DataTable();

            dtResult = GetDataTable(_fileName, COLLABORATION_SHEET, "Name <> ''");

            UMLPackage pack = new UMLPackage();

            pack.Name  = "UseCaseImport";
            pack.Owner = _scenariosModel;
            Packages.Add(pack);

            foreach (DataRow dr in dtResult.Rows)
            {
                UMLUseCase useCase = new UMLUseCase();
                useCase.Name  = dr["UseCase"].ToString().Trim();
                useCase.Owner = pack;
                useCase       = AddUseCase(useCase);

                UMLCollaboration collaboration = new UMLCollaboration();
                collaboration.Name = dr["Name"].ToString().Trim();
                collaboration.Type = dr["Type"].ToString();

                if (dr["SendMessage"].ToString() == "X")
                {
                    collaboration.SendMessage = true;
                }

                if (dr["GenerateAction"].ToString() == "X")
                {
                    collaboration.GenerateAction = true;
                }

                string[] filesName = dr["FilesList"].ToString().Split(',');
                foreach (string fName in filesName)
                {
                    UMLFile file = new UMLFile();
                    file.Name = fName.Trim();
                    file      = AddFile(file);
                    collaboration.Files.Add(file);
                }

                collaboration.Owner = useCase;
                collaboration       = AddCollaboration(collaboration);
                useCase.Collaborations.Add(collaboration);
            }
        }
示例#3
0
        /// <summary>
        /// Adds a new file
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        private UMLFile AddFile(UMLFile file)
        {
            file.Stereotype = Constants.UMLFile.STEREOTYPE;
            foreach (UMLFile f in Files)
            {
                if (file.Name == f.Name)
                {
                    f.Dets       = file.Dets;
                    f.Rets       = file.Rets;
                    f.Type       = file.Type;
                    f.Attributes = file.Attributes;
                    f.Owner      = file.Owner;
                    f.Stereotype = file.Stereotype;
                    return(f);
                }
            }

            Files.Add(file);
            return(file);
        }