public static string ToType(FieldTypeEnum fieldTypeEnum) { switch (fieldTypeEnum) { case FieldTypeEnum.INPUT: return("input"); case FieldTypeEnum.MULTIINPUT: return("multiInput"); case FieldTypeEnum.MULTICHECK: return("multiCheck"); case FieldTypeEnum.SINGLECHECK: return("singleCheck"); case FieldTypeEnum.COMPLEX: return("complex"); case FieldTypeEnum.MULTICOMPLEX: return("multiComplex"); case FieldTypeEnum.LABEL: return("label"); default: return(""); } }
public static PropertyDataType ToPropertyDataType(this FieldTypeEnum fieldType) { PropertyDataType pdt = PropertyDataType.String; switch (fieldType) { case FieldTypeEnum.Bool: pdt = PropertyDataType.Boolean; break; case FieldTypeEnum.DateTime: pdt = PropertyDataType.DateTime; break; case FieldTypeEnum.Decimal: pdt = PropertyDataType.Decimal; break; case FieldTypeEnum.Int: pdt = PropertyDataType.Integer; break; case FieldTypeEnum.String: pdt = PropertyDataType.String; break; case FieldTypeEnum.Collection: pdt = PropertyDataType.DataObject; break; } return(pdt); }
/// <summary> /// 将数据库数据类型转换为字段类型枚举 /// </summary> /// <param name="code">数据库数据类型编码</param> /// <returns>字段类型枚举</returns> protected FieldTypeEnum ConvertToFieldTypeEnum(string code) { FieldTypeEnum type = FieldTypeEnum.String; switch (code) { case "39": type = FieldTypeEnum.String; break; case "111": type = FieldTypeEnum.DateTime; break; case "38": type = FieldTypeEnum.Int; break; case "106": type = FieldTypeEnum.Decimal; break; case "50": type = FieldTypeEnum.Bool; break; } return(type); }
//取出GridView数据源中的绑定对象集合 private ETLSapTableResultCollection getDataByGridView(GridView grid, int sortNo) { ETLSapTableResultCollection result = new ETLSapTableResultCollection(); for (int i = 0; i < grid.Rows.Count; i++) { ETLSapTableResult item = new ETLSapTableResult(); item.EntityName = grid.ToolTip; item.IsEnable = ((CheckBox)grid.Rows[i].FindControl("cb_IsEnable")).Checked; item.IsPrimaryKey = ((CheckBox)grid.Rows[i].FindControl("cb_IsPrimaryKey")).Checked; item.FieldName = ((Label)grid.Rows[i].FindControl("lbl_FieldName")).Text; item.FieldDesc = ((Label)grid.Rows[i].FindControl("lbl_FieldDesc")).Text; FieldTypeEnum fieldType; FieldTypeEnum.TryParse(((Label)grid.Rows[i].FindControl("lbl_FieldType")).Text, out fieldType); item.FieldType = fieldType; item.FieldLength = Convert.ToInt32(((Label)grid.Rows[i].FindControl("lbl_FieldLength")).Text); item.IsIndex = ((CheckBox)grid.Rows[i].FindControl("cb_IsIndex")).Checked; if (checkIsCommon.Checked) { item.IsKey = ((CheckBox)grid.Rows[i].FindControl("cb_IsKey")).Checked; item.IsValue = ((CheckBox)grid.Rows[i].FindControl("cb_IsValue")).Checked; } item.RefTableName = ((HBDropDownList)grid.Rows[i].FindControl("ddl_RefTableName")).SelectedIndex == 0 ? string.Empty : ((HBDropDownList)grid.Rows[i].FindControl("ddl_RefTableName")).SelectedValue; item.RefFieldName = ((HBDropDownList)grid.Rows[i].FindControl("ddl_RefFieldName")).SelectedValue.Trim() == "" ? string.Empty : ((HBDropDownList)grid.Rows[i].FindControl("ddl_RefFieldName")).SelectedValue; item.SortNo = sortNo; result.Add(item); } return(result); }
public Field AddField(FieldTypeEnum fieldEnum) { Field field = SchemaFactory.CreateField(fieldEnum); this.Add(field); return(field); }
private void AddCriteriaDT(TextBox tb, ref String sql, String fieldName, FieldTypeEnum fieldtype, ref Boolean bFirst) { String fv = tb.Text.ToWSSafeString(); DateTime mydt; if (!String.IsNullOrWhiteSpace(fv) && DateTime.TryParse(fv, out mydt)) { if (bFirst) { bFirst = false; } else { sql += " AND "; } if (fieldtype == FieldTypeEnum.dateFrom) { sql += String.Format("{0} >= '{1}'", fieldName, fv); } else { sql += String.Format("{0} < '{1}'", fieldName, mydt.AddDays(1).ToShortDateString()); } } }
private static void EndField(FieldTypeEnum fieldType) { if (fieldType == FieldTypeEnum.WholeLine || fieldType == FieldTypeEnum.EndOnly) { EditorGUILayout.EndHorizontal(); } }
public Field(string name, string displayName, string groupName, FieldTypeEnum fieldType) { this.fieldName = name; this.displayName = displayName; this.groupName = groupName; this.fieldType = fieldType; }
public PropertyDefineInfo(string text) { var array = text.Split('|'); ChineseId = array[0].Split('=')[1]; EnglishId = array[1].Split('=')[1]; FieldType = array[2].Split('=')[1].AsEnum <FieldTypeEnum>(); }
/// <summary> /// 将DynamicEntityField转换成.Net的数据类型 /// </summary> /// <param name="pdt"></param> /// <returns></returns> public static Type ToRealType(this FieldTypeEnum pdt) { Type result = typeof(string); TryToRealType(pdt, out result).FalseThrow("不支持FieldTypeEnum的{0}类型转换为CLR的数据类型", pdt); return(result); }
private string GetSimpleObjSwitchTypeStr(FieldTypeEnum fieldType) { string result = string.Empty; switch (fieldType) { case FieldTypeEnum.String: break; case FieldTypeEnum.Byte: break; case FieldTypeEnum.Short: break; case FieldTypeEnum.Int: result = "Convert.ToInt32(value)"; break; case FieldTypeEnum.Long: break; case FieldTypeEnum.Float: break; case FieldTypeEnum.Enum: break; case FieldTypeEnum.StringArray: break; case FieldTypeEnum.ByteArray: break; case FieldTypeEnum.ShortArray: break; case FieldTypeEnum.IntArray: break; case FieldTypeEnum.FloatArray: break; case FieldTypeEnum.LongArray: break; case FieldTypeEnum.ParamsPropertyClass: break; case FieldTypeEnum.SimpleObj: break; default: throw new ArgumentOutOfRangeException(nameof(fieldType), fieldType, null); } return(result); }
public string GetNewGroupMappingColumn(FieldTypeEnum fieldType) { //eerst lijst vullen van welke al gebruikt zijn if (usedGroupMappingColumns == null) { usedGroupMappingColumns = new List <string>(); foreach (DataField usedField in DataGroupFields) { if (usedField.MappingColumn != null && usedField.MappingColumn != "") { usedGroupMappingColumns.Add(usedField.MappingColumn); } } } //dan naam maken met volgnummer erachter //naam = type + volgnummer string initMappingName = fieldType.ToString(); if (fieldType == FieldTypeEnum.DropDown) { initMappingName = "LookupValue"; } int number = 1; string mappingName = initMappingName + number.ToString(); //zolang deze naam al gebruikt is, volgnummer ophogen while (usedGroupMappingColumns.Contains(mappingName)) { number++; mappingName = initMappingName + number.ToString(); } //als maximale beschikbare velden overschreden dan wordt het een extra veld, zo nee dan is de mapping gevonden op veld if (hasMaxMappingFieldsExceeded(fieldType, number)) { // mappingName = ""; throw new Exception("Maximale aantal velden bereikt voor " + fieldType); //extraFields is jsonstring in database //mappingName = "ExtraFields." + field.Name.Replace(" ", "_"); } //bij imagelist en filelist is er maar 1 veld zonder nummer //if (fieldType == FieldTypeEnum.ImageList) //{ // mappingName = "ExtraImages"; //} //else if (fieldType == FieldTypeEnum.FileList) //{ // mappingName = "Files"; //} //lijst van welke al gebruikt zijn aanvullen usedGroupMappingColumns.Add(mappingName); return(mappingName); }
protected bool IsTypeInNamespace(FieldTypeEnum[] namespaces, FieldTypeEnum type) { foreach (FieldTypeEnum typeEnum in namespaces) { if (typeEnum.Equals(type)) { return(true); } } return(false); }
private string GetNextGroupMappingNameByFieldType_old(FieldTypeEnum fieldType) { if (availableGroupMappingFields_old == null) { availableGroupMappingFields_old = new Dictionary <string, bool>(); //init vullen bool isUsed = false; availableGroupMappingFields_old.Add("Text1", isUsed); availableGroupMappingFields_old.Add("Text2", isUsed); availableGroupMappingFields_old.Add("Text3", isUsed); availableGroupMappingFields_old.Add("Text4", isUsed); availableGroupMappingFields_old.Add("Text5", isUsed); foreach (DataField field in DataGroupFields) { if (field.MappingColumn != null && field.MappingColumn != "" && !field.MappingColumn.StartsWith("ExtraFields.")) { if (availableGroupMappingFields_old.ContainsKey(field.MappingColumn)) { isUsed = true; availableGroupMappingFields_old[field.MappingColumn] = isUsed; } } } } string initMappingName = fieldType.ToString(); int number = 1; string mappingName = initMappingName + number.ToString(); while (availableGroupMappingFields_old.ContainsKey(mappingName)) { bool isUsed = availableGroupMappingFields_old[mappingName]; if (isUsed) { mappingName = initMappingName + number.ToString(); number++; } else { availableGroupMappingFields_old[mappingName] = true; } } //if (!hasMaxMappingFieldsExceeded(fieldType, number)) //{ // usedGroupMappingFields.Add(mappingName); //} //else //{ // mappingName = "ExtraFields." + field.Name.Replace(" ", "_"); //} return(mappingName); }
public RecordResultCollection GetData(string tCode) { //Saplocalhost.WebServiceConnectSAP srv = new Saplocalhost.WebServiceConnectSAP(); var srv = new Saplocalhost.WebServiceConnectSAPSoapClient(); DataTable table = srv.GetEntityDefine(tCode); RecordResultCollection resultList = new RecordResultCollection(); var parentRows = table.Select(); int sortNumber = 0; foreach (var item in parentRows) { sortNumber++; RecordResult result = new RecordResult(); result.SortNo = sortNumber; result.EntityName = Convert.ToString(item["实体名"]); result.EntityDesc = Convert.ToString(item["实体描述"]); result.DefaultValue = Convert.ToString(item["默认值"]); result.IsMasterTable = Convert.ToString(item["主子标识"]) == "主" ? true : false; result.FieldName = Convert.ToString(item["字段名"]); FieldTypeEnum type = new FieldTypeEnum(); switch (Convert.ToString(item["字段类型"]).ToLower()) { case "string": type = FieldTypeEnum.String; break; case "int": type = FieldTypeEnum.Int; break; case "bool": type = FieldTypeEnum.Bool; break; case "datetime": type = FieldTypeEnum.DateTime; break; case "decimal": type = FieldTypeEnum.Decimal; break; } result.FieldType = type; result.FieldDesc = Convert.ToString(item["字段描述"]); result.FieldLength = int.Parse(Convert.ToString(item["字段长度"])); resultList.Add(result); } return(resultList); }
/// <summary> /// Initializes a new instance of the <see cref="Field" /> class. /// </summary> /// <param name="name">Name (required).</param> /// <param name="description">Description (required).</param> /// <param name="key">Key (required).</param> /// <param name="tooltip">Tooltip.</param> /// <param name="position">Position (required).</param> /// <param name="defaultValue">Default Value.</param> /// <param name="validValues">Valid Values <remarks>Used typically for dropdown/select</remarks>.</param> /// <param name="validationRegex">Validation Regex.</param> /// <param name="fieldType">Field Type (required).</param> public Field(string name = default(string), string description = default(string), string key = default(string), string tooltip = default(string), int?position = default(int?), string defaultValue = default(string), List <ValidValue> validValues = default(List <ValidValue>), string validationRegex = default(string), FieldTypeEnum fieldType = default(FieldTypeEnum)) { // to ensure "name" is required (not null) if (name == null) { throw new InvalidDataException("name is a required property for Field and cannot be null"); } else { this.Name = name; } // to ensure "description" is required (not null) if (description == null) { throw new InvalidDataException("description is a required property for Field and cannot be null"); } else { this.Description = description; } // to ensure "key" is required (not null) if (key == null) { throw new InvalidDataException("key is a required property for Field and cannot be null"); } else { this.Key = key; } // to ensure "position" is required (not null) if (position == null) { throw new InvalidDataException("position is a required property for Field and cannot be null"); } else { this.Position = position; } // to ensure "fieldType" is required (not null) if (fieldType == null) { throw new InvalidDataException("fieldType is a required property for Field and cannot be null"); } else { this.FieldType = fieldType; } this.Tooltip = tooltip; this.DefaultValue = defaultValue; this.ValidValues = validValues; this.ValidationRegex = validationRegex; }
public static FieldTypeEnum GetEnum(string name) { string[] types = Enum.GetNames(typeof(FieldTypeEnum)); foreach (var type in types) { FieldTypeEnum fieldTypeEnum = (FieldTypeEnum)Enum.Parse(typeof(FieldTypeEnum), type); if (name.Equals(ToType(fieldTypeEnum))) { return(fieldTypeEnum); } } return(FieldTypeEnum.UNKNOWN); }
public static IExcelFieldHandler GetFieldHandler(FieldTypeEnum fieldType, ScriptType scriptType) { if (!Handlers.ContainsKey(fieldType)) { return(null); } var targetHandlers = Handlers[fieldType]; var handler = targetHandlers.Find(h => h.ScriptType == scriptType); return(handler); }
private static void BeginningField(FieldTypeEnum fieldType, string label, bool useSeparator) { if (fieldType == FieldTypeEnum.WholeLine || fieldType == FieldTypeEnum.BeginningOnly) { if (useSeparator) { EditorGUILayout.Separator(); } EditorGUILayout.BeginHorizontal(); } if (!string.IsNullOrEmpty(label)) { EditorGUILayout.PrefixLabel(label); } }
/// <summary> /// 基本类型转换到FieldTypeEnum /// </summary> /// <param name="type"></param> /// <returns></returns> public static FieldTypeEnum ToPropertyDataType(this System.Type type) { type.NullCheck("type"); FieldTypeEnum result = FieldTypeEnum.String; foreach (KeyValuePair <FieldTypeEnum, System.Type> kp in _DataTypeMappings) { if (kp.Value == type) { result = kp.Key; break; } } return(result); }
public ExcelFieldInfo ( string englishName, string chineseName, FieldTypeEnum fieldType, char arraySplit, int index, string sheetClassId, string classDesc = null ) { EnglishName = englishName; ChineseName = chineseName; FieldType = fieldType; ArraySplit = arraySplit; Index = index; SheetClassId = sheetClassId; FieldClassDesc = classDesc; }
public static string TextArea(string textFieldValue, string label, int width, FieldTypeEnum fieldType, bool useSeparator) { string fieldValue = textFieldValue; BeginningField(fieldType, label, useSeparator); if (width > 0) { fieldValue = EditorGUILayout.TextArea(fieldValue, GUILayout.Width(width)); } else { fieldValue = EditorGUILayout.TextArea(fieldValue); } EndField(fieldType); return(fieldValue); }
public static int IntField(int intFieldValue, string label, int width, FieldTypeEnum fieldType, bool useSeparator) { int fieldValue = intFieldValue; BeginningField(fieldType, label, useSeparator); if (width > 0) { fieldValue = EditorGUILayout.IntField(fieldValue, GUILayout.Width(width)); } else { fieldValue = EditorGUILayout.IntField(fieldValue); } EndField(fieldType); return(fieldValue); }
public static bool Toggle(bool floatFieldValue, string label, int width, FieldTypeEnum fieldType, bool useSeparator) { bool fieldValue = floatFieldValue; BeginningField(fieldType, label, useSeparator); if (width > 0) { fieldValue = EditorGUILayout.Toggle(fieldValue, GUILayout.Width(width)); } else { fieldValue = EditorGUILayout.Toggle(fieldValue); } EndField(fieldType); return(fieldValue); }
/// <summary> /// Converto o enum tipo de campos uma string enum /// </summary> /// <param name="pEnum">Valor do enum</param> /// <returns>string do enum referente ao valor passado</returns> public static string ToStrEnum(this FieldTypeEnum pEnum) { switch (pEnum) { case FieldTypeEnum.Memo: return(memoEnum); case FieldTypeEnum.Numeric: return(numericEnum); case FieldTypeEnum.Date: return(dateEnum); case FieldTypeEnum.Float: return(floatEnum); default: return(alphaEnum); } }
protected void Page_Load(object sender, EventArgs e) { if (!TimePointContext.Current.UseCurrentTime) { this.grid.ReadOnly = true; } //给隐藏域赋值 Dictionary <string, string> enumValueKey = new Dictionary <string, string>(); Dictionary <string, string> enumKeyValue = new Dictionary <string, string>(); Type fileTypes = typeof(FieldTypeEnum); foreach (string s in Enum.GetNames(fileTypes)) { FieldTypeEnum myEnum = (FieldTypeEnum)Enum.Parse(typeof(FieldTypeEnum), s); enumValueKey.Add(((int)myEnum).ToString(), s); enumKeyValue.Add(s, ((int)myEnum).ToString()); } HF_EnumValueKey.Value = JSONSerializerExecute.Serialize(enumValueKey, typeof(object)); HF_EnumKeyValue.Value = JSONSerializerExecute.Serialize(enumKeyValue, typeof(object)); if (this.IsPostBack == false && this.IsCallback == false) { ControllerHelper.ExecuteMethodByRequest(this); } this.PropertyEditorRegister(); WebUtility.RequiredScript(typeof(ClientGrid)); this.bindingControl.Data = InitEntity(Request.QueryString["ID"], this.CategoryID); if (!IsPostBack) { if (Request.QueryString["OperationType"] != null) { this.HFOperationType.Value = Request.QueryString["OperationType"].ToString(); } //绑定字段类型 this.ddl_FieldType.BindData(EnumItemDescriptionAttribute.GetDescriptionList(typeof(FieldTypeEnum)), "Name", "Description"); } }
/// <summary> /// 将数据库类型转换成C#类型 /// </summary> /// <param name="provider">字段类型解析器</param> /// <param name="dbType">数据库类型</param> /// <returns></returns> public static Type GetFieldType(this IFieldTypeAnalysisProvider provider, string dbType) { FieldTypeEnum typeEnum = provider.GetFieldTypeEnum(dbType); Type type = null; switch (typeEnum) { case FieldTypeEnum.Text: type = typeof(string); break; case FieldTypeEnum.DateTime: type = typeof(DateTime); break; case FieldTypeEnum.Number: type = typeof(float); break; } return(type); }
private bool hasMaxMappingFieldsExceeded(FieldTypeEnum fieldType, int number) { if (fieldType == FieldTypeEnum.Text) { return(number > 30); } else if (fieldType == FieldTypeEnum.DropDown) { return(number > 10); } else if (fieldType == FieldTypeEnum.ImageList || fieldType == FieldTypeEnum.FileList) { return(number > 1); } else if (fieldType == FieldTypeEnum.CheckboxList) { return(number > 1); } else { return(number > 5); } }
private void Sortfieldtype(FieldTypeEnum fieldType, ref int sortfieldtype, ref string sortFieldPrefix) { if (fieldType == FieldTypeEnum.DATETIME) { sortfieldtype = SortField.LONG; } else if (fieldType == FieldTypeEnum.BOOLEAN) { sortfieldtype = SortField.INT; } else if (fieldType == FieldTypeEnum.INTEGER) { sortfieldtype = SortField.LONG; } else if (fieldType == FieldTypeEnum.LONG) { sortfieldtype = SortField.LONG; } else if (fieldType == FieldTypeEnum.FLOAT) // or double { sortfieldtype = SortField.FLOAT; } else if (fieldType == FieldTypeEnum.KEY) { sortfieldtype = SortField.STRING; } else if (fieldType == FieldTypeEnum.TEXT || fieldType == FieldTypeEnum.HTML) { sortfieldtype = SortField.STRING; sortFieldPrefix = "@"; } else { sortfieldtype = SortField.STRING; sortFieldPrefix = "@"; } }
private void AddCriteriaTB(TextBox tb, ref String sql, String fieldName, FieldTypeEnum fieldtype, ref Boolean bFirst) { String fv = tb.Text.ToWSSafeString(false, false, false, true, true); if (fv != "*" && !String.IsNullOrWhiteSpace(fv)) { if (bFirst) { bFirst = false; } else { sql += " AND "; } if (fieldtype == FieldTypeEnum.text) { sql += String.Format("{0} like '{1}%'", fieldName, fv); } else { sql += String.Format("{0}={1}", fieldName, fv); } } }
public Field AddField(FieldTypeEnum fieldEnum) { Field field = SchemaFactory.CreateField(fieldEnum); this.Add(field); return field; }
protected virtual bool WriteObject(string objectName, List<TypeConfigItem> members, Func<TypeConfigItem, string, string> format, FieldTypeEnum type) { bool hasProperties = this.HasProperties(members); if (hasProperties && objectName != null) { this.EnsureComma(); this.Write(objectName); this.WriteEqualsSign(); this.BeginBlock(); } foreach (var member in members) { object constValue = null; bool isPrimitive = false; var primitiveExpr = member.Initializer as PrimitiveExpression; if (primitiveExpr != null) { isPrimitive = true; constValue = primitiveExpr.Value; } var isNull = member.Initializer.IsNull || member.Initializer is NullReferenceExpression; if (!isNull && !isPrimitive) { var resolveResult = this.Emitter.Resolver.ResolveNode(member.Initializer, this.Emitter); if (resolveResult != null && resolveResult.IsCompileTimeConstant) { isPrimitive = true; constValue = resolveResult.ConstantValue; } } var isNullable = false; if (isPrimitive && constValue is AstType) { var itype = this.Emitter.Resolver.ResolveNode((AstType)constValue, this.Emitter); if (NullableType.IsNullable(itype.Type)) { isNullable = true; } } if(type == FieldTypeEnum.Property || type == FieldTypeEnum.Event) { this.PushWriter("{0}"); member.Initializer.AcceptVisitor(this.Emitter); string value = this.PopWriter(true); this.Injectors.Add(format(member, value)); continue; } if (!isNull && (!isPrimitive || (constValue is AstType))) { string value = null; if (!isPrimitive) { this.PushWriter("{0}"); member.Initializer.AcceptVisitor(this.Emitter); value = this.PopWriter(true); //var oldWriter = this.SaveWriter(); //this.NewWriter(); //member.Initializer.AcceptVisitor(this.Emitter); //value = this.Emitter.Output.ToString(); //this.RestoreWriter(oldWriter); } else { if (isNullable) { value = "nil"; } else { AstType astType = (AstType)constValue; var rr = Emitter.Resolver.ResolveNode(astType, Emitter); var def = Inspector.GetDefaultFieldValue(rr.Type); if(def == rr.Type) { value = Inspector.GetStructDefaultValue(rr.Type, this.Emitter); } else { value = def.ToString(); } } } this.Injectors.Add(format(member, value)); continue; } this.EnsureComma(); XmlToJsDoc.EmitComment(this, member.Entity); this.Write(member.GetName(this.Emitter)); this.WriteEqualsSign(); if (constValue is AstType) { if (isNullable) { this.Write("nil"); } else { AstType astType = (AstType)constValue; var rr = Emitter.Resolver.ResolveNode(astType, Emitter); var def = Inspector.GetDefaultFieldValue(rr.Type); if(def == rr.Type) { this.Write(Inspector.GetStructDefaultValue(rr.Type, this.Emitter)); } else { this.WriteScript(def); } } } else { member.Initializer.AcceptVisitor(this.Emitter); } this.Emitter.Comma = true; } if (hasProperties && objectName != null) { this.WriteNewLine(); this.EndBlock(); } return hasProperties; }
public string ToSqfString(FieldTypeEnum fieldType, double data) { //Logger.Trace(string.Format("{0} args: {1}", this.GetTraceInfo(), string.Join(", ", fieldType, data))); double max; StringBuilder builder = new StringBuilder(); switch (fieldType) { case FieldTypeEnum.XField: max = 1920; builder.Append("SafeZoneX + "); builder.Append('('); builder.Append(data.ToString(System.Globalization.CultureInfo.InvariantCulture)); builder.Append(" / "); builder.Append(max.ToString(System.Globalization.CultureInfo.InvariantCulture)); builder.Append(')'); builder.Append(" * SafeZoneW"); break; case FieldTypeEnum.YField: max = 1080; builder.Append("SafeZoneY + "); builder.Append('('); builder.Append(data.ToString(System.Globalization.CultureInfo.InvariantCulture)); builder.Append(" / "); builder.Append(max.ToString(System.Globalization.CultureInfo.InvariantCulture)); builder.Append(')'); builder.Append(" * SafeZoneH"); break; case FieldTypeEnum.WField: max = 1920; builder.Append('('); builder.Append(data.ToString(System.Globalization.CultureInfo.InvariantCulture)); builder.Append(" / "); builder.Append(max.ToString(System.Globalization.CultureInfo.InvariantCulture)); builder.Append(')'); builder.Append(" * SafeZoneW"); break; case FieldTypeEnum.HField: max = 1080; builder.Append('('); builder.Append(data.ToString(System.Globalization.CultureInfo.InvariantCulture)); builder.Append(" / "); builder.Append(max.ToString(System.Globalization.CultureInfo.InvariantCulture)); builder.Append(')'); builder.Append(" * SafeZoneH"); break; default: throw new Exception(); } return builder.ToString(); }
public double FromSqfString(FieldTypeEnum fieldType, string data) { //Logger.Trace(string.Format("{0} args: {1}", this.GetTraceInfo(), string.Join(", ", fieldType, data))); data = data.ToUpper(); double max; switch (fieldType) { case FieldTypeEnum.XField: case FieldTypeEnum.WField: data = data.Replace("SAFEZONEX", "0"); data = data.Replace("SAFEZONEW", "1"); max = 1920; break; case FieldTypeEnum.YField: case FieldTypeEnum.HField: data = data.Replace("SAFEZONEY", "0"); data = data.Replace("SAFEZONEH", "1"); max = 1080; break; default: throw new Exception(); } try { var res = (double.Parse(new System.Data.DataTable().Compute(data, "").ToString())) * max; return res; } catch { return 0; } }
protected bool IsTypeInNamespace(FieldTypeEnum[] namespaces, FieldTypeEnum type) { foreach (FieldTypeEnum typeEnum in namespaces) { if (typeEnum.Equals(type)) { return true; } } return false; }
public static Field CreateField(FieldTypeEnum fieldEnum) { return FieldTypeEnumHelper.CreateField(fieldEnum); }