private void getMustInput(StreamWriter writer, HcFieldInfo field)
 {
     switch (field.FieldType)
     {
         case EmFieldType.Boolean:
         case EmFieldType.Byte:
         case EmFieldType.Double:
         case EmFieldType.Integer:
         case EmFieldType.Long:
         case EmFieldType.Timestamp:
             writer.WriteLine(@"		if (this.{0} == null) {{", field.name.ToPrivateDefinition());
             writer.WriteLine(@"			super.errorMsg = ""{0}不能为空!"";", field.caption);
             writer.WriteLine(@"			return false;");
             writer.WriteLine(@"		}");
             break;
         case EmFieldType.BooleanArray:
         case EmFieldType.DateArray:
         case EmFieldType.DoubleArray:
         case EmFieldType.IntegerArray:
         case EmFieldType.LongArray:
         case EmFieldType.StringArray:
         case EmFieldType.TimeArray:
         case EmFieldType.TimestampArray:
             writer.WriteLine(@"		if (this.{0}.length<1) {{", field.name.ToPrivateDefinition());
             writer.WriteLine(@"			super.errorMsg = ""{0}不能为空!"";", field.caption);
             writer.WriteLine(@"			return false;");
             writer.WriteLine(@"		}");
             break;
         case EmFieldType.DTOArray:
             writer.WriteLine(@"		if (this.{0}.length<1) {{", field.name.ToPrivateDefinition());
             writer.WriteLine(@"			super.errorMsg = ""{0}不能为空!"";", field.caption);
             writer.WriteLine(@"			return false;");
             writer.WriteLine(@"		}");
             writer.WriteLine(@"		for (BaseEntity entity : self.{0}) {{", field.name.ToPrivateDefinition());
             writer.WriteLine(@"			if (!entity.checkInputData()) {");
             writer.WriteLine(@"             super.errorMsg = entity.errorMsg;");
             writer.WriteLine(@"             return false;");
             writer.WriteLine(@"			}");
             writer.WriteLine(@"		}");
             break;
         case EmFieldType.DTO:
             writer.WriteLine(@"		if (!this.{0}.checkInputData()) {{", field.name.ToPrivateDefinition());
             writer.WriteLine(@"			super.errorMsg = ""{0}不能为空!"";", field.caption);
             writer.WriteLine(@"			return false;");
             writer.WriteLine(@"		}");
             break;
         case EmFieldType.Date:
         case EmFieldType.Time:
         case EmFieldType.String:
             writer.WriteLine(@"		if (this.{0} == null) {{", field.name.ToPrivateDefinition());
             writer.WriteLine(@"			super.errorMsg = ""{0}不能为空!"";", field.caption);
             writer.WriteLine(@"			return false;");
             writer.WriteLine(@"		}");
             break;
     }
 }
        private void setDTOInfo(Worksheet sheet, List<HcDTOInfo> dtoList)
        {
            var name = sheet.Name;
            if (name.Length > 3 && name.Substring(name.Length - 3, 3).Equals("DTO"))
            {
                var dtoInfo = new HcDTOInfo();
                Range range = null;
                range = (Range)sheet.Cells[2, 3];
                dtoInfo.Name = range.Value.ToString();

                range = (Range)sheet.Cells[1, 3];
                dtoInfo.Caption = range.Value.ToString();

                int iRow = 5;
                range = (Range)sheet.Cells[iRow, 3];
                var cellValue = range.Value;
                dtoInfo.FieldArray = new List<HcFieldInfo>();
                while (cellValue != null && !string.IsNullOrEmpty(cellValue.ToString()))
                {
                    var field = new HcFieldInfo();
                    field.name = cellValue.ToString();
                    range = (Range)sheet.Cells[iRow, 2];
                    field.caption = range.Value.ToString();
                    range = (Range)sheet.Cells[iRow, 4];
                    field.FieldTypeString = range.Value.ToString();

                    dtoInfo.FieldArray.Add(field);
                    iRow += 1;

                    range = (Range)sheet.Cells[iRow, 3];
                    cellValue = range.Value;
                }
                dtoList.Add(dtoInfo);
            }
        }
