Commits

Naethra D committed db09f1b

Changed files on Sep 28

Comments (0)

Files changed (20)

Source/Excel/Excel.AddIn/Excel.AddIn/Controller/Controller.cs

             }
 
             List<ParameterDetail> paramterList = new List<ParameterDetail>();
-            foreach (var item in metadataListViewModel.ParameterMetadataList)
+            var paramData = from val in metadataListViewModel.ParameterMetadataList
+                            group val by val.EntityName into param
+                            select new
+                            {
+                                EntityName = param.Key,
+                                Description = param.Select(q => (String.IsNullOrEmpty(q.EntityDescription) ? "" : q.EntityDescription)).FirstOrDefault(q => !String.IsNullOrEmpty(q)),
+                                Values = param.ToList()
+                            }; 
+
+            foreach (var item in paramData)
             {
-                ParameterDetail model = new ParameterDetail();
-                model.Name = item.Name;
-                model.Description = item.Description;
-                model.Type = item.Type;
-                model.Units = item.Units;
-                paramterList.Add(model);
+                item.Values.ForEach(q =>
+                {
+                    paramterList.Add(new ParameterDetail
+                    {
+                         EntityName = item.EntityName,
+                          EntityDescription = item.Description,
+                           Name = q.Name,
+                            Description = q.Description,
+                             Type = q.Type,
+                              Units = q.Units
+                    });
+                });
             }
 
             metadataManager.UpdateMetadata(updatedMetadata, paramterList);
 
                 string identifier = string.Empty;
                 var identifierNode = metadataListViewModel.MetadataList.Where(m => m.Name.EndsWith(Common.Constants.IdentifierKeyName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
-                if (!string.IsNullOrWhiteSpace(identifierNode.Value))
+                if (identifierNode!= null && !string.IsNullOrWhiteSpace(identifierNode.Value))
                 {
                     identifier = identifierNode.Value;
                 }
                     {
                         identifier = getIdentifierResult.Message;
 
-                        identifierNode.Value = identifier;
+                        if (identifierNode != null)
+                        {
+                            identifierNode.Value = identifier;
+                        }
 
                         // Add Identifer as part of citation if the citation is already generated.
                         string citation = string.Empty;
                     if (canContinue)
                     {
                         List<object> obj = metadataManager.GetHeaderRow(output as Microsoft.Office.Interop.Excel.Range);
-
+                        string entityName = metadataManager.ActiveSheetName(output as Microsoft.Office.Interop.Excel.Range);
                         if (obj.Count > 0)
                         {
-                            metadataManager.UpdateParaMetadata(obj);
+                            metadataManager.UpdateParaMetadata(obj, sheetName:entityName);
                             canContinue = false;
                         }
                         else
                     if (canContinue)
                     {
                         List<object> obj = metadataManager.GetHeaderRow(output as Microsoft.Office.Interop.Excel.Range);
+                        string entityName = metadataManager.ActiveSheetName(output as Microsoft.Office.Interop.Excel.Range);
 
                         if (obj.Count > 0)
                         {
                                 {
                                     newParameterList.Add(new ParameterDetail()
                                     {
+                                        EntityName = entityName,
                                         Name = item.ToString().Trim()
                                     });
                                 }
         public List<string> GetSheetNames()
         {
             var sheetsNames = this.excelManager.GetSheetNames();
-
-            return sheetsNames.OrderBy(s => s.Key).Select(s => s.Value).ToList();
+            if (sheetsNames != null)
+            {
+                return sheetsNames.OrderBy(s => s.Key).Select(s => s.Value).ToList();
+            }
+            return null;
         }
 
         public string GetUserAgreement(string repositoryName)

Source/Excel/Excel.AddIn/Excel.AddIn/Excel.AddIn.csproj

     <SccProvider>
     </SccProvider>
     <BootstrapperEnabled>true</BootstrapperEnabled>
-    <PublishUrl>D:\Code\Build-Excel-Aug22\</PublishUrl>
+    <PublishUrl>D:\Code\Build-Excel\Excel_Sep28\</PublishUrl>
     <InstallUrl />
     <TargetCulture>en</TargetCulture>
-    <ApplicationVersion>1.5.1.9</ApplicationVersion>
+    <ApplicationVersion>1.5.1.16</ApplicationVersion>
     <AutoIncrementApplicationRevision>true</AutoIncrementApplicationRevision>
     <UpdateEnabled>false</UpdateEnabled>
     <UpdateInterval>0</UpdateInterval>

Source/Excel/Excel.AddIn/Excel.AddIn/Excel.AddIn.csproj.user

 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
-    <PublishUrlHistory>D:\Code\Build-Excel-Aug22\</PublishUrlHistory>
+    <PublishUrlHistory>
+    </PublishUrlHistory>
     <InstallUrlHistory />
     <SupportUrlHistory />
     <ProjectView>ProjectFiles</ProjectView>

Source/Excel/Excel.AddIn/Excel.AddIn/Extensions/ParameterMetadataViewModelExtensions.cs

             {
                 thisObject = new ParameterMetadataViewModel();
             }
-
+            thisObject.EntityName = (metadata.EntityName == null)? metadata.EntityName : metadata.EntityName.Trim();
+            thisObject.EntityDescription = metadata.EntityDescription;
             thisObject.Name = metadata.Name.Trim();
             thisObject.Description = metadata.Description;
             thisObject.Type = metadata.Type;

Source/Excel/Excel.AddIn/Excel.AddIn/NewScientificMetadata.xml

   <metadatagroup>
     <metadata>
       <field>
+        Title of dataset
+      </field>
+      <description>
+        The title should reflect the contents of the dataset. Avoid being too general (e.g. "dataset01", or "results")
+      </description>
+      <mapping>
+        eml.dataset.title
+      </mapping>
+      <is-required>
+        true
+      </is-required>
+    </metadata>
+
+    <metadata>
+      <field>
         Creator: First name
       </field>
       <description>
 
     <metadata>
       <field>
+        Creator: Organization
+      </field>
+      <description>
+        The "Creator" is the person responsible for filling out the metadata
+      </description>
+      <mapping>
+        eml.dataset.creator.organizationName
+      </mapping>
+    </metadata>
+
+    <metadata>
+      <field>
         Creator: Address
       </field>
       <description>
 
     <metadata>
       <field>
+        Creator: Phone
+      </field>
+      <description>
+        The "Creator" is the person responsible for filling out the metadata
+      </description>
+      <mapping>
+        eml.dataset.creator.phone
+      </mapping>
+      <type>
+        Phone
+      </type>
+    </metadata>
+
+    <metadata>
+      <field>
         Creator: Email
       </field>
       <description>
 
     <metadata>
       <field>
-        Creator: Phone
-      </field>
-      <description>
-        The "Creator" is the person responsible for filling out the metadata
-      </description>
-      <mapping>
-        eml.dataset.contact.phone
-      </mapping>
-      <type>
-        Phone
-      </type>
-    </metadata>
-
-    <metadata>
-      <field>
-        Creator: Organization
-      </field>
-      <description>
-        The "Creator" is the person responsible for filling out the metadata
-      </description>
-      <mapping>
-        eml.dataset.creator.organizationName
-      </mapping>
-    </metadata>
-
-    <metadata>
-      <field>
-        Title of dataset
-      </field>
-      <description>
-        The title should reflect the contents of the dataset. Avoid being too general (e.g. "dataset01", or "results")
-      </description>
-      <mapping>
-        eml.dataset.title
-      </mapping>
-      <is-required>
-        true
-      </is-required>
-
-    </metadata>
-
-    <metadata>
-      <field>
         Today's date
       </field>
       <description>
       <is-required>
         true
       </is-required>
+      <type>
+        TextArea
+      </type>
     </metadata>
 
     <metadata>
       <field>
-        Repository name and contact information
+        keyword(s)
       </field>
       <description>
-        This field will be populated on posting the data to a repository.
+        Select keywords that describe your dataset. Use an appropriate controlled vocabulary list for your field. (You can specify multiple keywords as comma separated values.)
       </description>
       <mapping>
-        eml.dataset.publisher
+        eml.dataset.keywordSet.keyword
+      </mapping>
+      <is-required>
+        true
+      </is-required>
+    </metadata>
+
+    <metadata>
+      <field>
+        Keyword thesaurus used
+      </field>
+      <description>
+        Provide the source of the controlled vocabulary you used to choose keywords.
+      </description>
+      <mapping>
+        eml.dataset.keywordSet.keywordThesaurus
+      </mapping>
+    </metadata>
+
+    <metadata>
+      <field>
+        Intellectual rights
+      </field>
+      <description>
+        Describe who owns the rights to the dataset. Stakeholders may include institutions, funders, individuals, publishers, or others.
+      </description>
+      <mapping>
+        eml.dataset.intellectualRights
       </mapping>
     </metadata>
 
         This field will be populated on posting the data to a repository.
       </description>
       <mapping>
-        eml.dataset.url
+        eml.dataset.distribution.online.url
       </mapping>
     </metadata>
 
     <metadata>
       <field>
+        Geographic coverage: Description
+      </field>
+      <description>
+        Describe the geographic location(s) represented in your dataset.
+      </description>
+      <mapping>
+        eml.dataset.coverage.geographicCoverage.geographicDescription
+      </mapping>
+    </metadata>
+
+    <metadata>
+      <field>
+        Geographic coverage: West bounding coordinate
+      </field>
+      <description>
+        Provide lattitudinal and longitudinal boundaries for your dataset.
+      </description>
+      <mapping>
+        eml.dataset.coverage.geographicCoverage.boundingCoordinates.westBoundingCoordinate
+      </mapping>
+    </metadata>
+
+    <metadata>
+      <field>
+        Geographic coverage: East bounding coordinate
+      </field>
+      <description>
+        Provide lattitudinal and longitudinal boundaries for your dataset.
+      </description>
+      <mapping>
+        eml.dataset.coverage.geographicCoverage.boundingCoordinates.eastBoundingCoordinate
+      </mapping>
+    </metadata>
+
+    <metadata>
+      <field>
+        Geographic coverage: North bounding coordinate
+      </field>
+      <description>
+        Provide lattitudinal and longitudinal boundaries for your dataset.
+      </description>
+      <mapping>
+        eml.dataset.coverage.geographicCoverage.boundingCoordinates.northBoundingCoordinate
+      </mapping>
+    </metadata>
+
+    <metadata>
+      <field>
+        Geographic coverage: South bounding coordinate
+      </field>
+      <description>
+        Provide lattitudinal and longitudinal boundaries for your dataset.
+      </description>
+      <mapping>
+        eml.dataset.coverage.geographicCoverage.boundingCoordinates.southBoundingCoordinate
+      </mapping>
+    </metadata>
+
+    <metadata>
+      <field>
+        Temporal coverage: Beginning date
+      </field>
+      <description>
+        Provide the beginning date for the information collected in the dataset.
+      </description>
+      <mapping>
+        eml.dataset.coverage.temporalCoverage.rangeOfDates.beginDate.calendarDate
+      </mapping>
+      <type>
+        DateTime
+      </type>
+    </metadata>
+
+    <metadata>
+      <field>
+        Temporal coverage: Ending date
+      </field>
+      <description>
+        Provide the ending date for the information collected in the dataset.
+      </description>
+      <mapping>
+        eml.dataset.coverage.temporalCoverage.rangeOfDates.endDate.calendarDate
+      </mapping>
+      <type>
+        DateTime
+      </type>
+    </metadata>
+
+    <!--<metadata>
+      <field>
+        Temporal coverage: Description
+      </field>
+      <description>
+        Describe the temporal coverage for the data in your dataset.
+      </description>
+      <mapping>
+        eml.additionalMetadata.metadata.description
+      </mapping>
+    </metadata>-->
+
+    <metadata>
+      <field>
         Data Contact Person: First name
       </field>
       <description>
 
     <metadata>
       <field>
+        Data Contact Person: Organization
+      </field>
+      <description>
+        The "Data Contact Person" is the best person to contact if the repository staff or others have questions about the dataset. This person may also be contacted by other researchers that would like to re-use the dataset.
+      </description>
+      <mapping>
+        eml.dataset.contact.organizationName
+      </mapping>
+    </metadata>
+
+    <metadata>
+      <field>
         Data Contact Person: Address
       </field>
       <description>
       </type>
     </metadata>
 
-    <metadata>
+    <!--<metadata>
       <field>
-        Data Contact Person: Organization
+        Repository name and contact information
       </field>
       <description>
-        The "Data Contact Person" is the best person to contact if the repository staff or others have questions about the dataset. This person may also be contacted by other researchers that would like to re-use the dataset.
+        This field will be populated on posting the data to a repository.
       </description>
       <mapping>
-        eml.dataset.contact.organizationName
+        eml.dataset.publisher
       </mapping>
-    </metadata>
+    </metadata>-->
 
     <metadata>
       <field>
-        keyword(s)
+        Data Publisher: repository name
       </field>
       <description>
-        Select keywords that describe your dataset. Use an appropriate controlled vocabulary list for your field. (You can specify multiple keywords as comma separated values.)
       </description>
       <mapping>
-        eml.dataset.keywordSet.keyword
+        eml.dataset.publisher.organizationName
       </mapping>
-      <is-required>
-        true
-      </is-required>
-    </metadata>
-
-    <metadata>
-      <field>
-        Keyword thesaurus used
-      </field>
-      <description>
-        Provide the source of the controlled vocabulary you used to choose keywords.
-      </description>
-      <mapping>
-        eml.dataset.keywordSet.keywordThesaurus
-      </mapping>
-    </metadata>
-
-    <metadata>
-      <field>
-        Geographic coverage: Description
-      </field>
-      <description>
-        Describe the geographic location(s) represented in your dataset.
-      </description>
-      <mapping>
-        eml.dataset.coverage.geographicCoverage.geographicDescription
-      </mapping>
-    </metadata>
-
-    <metadata>
-      <field>
-        Geographic coverage: West bounding coordinate
-      </field>
-      <description>
-        Provide lattitudinal and longitudinal boundaries for your dataset.
-      </description>
-      <mapping>
-        eml.dataset.coverage.geographicCoverage.boundingCoordinates.westBoundingCoordinate
-      </mapping>
-    </metadata>
-
-    <metadata>
-      <field>
-        Geographic coverage: East bounding coordinate
-      </field>
-      <description>
-        Provide lattitudinal and longitudinal boundaries for your dataset.
-      </description>
-      <mapping>
-        eml.dataset.coverage.geographicCoverage.boundingCoordinates.eastBoundingCoordinate
-      </mapping>
-    </metadata>
-
-    <metadata>
-      <field>
-        Geographic coverage: North bounding coordinate
-      </field>
-      <description>
-        Provide lattitudinal and longitudinal boundaries for your dataset.
-      </description>
-      <mapping>
-        eml.dataset.coverage.geographicCoverage.boundingCoordinates.northBoundingCoordinate
-      </mapping>
-    </metadata>
-
-    <metadata>
-      <field>
-        Geographic coverage: South bounding coordinate
-      </field>
-      <description>
-        Provide lattitudinal and longitudinal boundaries for your dataset.
-      </description>
-      <mapping>
-        eml.dataset.coverage.geographicCoverage.boundingCoordinates.southBoundingCoordinate
-      </mapping>
-    </metadata>
-
-    <metadata>
-      <field>
-        Temporal coverage: Description
-      </field>
-      <description>
-        Describe the temporal coverage for the data in your dataset.
-      </description>
-      <mapping>
-        eml.additionalMetadata.metadata.description
-      </mapping>
-    </metadata>
-    
-    <metadata>
-      <field>
-        Temporal coverage: Beginning date
-      </field>
-      <description>
-        Provide the beginning date for the information collected in the dataset.
-      </description>
-      <mapping>
-        eml.dataset.coverage.temporalCoverage.rangeOfDates.beginDate.calendarDate
-      </mapping>
-      <type>
-        DateTime
-      </type>
-    </metadata>
-
-    <metadata>
-      <field>
-        Temporal coverage: Ending date
-      </field>
-      <description>
-        Provide the ending date for the information collected in the dataset.
-      </description>
-      <mapping>
-        eml.dataset.coverage.temporalCoverage.rangeOfDates.endDate.calendarDate
-      </mapping>
-      <type>
-        DateTime
-      </type>
     </metadata>
 
     <metadata>
 
     <metadata>
       <field>
+        Project personnel: Last name
+      </field>
+      <description>
+        The "Project personnel" is the best person to contact if the repository staff or others have questions about the dataset. This person may also be contacted by other researchers that would like to re-use the dataset.
+      </description>
+      <mapping>
+        eml.dataset.project.personnel.individualName.surName
+      </mapping>
+    </metadata>
+
+    <metadata>
+      <field>
+        Project personnel role
+      </field>
+      <description>
+        "pointOfContact"
+      </description>
+      <mapping>
+        eml.dataset.project.personnel.role
+      </mapping>
+    </metadata>
+
+    <metadata>
+      <field>
         Project description
       </field>
       <description>
 
     <metadata>
       <field>
-        Intellectual rights
-      </field>
-      <description>
-        Describe who owns the rights to the dataset. Stakeholders may include institutions, funders, individuals, publishers, or others.
-      </description>
-      <mapping>
-        eml.dataset.intellectualRights
-      </mapping>
-    </metadata>
-
-    <metadata>
-      <field>
         Data table name
       </field>
       <description>
 
     <metadata>
       <field>
-        Citation
+        Formatted citation
       </field>
       <description>
         This field will be populated on posting the data to a repository. A complete citation will be generated for the dataset, including the persistent identifier that was assigned by the repository.

Source/Excel/Excel.AddIn/Excel.AddIn/View/Usercontrols/Metadata.xaml

                     </TextBlock>
                     <TextBox x:Name="MetadataTextBox"
                              Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
-                             Style="{DynamicResource TextBoxStyle}">
+                             Style="{DynamicResource TextBoxStyle}" TextWrapping="Wrap" AcceptsReturn="True" MaxLength="200" VerticalScrollBarVisibility="Auto"  
+>
                     </TextBox>
                     <ContentControl IsEnabled="{Binding ElementName=MetadataTextBox,Path=(Validation.HasError),Mode=OneWay}" Style="{DynamicResource ErrorContentControl}" Content="{Binding ElementName=MetadataTextBox ,Path=(Validation.Errors).CurrentItem.ErrorContent}"/>
                 </StackPanel>
                         <Setter Property="Text" Value="*" TargetName="MandatoryText"/>
                         <Setter Property="Foreground" Value="Red" TargetName="MandatoryText"/>
                     </DataTrigger>
+                    <DataTrigger Binding="{Binding Type}" Value="TextArea">
+                        <Setter Property="MaxLength" Value="3000" TargetName="MetadataTextBox"/>
+                        <Setter TargetName="MetadataTextBox" Property="Height" Value="60" />
+                    </DataTrigger>
                 </DataTemplate.Triggers>
             </DataTemplate>
         </ResourceDictionary>
         <TextBlock Text="Describe your data by completing the metadata fields below. Required fields are designated by a red asterisk." 
                    Style="{DynamicResource DescriptionTextStyle}" Margin="0,10" Foreground="{DynamicResource LabelForeground}"/>
 
-        <TabControl Grid.Row="1" ItemContainerStyle="{DynamicResource ErrorTabItemStyle}" Style="{DynamicResource WizardTabControl}" Tag="ErrorTab" Margin="0,10,0,0">
+        <TabControl Grid.Row="1" ItemContainerStyle="{DynamicResource ErrorTabItemStyle}" Style="{DynamicResource WizardTabControl}" Tag="ErrorTab" Margin="0,10,0,0" 
+                    SelectedIndex="{Binding SelectedTabIndex, Mode=TwoWay}">
             <TabItem Header="Data descriptions" Tag="0">
 
                 <Grid>
                               CanUserAddRows="False" CanUserDeleteRows="False" IsManipulationEnabled="False" IsReadOnly="False"
                               VerticalGridLinesBrush="{DynamicResource GridVerticalLineBrush}" Grid.Row="1" AutoGenerateColumns="False">
                         <DataGrid.Columns>
-                            <DataGridTemplateColumn Width="100" Header="Name">
+                            <DataGridTemplateColumn Width="100" Header="Entity Name *">
                                 <DataGridTemplateColumn.CellTemplate>
                                     <DataTemplate>
-                                        <TextBox Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ToolTip="{Binding Name}" />
+                                        <ComboBox SelectedItem="{Binding EntityName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                                  ItemsSource="{Binding DataContext.EntityNameList, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
+                                    </DataTemplate>
+                                </DataGridTemplateColumn.CellTemplate>
+                            </DataGridTemplateColumn>
+                            <DataGridTemplateColumn Width="200" Header="Entity Description">
+                                <DataGridTemplateColumn.CellTemplate>
+                                    <DataTemplate>
+                                        <TextBox Text="{Binding EntityDescription, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ToolTip="{Binding EntityDescription}"/>  
+                                    </DataTemplate>
+                                </DataGridTemplateColumn.CellTemplate>
+                            </DataGridTemplateColumn>
+
+                            <DataGridTemplateColumn Width="100" Header="Name *">
+                                <DataGridTemplateColumn.CellTemplate>
+                                    <DataTemplate>
+                                        <TextBox Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=true}" ToolTip="{Binding Name}" />
                                     </DataTemplate>
                                 </DataGridTemplateColumn.CellTemplate>
                             </DataGridTemplateColumn>
                                     </DataTemplate>
                                 </DataGridTemplateColumn.CellTemplate>
                             </DataGridTemplateColumn>
-                            <DataGridTemplateColumn Width="50">
+                            <DataGridTemplateColumn Width="60" Header="Delete">
                                 <DataGridTemplateColumn.CellTemplate>
                                     <DataTemplate>
                                         <Button Style="{DynamicResource CloseMinimizeButtonStyle}" CommandParameter="{Binding}"

Source/Excel/Excel.AddIn/Excel.AddIn/ViewModels/MetadataListViewModel.cs

 
         public ObservableCollection<string> StandardUnitsList { get; set; }
 
+        public ObservableCollection<string> EntityNameList { get; set; }
+
         public ObservableCollection<MetadataViewModel> MetadataList
         {
             get
 
         public bool IsParameterInputBoxOpen { get; set; }
 
+        public int SelectedTabIndex
+        {
+            get;
+            set;
+        }
+
         public ICommand GenerateMetadataCommand
         {
             get
 
             this.TypeList = new ObservableCollection<string>();
             this.StandardUnitsList = new ObservableCollection<string>();
+            this.EntityNameList = new ObservableCollection<string>();
+
+            this.TypeList.Add(" ");
+            this.StandardUnitsList.Add("");
 
             foreach (var item in Common.Constants.ParameterMetadataType.Split(','))
             {
                 this.TypeList.Add(item.Trim());
             }
-
+            
             foreach (var item in Helper.GetStandardUnits())
             {
                 this.StandardUnitsList.Add(item.Trim());
             }
 
+            foreach (var item in Controller.Instance.GetSheetNames())
+            {
+                this.EntityNameList.Add(item.Trim());
+            }
+            SelectedTabIndex = 0;
             InitCommands();
         }
 
                 this.ParameterMetadataList = new ObservableCollection<ParameterMetadataViewModel>();
             }
 
-            this.ParameterMetadataList.Add(new ParameterMetadataViewModel());
+            this.ParameterMetadataList.Add(new ParameterMetadataViewModel() { EntityName = this.EntityNameList[0] });
         }
 
         private void DeleteParameterCommandExecute(ParameterMetadataViewModel item)
                 {
                     this.MetadataList.Add(item);
                 }
-
                 this.ParameterMetadataList.Clear();
                 foreach (var item in metaData.ParameterMetadataList)
                 {
                     isValid = false;
                     break;
                 }
+            }
 
+            foreach (var item in this.ParameterMetadataList)
+            {
+                if (!item.Validate())
+                {
+                    isValid = false;
+                    break;
+                }
             }
             return isValid;
         }

Source/Excel/Excel.AddIn/Excel.AddIn/ViewModels/MetadataViewPaneViewModel.cs

         private void SaveButtonExecute()
         {
             // Save The metadata sheet on Next Button Click.
-            UpdateMetadata();
 
-            this.OnRequestClose();
+                UpdateMetadata();
+
+                this.OnRequestClose();
         }
 
         private bool SaveButtonCanExecute()

Source/Excel/Excel.AddIn/Excel.AddIn/ViewModels/ParameterMetadataViewModel.cs

-
+using System;
+using System.ComponentModel;
+
 namespace DataUp.Excel.Addin
 {
-    public class ParameterMetadataViewModel : ViewModelBase
+    public class ParameterMetadataViewModel : ViewModelBase, IDataErrorInfo
     {
+        private string entityName;
+        private string entityDescription;
         private string name;
         private string description;
         private string type;
 
         private bool enableUnits;
 
+        public string EntityName
+        {
+            get { return this.entityName; }
+            set
+            {
+                this.entityName = value;
+                OnNotifyPropertyChanged("EntityName");
+            }
+        }
+
+        public string EntityDescription
+        {
+            get { return this.entityDescription; }
+            set
+            {
+                this.entityDescription = value;
+                OnNotifyPropertyChanged("EntityDescription");
+            }
+        }
+
         public string Name
         {
             get
                 OnNotifyPropertyChanged("EnableUnits");
             }
         }
+
+        public bool Validate()
+        {
+            if (String.IsNullOrEmpty(this.Name))
+            {
+                return false;
+            }
+            
+            return true;
+        }
+
+        #region IDataErrorInfo Members
+
+        public string Error
+        {
+            get { return string.Empty; }
+        }
+
+        public string this[string columnName]
+        {
+            get {
+                string errorMsg = null;
+                switch(columnName)
+                {
+                    case "Name":
+                        if (String.IsNullOrEmpty(Name))
+                        {
+                            errorMsg = "Name is required.";
+                        }
+                        break;
+                }
+                return errorMsg;
+            }
+        }
+
+        #endregion
     }
 }

Source/Excel/Excel.AddIn/Excel.AddIn/app.config

     <add key="Profile_Post" value="oneshare_dataup_content"/>
     <add key="Reg" value="[&lt;&gt;\?\@\\''\\;\\$\\!\\#\\(\\)\\^\\&amp;\\{\\}\\+\\-\\.\\~\\/\\%\\*\\\&quot;/\|]+" />
     <add key="Reg2" value="[&lt;&gt;\⌂\\Ç\\ü\\é\\Æ\\£\\¥\\ó\\ú\\Ñ\\¿\\⌐\\½\\¼\\«\\»\\│\\ß\\µ\\±\\°\\∙\\€\\†\\‡\\Š\\™\\œ\\Ÿ\\©\\®\\Ã\\Î\\Ô\\×\\÷\\ø\\þ\/\|]+" />
-    <add key="DcxlWebServiceLink" value="http://adminservicedev.cloudapp.net/RepositoryService" />
+    <add key="DcxlWebServiceLink" value="https://adminservicedev.cloudapp.net/RepositoryService" />
+    <!--<add key="DcxlWebServiceLink" value="http://localhost:2586/RepositoryService"/>-->
     <add key="PostFileTimeOutMinutes" value="100" />
-    <add key="DemoVideoLink" value="http://datauptesting.cloudapp.net/Demo/Index" />
+    <add key="DemoVideoLink" value="https://www.dataup.org/Demo/Index" />
     <add key="ClientSettingsProvider.ServiceUri" value="" />
     <add key="ClientSettingsProvider.ConnectionStringName" value="DefaultConnection" />
   </appSettings>

Source/Excel/Excel.BizLogic/CustomCertificatePolicy.cs

+// -----------------------------------------------------------------------
+// <copyright file="CustomCertificatePolicy.cs" company="">
+// TODO: Update copyright text.
+// </copyright>
+// -----------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Net;
+
+namespace DataUp.Excel.BizLogic
+{
+     /// <summary>
+    /// TODO: Update summary.
+    /// </summary>
+    public class CustomCertificatePolicy : ICertificatePolicy
+    {
+        public bool CheckValidationResult(ServicePoint srvPoint, System.Security.Cryptography.X509Certificates.X509Certificate certificate, WebRequest request, int certificateProblem)
+        {
+            return true;
+        }
+    }
+}

Source/Excel/Excel.BizLogic/Excel.BizLogic.csproj

     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="CustomCertificatePolicy.cs" />
     <Compile Include="CustomWebClient.cs">
       <SubType>Component</SubType>
     </Compile>

Source/Excel/Excel.BizLogic/Extensions/WorksheetExtensions.cs

 
                         metadataTool = sheet.CreateParaMetadataTable();
 
-                        metadataTool.Resize(workSheet.Range["D1", "G" + metadata.Count]);
+                        metadataTool.Resize(workSheet.Range["D1", "I" + metadata.Count]);
                         metadataTool.AutoSetDataBoundColumnHeaders = true;
                         metadataTool.TableStyle = Common.Constants.MetadataTableStyleName;
 
                         {
                             for (int rCnt = 2; rCnt <= metadataList.Range.Rows.Count; rCnt++)
                             {
-                                var typeCell = (Range)metadataList.Range.Cells[rCnt, 3];
+                                var typeCell = (Range)metadataList.Range.Cells[rCnt, 5];
 
                                 typeCell.Validation.Delete();
                                 typeCell.Validation.Add(XlDVType.xlValidateList, XlDVAlertStyle.xlValidAlertStop, XlFormatConditionOperator.xlBetween, Common.Constants.ParameterMetadataType);
                                 typeCell.Validation.InCellDropdown = true;
                             }
                         }
+                        
                     }
 
                     workSheet.UsedRange.Columns.AutoFit();
             {
                 if (ParametadataTable == null)
                 {
-                    ParametadataTable = sheet.Controls.AddListObject(sheet.Range["D1", "G1"], Excel.Common.Constants.ParaMetadataRangeName);
+                    ParametadataTable = sheet.Controls.AddListObject(sheet.Range["D1", "I1"], Excel.Common.Constants.ParaMetadataRangeName);
                 }
             }
 
         private static System.Data.DataTable GetParaDataTable(List<ParameterDetail> metadata)
         {
             System.Data.DataTable table = new System.Data.DataTable();
-
+            table.Columns.Add("EntityName");
+            table.Columns.Add("EntityDescription");
             table.Columns.Add("Name");
             table.Columns.Add("Description");
             table.Columns.Add("Type");
             foreach (var item in metadata)
             {
                 row = table.NewRow();
+                row["EntityName"] = item.EntityName;
+                row["EntityDescription"] = item.EntityDescription;
                 row["Name"] = item.Name;
                 row["Description"] = item.Description;
                 row["Type"] = item.Type;

Source/Excel/Excel.BizLogic/Interfaces/IMetadataManager.cs

         /// Updates the parameter metadata.
         /// </summary>
         /// <param name="metadata">parameter metadata Detail List.</param>
-        void UpdateParaMetadata(List<object> obj);
+        void UpdateParaMetadata(List<object> obj, string sheetName);
 
         /// <summary>
         /// Clears the parameter metadata.
         /// </summary>
         /// <returns>True if metadata table is available;otherwise false.</returns>
         bool IsGeneralMetadataPresent();
+
+        string ActiveSheetName(Range range);
     }
 }

Source/Excel/Excel.BizLogic/Managers/MetadataManager.cs

             return obj;
         }
 
