示例#1
0
        public string GetTargetAttributeName(string datasetName, string datasetItemName)
        {
            GnosisDatasetDefinition dataset = GetDataset(entity.DatasetDefinitions, datasetName);
            GnosisDatasetItem datasetItem = dataset.DatasetItems.Where(x => x.GnosisName.Equals(datasetItemName)).First();
            return datasetItem.Attribute;

        }
示例#2
0
        public string GetDataString(string datasetName, string datasetItemName, GnosisInstance instance, int rowNo)
        {
            string attributeValue = "";

            try
            {
                GnosisDatasetDefinition dataset = GetDataset(entity.DatasetDefinitions, datasetName);
                GnosisDatasetItem datasetItem = dataset.DatasetItems.Where(x => x.GnosisName.Equals(datasetItemName)).First();
                string elementName = dataset.Element;
                string attributeName = datasetItem.Attribute;

                if (instance.Content.Descendants(elementName).Count() > 0)
                {
                    var dataItem = instance.Content.Descendants(elementName).ElementAt(rowNo);
                    if (dataItem.Attribute(attributeName) != null)
                    {
                        attributeValue = dataItem.Attribute(attributeName).Value;
                    }
                }
               
            }
            catch (Exception ex)
            {
                GlobalData.Singleton.ErrorHandler.HandleError(ex.Message, ex.StackTrace);
            }

            return attributeValue;
                       
        }
示例#3
0
        internal int GetMaxDisplayChars(string datasetName, string datasetItemName)
        {
            int maxDisplayChars = 0;

            try
            {
                GnosisDatasetDefinition dataset = GetDataset(entity.DatasetDefinitions, datasetName);

                if (dataset == null)
                {
                    GlobalData.Singleton.ErrorHandler.HandleError("dataset not found: " + datasetName + " in entity controller", "GnosisEntityController GetMinDisplayChars");
                    return 0;
                }
                GnosisDatasetItem datasetItem = dataset.DatasetItems.Where(x => x.GnosisName.Equals(datasetItemName)).First();

                if (datasetItem.MaxDisplayChars > 0)
                {
                    maxDisplayChars = datasetItem.MaxDisplayChars;
                }
                else if (datasetItem.MaxChars > 0)
                {
                    maxDisplayChars = datasetItem.MaxChars;
                }
                else if (datasetItem.DataType != null)
                {
                    GnosisDataType dataType = entity.DataDefinition.DataTypes.Find(d => d.GnosisName.Equals(datasetItem.DataType));

                    if (dataType.MaxDisplayChars == 0)
                    {
                        if (dataType.MaxChars > 0)
                        {
                            maxDisplayChars = dataType.MaxChars;
                        }
                        else
                        {
                            GlobalData.Singleton.ErrorHandler.HandleError("MaxDisplayChars and MaxCharacters not set for datatype " + dataType.GnosisName, "GnosisEntityController GetMinDisplayChars");
                        }
                    }
                    else
                    {
                        maxDisplayChars = dataType.MaxDisplayChars;
                    }
                }
                else
                {
                    maxDisplayChars = GlobalData.Singleton.SystemController.GetMaxDisplayChars(datasetItem.SqlDataType);
                }


            }
            catch (Exception ex)
            {
                GlobalData.Singleton.ErrorHandler.HandleError(ex.Message, ex.StackTrace);
            }

            return maxDisplayChars;

        }
示例#4
0
        public bool GetDatasetItemOptional(string datasetName, string datasetItemName)
        {
            try
            {
                GnosisDatasetDefinition dataset = GetDataset(entity.DatasetDefinitions, datasetName);
                GnosisDatasetItem datasetItem = dataset.DatasetItems.Find(x => x.GnosisName.Equals(datasetItemName));
                return datasetItem.Optional;
            }
            catch (Exception ex)
            {
                GlobalData.Singleton.ErrorHandler.HandleError(ex.Message, ex.StackTrace);
            }

            return false;
        }
示例#5
0
        internal GnosisController.HorizontalAlignmentType GetContentHorizontalAlignment(string datasetName, string datasetItemName)
        {
            GnosisController.HorizontalAlignmentType alignment = GnosisController.HorizontalAlignmentType.NONE;

            try
            {
                GnosisDatasetDefinition dataset = GetDataset(entity.DatasetDefinitions, datasetName);

                if (dataset == null)
                {
                    GlobalData.Singleton.ErrorHandler.HandleError("dataset not found: " + datasetName + " in entity controller", "GnosisEntityController GetContentHorizontalAlignment");
                    return GnosisController.HorizontalAlignmentType.NONE;
                }

                GnosisDatasetItem datasetItem = dataset.DatasetItems.Where(x => x.GnosisName.Equals(datasetItemName)).First();

                if (datasetItem.ContentHorizontalAlignmentType != GnosisController.HorizontalAlignmentType.NONE)
                {
                    alignment = datasetItem.ContentHorizontalAlignmentType;
                }
                else if (datasetItem.DataType != null)
                {
                    GnosisDataType dataType = entity.DataDefinition.DataTypes.Find(d => d.GnosisName.Equals(datasetItem.DataType));

                    if (dataType._ContentHorizontalAlignment != GnosisController.HorizontalAlignmentType.NONE)
                    {
                        alignment = dataType._ContentHorizontalAlignment;
                    }
                }
                else
                {
                    alignment = GlobalData.Singleton.SystemController.GetContentHorizontalAlignment(datasetItem.SqlDataType);
                }

            }
            catch (Exception ex)
            {
                GlobalData.Singleton.ErrorHandler.HandleError(ex.Message, ex.StackTrace);
            }

            return alignment;
        }