protected override string GetJMSClassAttributes()
        {
            StringBuilder sb = new StringBuilder();

            string assName     = string.Empty;
            string accModifier = string.Empty;

            sb.AppendLine(Resources.Tab2 + "public MeasurementValueQuality Quality { get; set; }");

            foreach (ModelType type in DataGrid.ModelRoot.Types)
            {
                if (!(type is DataGrid))
                {
                    continue;
                }
                DataGrid model = type as DataGrid;
                if (!model.ShouldGenerate)
                {
                    continue;
                }

                foreach (ColumnAttribute attr in model.Columns)
                {
                    string customType = TypesToCSharpType.Convert(attr);

                    sb.AppendLine(Resources.Tab2 + "public " + customType + " " + attr.Name + " { get; set; }");
                    sb.AppendLine();
                }

                /*foreach(Association association in Association.GetLinksToTargets(model))
                 * {
                 *      accModifier = AccessModifierConverter.ConvertModifier(association);
                 *      if (String.IsNullOrEmpty(association.TargetRoleName))
                 *      {
                 *              assName = association.Target.Name.First().ToString().ToUpper() + association.Target.Name.Substring(1);
                 *      }
                 *      else
                 *      {
                 *              assName = association.TargetRoleName.First().ToString().ToUpper() + association.TargetRoleName.Substring(1);
                 *      }
                 *      switch (association.TargetMultiplicity)
                 *      {
                 *              case Multiplicity.One:
                 *              case Multiplicity.ZeroOne:
                 *                      sb.AppendLine(Resources.Tab2 + accModifier + " " + association.Target.Name + " " + assName + " { get; set; }");
                 *                      break;
                 *              case Multiplicity.OneMany:
                 *              case Multiplicity.ZeroMany:
                 *                      sb.AppendLine(Resources.Tab2 + accModifier + " List<" + association.Target.Name + "> " + assName + " { get; set; }");
                 *                      break;
                 *              default:
                 *                      break;
                 *      }
                 * }*/
            }

            return(sb.ToString());
        }
        internal static string GetViewModelProperties(DataGrid dg)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(Resources.DetailsElementGid);

            sb.AppendLine(Resources.DataGridTreeViewItemInfo);

            sb.AppendLine(Resources.RecordType);

            sb.AppendLine(Resources.Title);

            sb.AppendLine(Resources.GetReportRecordFor(dg));

            sb.AppendLine(Resources.TabularViewIsActive);

            sb.AppendLine(Resources.RowIsNotVisible);

            foreach (ColumnAttribute attribute in dg.Columns)
            {
                if (!attribute.ShouldGenerate)
                {
                    continue;
                }
                if (!string.IsNullOrEmpty(attribute.Description))
                {
                    sb.AppendLine(Resources.Tab2 + "/// <summary>");
                    sb.AppendLine(Resources.Tab2 + "/// " + attribute.Description);
                    sb.AppendLine(Resources.Tab2 + "/// </summary>");
                }
                sb.AppendLine(Resources.Tab2 + "public " + TypesToCSharpType.Convert(attribute) + " " + attribute.Name[0].ToString().ToUpper() + attribute.Name.Substring(1));
                sb.AppendLine(Resources.Tab2 + "{");
                sb.AppendLine(Resources.Tab3 + "get");
                sb.AppendLine(Resources.Tab3 + "{");
                if (attribute.MeasurementType != MeasurementType.None)
                {
                    sb.AppendLine(Resources.Tab4 + "return UnitConverterHelper.ConvertFromDMS(MeasurementType." + attribute.MeasurementType.ToString() + ", reportRecord." + attribute.Name[0].ToString().ToUpper() + attribute.Name.Substring(1) + ");");
                }
                else
                {
                    sb.AppendLine(Resources.Tab4 + "return reportRecord." + attribute.Name[0].ToString().ToUpper() + attribute.Name.Substring(1) + ";");
                }
                sb.AppendLine(Resources.Tab3 + "}");
                sb.AppendLine(Resources.Tab2 + "}");
                sb.AppendLine();
            }

            return(sb.ToString());
        }
Exemplo n.º 3
0
        protected override string GetJMSClassAttributes()
        {
            StringBuilder sb = new StringBuilder();

            foreach (ColumnAttribute attr in DataGrid.Columns)
            {
                string customType = TypesToCSharpType.Convert(attr);
                if (!string.IsNullOrEmpty(attr.Description))
                {
                    sb.AppendLine(Resources.Tab2 + "/// <summary>");
                    sb.AppendLine(Resources.Tab2 + "/// " + attr.Description);
                    sb.AppendLine(Resources.Tab2 + "/// </summary>");
                }
                if (attr.IsDataMember)
                {
                    sb.AppendLine(Resources.Tab2 + "[DataMember]");
                }
                sb.AppendLine(Resources.Tab2 + "public " + customType + " " + attr.Name + " { get; set; }");
                sb.AppendLine();
            }

            return(sb.ToString());
        }