+        public string ActiveSheetName(Range range)
+        {
+            return range.Worksheet.Name;
+            
+        }
+
         /// <summary>
         /// This function can be used to get the details of the parameter metadata.
         /// </summary>
         /// Updates the parameter metadata.
         /// </summary>
         /// <param name="metadata">parameter metadata Detail List.</param>
-        public void UpdateParaMetadata(List<object> parametadata)
+        public void UpdateParaMetadata(List<object> parametadata, string sheetName=null)
         {
             List<object> list = new List<object>();
             _Worksheet metadataSheet = this.Workbook.XLGetMetadataWorksheet();
                     {
                         paramterMetadata.Add(new ParameterDetail()
                             {
+                                EntityName = sheetName,
                                 Name = item.ToString().Trim()
                             });
                     }
                     {
                         paramterMetadata.Add(new ParameterDetail()
                         {
-                            Name = obj.Range.Cells[rCnt, 1].Value != null ? obj.Range.Cells[rCnt, 1].Value.ToString().Trim() : string.Empty,
-                            Description = obj.Range.Cells[rCnt, 2].Value != null ? obj.Range.Cells[rCnt, 2].Value.ToString() : string.Empty,
-                            Type = obj.Range.Cells[rCnt, 3].Value != null ? obj.Range.Cells[rCnt, 3].Value.ToString() : string.Empty,
-                            Units = obj.Range.Cells[rCnt, 4].Value != null ? obj.Range.Cells[rCnt, 4].Value.ToString() : string.Empty,
+                            EntityName = obj.Range.Cells[rCnt, 1].Value != null ? obj.Range.Cells[rCnt, 1].Value.ToString().Trim() : string.Empty,
+                            EntityDescription = obj.Range.Cells[rCnt, 2].Value != null ? obj.Range.Cells[rCnt, 2].Value.ToString() : string.Empty,
+                            Name = obj.Range.Cells[rCnt, 3].Value != null ? obj.Range.Cells[rCnt, 3].Value.ToString().Trim() : string.Empty,
+                            Description = obj.Range.Cells[rCnt, 4].Value != null ? obj.Range.Cells[rCnt, 4].Value.ToString() : string.Empty,
+                            Type = obj.Range.Cells[rCnt, 5].Value != null ? obj.Range.Cells[rCnt, 5].Value.ToString() : string.Empty,
+                            Units = obj.Range.Cells[rCnt, 6].Value != null ? obj.Range.Cells[rCnt, 6].Value.ToString() : string.Empty,
                         });
                     }
                 }

