public string Save(IWorkspace Workspace, BaseModel BaseModel, ModelProperty Property) { BaseModel _bm = (BaseModel)Property.Property.GetValue(BaseModel, null); if (_bm != null) { ModelProperty _keyProperty = _bm.ModelProperties.Where(x => x.Attribute is EntityKeyFieldAttribute).First <ModelProperty>(); var _keyValue = Convert.ChangeType(_keyProperty.Property.GetValue(_bm, null), _keyProperty.Attribute.FieldType); return(FieldFormatHelper.FormatField(_keyValue, Property.Attribute.FieldType)); } return(FieldFormatHelper.FormatField("", Property.Attribute.FieldType)); }
public string Save(IWorkspace Workspace, BaseModel BaseModel, ModelProperty Property) { string _resultado = "''"; if (Property.Property.GetValue(BaseModel, null) != null) { DateTime _date = Convert.ToDateTime(Property.Property.GetValue(BaseModel, null)); string _DateValue = ""; if (_date.Year > 1) { _DateValue = _date.ToShortDateString() + " " + _date.ToLongTimeString(); } _resultado = "to_date('" + FieldFormatHelper.FormatField(_DateValue, Property.Attribute.FieldType) + "','DD/MM/YYYY HH24:MI:SS')"; } return(_resultado); }
public string Save(IWorkspace Workspace, BaseModel BaseModel, ModelProperty Property) { EntityKeyFieldAttribute _keyField = (EntityKeyFieldAttribute)Property.Attribute; if (String.IsNullOrEmpty(_keyField.Sequence)) { return(FieldFormatHelper.FormatField(Property.Property.GetValue(BaseModel, null), Property.Attribute.FieldType)); } else { ICursor cursor = Helper.GDBCursor.obterCursor((IFeatureWorkspace)Workspace, "SYS.DUAL", _keyField.Sequence + ".NEXTVAL", ""); IRow row = cursor.NextRow(); Property.Property.SetValue(BaseModel, Convert.ChangeType(row.get_Value(0).ToString(), Property.Attribute.FieldType), null); return(row.get_Value(0).ToString()); } }
public string Save(IWorkspace Workspace, BaseModel BaseModel, ModelProperty Property) { return(FieldFormatHelper.FormatField(Property.Property.GetValue(BaseModel, null), Property.Attribute.FieldType)); }