예제 #3
0
 private void getMustInput(StreamWriter writer, HcFieldInfo field)
 {
     switch (field.FieldType)
     {
         case EmFieldType.Boolean:
         case EmFieldType.Byte:
         case EmFieldType.Double:
         case EmFieldType.Integer:
         case EmFieldType.Long:
         case EmFieldType.Timestamp:
             writer.WriteLine(@"    if (!self.{0}) {{", field.name.ToPrivateDefinition());
             writer.WriteLine(@"        [muArray addObject:@""{0}不能为空!""];", field.caption);
             writer.WriteLine(@"        rest = NO;");
             writer.WriteLine(@"    }");
             break;
         case EmFieldType.BooleanArray:
         case EmFieldType.DateArray:
         case EmFieldType.DoubleArray:
         case EmFieldType.IntegerArray:
         case EmFieldType.LongArray:
         case EmFieldType.StringArray:
         case EmFieldType.TimeArray:
         case EmFieldType.TimestampArray:
             writer.WriteLine(@"    if (self.{0}.count<1) {{", field.name.ToPrivateDefinition());
             writer.WriteLine(@"        [muArray addObject:@""{0}不能为空!""];", field.caption);
             writer.WriteLine(@"        rest = NO;");
             writer.WriteLine(@"    }");
             break;
         case EmFieldType.DTOArray:
             writer.WriteLine(@"    if (self.{0}.count<1) {{", field.name.ToPrivateDefinition());
             writer.WriteLine(@"        [muArray addObject:@""{0}不能为空!""];", field.caption);
             writer.WriteLine(@"        rest = NO;");
             writer.WriteLine(@"    }");
             writer.WriteLine(@"    for (SsBaseDataObject *ss in self.{0}) {{", field.name.ToPrivateDefinition());
             writer.WriteLine(@"        if (![ss checkRequired]) {");
             writer.WriteLine(@"            tttt;");
             writer.WriteLine(@"            rest = NO;");
             writer.WriteLine(@"        }");
             writer.WriteLine(@"    }");
             break;
         case EmFieldType.DTO:
             writer.WriteLine(@"    if (![self.{0} checkRequired]) {{", field.name.ToPrivateDefinition());
             writer.WriteLine(@"        [muArray addObject:@""{0}不能为空!""];", field.caption);
             writer.WriteLine(@"        rest = NO;");
             writer.WriteLine(@"    }");
             break;
         case EmFieldType.Date:
         case EmFieldType.Time:
         case EmFieldType.String:
             writer.WriteLine(@"    if (self.{0}.length<1) {{", field.name.ToPrivateDefinition());
             writer.WriteLine(@"        [muArray addObject:@""{0}不能为空!""];", field.caption);
             writer.WriteLine(@"        rest = NO;");
             writer.WriteLine(@"    }");
             break;
     }
 }
        private void setInDTO(Worksheet sheet, HcServiceInfo serviceInfo, ref int irow)
        {
            var inDto = new HcDTOInfo();
            inDto.Caption = serviceInfo.Caption + "的InDTO";

            var range = (Range)sheet.Cells[19, 2];
            inDto.Name = range.Value.ToString();

            range = (Range)sheet.Cells[20, 15];
            var cellValue = range.Value;
            inDto.FieldArray = new List<HcFieldInfo>();
            while (cellValue != null && !string.IsNullOrEmpty(cellValue.ToString()))
            {
                var field = new HcFieldInfo();
                field.name = cellValue.ToString();
                range = (Range)sheet.Cells[irow, 3];
                field.caption = range.Value.ToString();
                range = (Range)sheet.Cells[irow, 22];
                field.FieldTypeString = range.Value.ToString();

                inDto.FieldArray.Add(field);
                irow += 1;

                range = (Range)sheet.Cells[irow, 15];
                cellValue = range.Value;
            }

            serviceInfo.InDTO = inDto;
        }
 private void writeFieldCheck(StreamWriter writer, HcFieldInfo field)
 {
     if (field.FieldCheckType != null)
     {
         foreach (var item in field.FieldCheckType)
         {
             switch (item)
             {
                 case EmCheckType.MustEnter:
                     writer.WriteLine(@"	@" + Constants.Package + @".fw.core.validator.type.NotNull");
                     break;
             }
         }
     }
 }