Source/Excel/Excel.BizLogic/Managers/ServiceManager.cs

 using System.Net;
 using System.Runtime.Serialization;
 using System.Text;
+using System.Linq;
 using System.Xml.Linq;
 using DataUp.Excel.Common;
 using DataUp.Web.Service.Model;
 using Ionic.Zip;
 using Microsoft.Office.Interop.Excel;
+using System.Security.Cryptography.X509Certificates;
 using Tools = Microsoft.Office.Tools.Excel;
+using System.Net.Security;
 
 namespace DataUp.Excel.BizLogic
 {
         {
             this.Workbook = workbook;
             this.Factory = factory;
+            ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
             this.service = new DataUpService.RepositoryDataContext(new Uri(Common.Constants.DcxlWebServiceLink));
         }
 
                 content.Add(metadata);
             }
 
-            content.Add(new DKeyValuePair<string, string>() { Key = "Profile", Value = Common.Constants.GetPostProfile});
+            content.Add(new DKeyValuePair<string, string>() { Key = "Profile", Value = Common.Constants.GetPostProfile });
             content.Add(new DKeyValuePair<string, string>() { Key = "who", Value = details.Who });
             content.Add(new DKeyValuePair<string, string>() { Key = "what", Value = details.What });
             content.Add(new DKeyValuePair<string, string>() { Key = "when", Value = details.When.ToString(Common.Constants.DefaultDateFormat) });
             // Update Parameters metadata values
 
             List<ParameterMetadataDetail> parameters = new List<ParameterMetadataDetail>();
-            foreach (var item in parameterMetadataList)
+
+            var paramData = from val in parameterMetadataList
+                            group val by val.EntityName into param
+                            select new
+                            {
+                                EntityName = param.Key,
+                                Description = param.Select(q => (String.IsNullOrEmpty(q.EntityDescription) ? "" : q.EntityDescription)).FirstOrDefault(q => !String.IsNullOrEmpty(q)),
+                                Values = param.ToList()
+                            };
+
+            foreach (var data in paramData)
             {
-                parameters.Add(new ParameterMetadataDetail()
+                parameters.Add(new ParameterMetadataDetail
                 {
-                    Name = item.Name,
-                    Description = item.Description,
-                    Type = item.Type,
-                    Units = item.Units
+                    EntityName = data.EntityName,
+                    EntityDescription = data.Description,
+                    AttributeList = data.Values.Select(q => new ParameterAttribute { Name = q.Name, Description = q.Description, Type = q.Type, Units = q.Units }).ToList()
+
                 });
             }
+
             queryData.ParameterMetadata = parameters.ToArray();
 
             return queryData;

Source/Excel/Excel.BizLogic/Models/ParameterMetadataDetail.cs

     /// </summary>
     public class ParameterDetail
     {
+        public string EntityName { get; set; }
+
+        public string EntityDescription { get; set; }
         /// <summary>
         /// Gets or sets the name of parameter metadata.
         /// </summary>

Source/Excel/Excel.Common/Constants.cs

         /// <summary>
         /// IParameterMetadataType
         /// </summary>
-        public const string ParameterMetadataType = "Text,Datetime,Numeric";
+        public const string ParameterMetadataType = "Text,Numeric,Datetime";
 
         /// <summary>
         /// MaxErrorCount
                 return ConfigurationManager.AppSettings["DemoVideoLink"];
             }
         }
-
         /// <summary>
         /// Gets Profile string value for GetIdentifier request
         /// </summary>

Source/Excel/Excel.Common/Helper.cs

 
                     metadataValue = File.ReadAllLines(Path.Combine(filepath, "StandardUnits.txt"));
                 }
-
                 units = metadataValue.Select(p => p.Trim().ToLower()).Distinct().OrderBy(p => p).ToList();
             }
             catch
Add a comment to this file

Source/WebService/packages/vssver2.scc

Binary file added.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.