public static DBFields GetDbFields <TEntityType>(this TEntityType entity) where TEntityType : IDbEntity { if (entity == null) { return(null); } var map = DbMapping.Get(entity.GetType()); if (map?.PropertiesInfos == null || map.PropertiesInfos.Count == 0) { return(null); } var fields = new DBFields(); foreach (var property in map.PropertiesInfos) { var value = property.GetValue(entity); if (value == null) { continue; } fields.SetEx(property.Name, value); } return(fields); }
/// <summary> /// Gets an IList with page of instances of field. /// </summary> /// <param name="pageNumber">The page number.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="totalPages">total pages</param> public static List <Field> GetPage(int pageNumber, int pageSize, out int totalPages) { totalPages = 1; IDataReader reader = DBFields.GetPage(pageNumber, pageSize, out totalPages); return(LoadListFromReader(reader)); }
public static void SetEx(this DBFields fields, string name, object value) { if (value.IsNumeric()) { fields.Set(name, value.ConvertValue <double>()); } else if (value.IsNumeric()) { fields.Set(name, value.ConvertValue <long>()); } else if (value.IsBool()) { fields.Set(name, value.ConvertValue <bool>()); } else if (value.IsDateTime()) { var dateTime = value.ConvertValue <DateTime>(); fields.Set(name, dateTime.ToDate()); } else if (value is string) { fields.Set(name, (string)value); } else { throw new NotImplementedException(); } }
/// <summary> /// Gets an instance of field. /// </summary> /// <param name="fieldGuid"> fieldGuid </param> private void GetField(Guid fieldGuid) { using (IDataReader reader = DBFields.GetOne(fieldGuid)) { PopulateFromReader(reader); } }
public static DBFields ToDictionary(this TodoItem t) { var fields = new DBFields(); fields.Set("Title", t.Name); fields.Set("Description", t.Notes); fields.Set("IsDone", t.Done); return(fields); }
//REGRESA LAS PROPIEDADES DEL OBJECTO Y SUS VALORES EN UN VARIABLE TIPO DBFields public DBFields Campos () { var fields = new DBFields(); fields.Set("Id", Id); fields.Set("Nombre", Nombre); fields.Set("Telefono", Telefono); return fields; }
//REGRESA LAS PROPIEDADES DEL OBJECTO Y SUS VALORES EN UN VARIABLE TIPO DBFields public DBFields Campos() { var fields = new DBFields(); fields.Set("Id", Id); fields.Set("Nombre", Nombre); fields.Set("Telefono", Telefono); return(fields); }
public DBFields ToFields () { var fields = new DBFields(); fields.Set("X", (double)X); fields.Set("Y", (double)Y); fields.Set("Z", (long)Z); fields.Set("Name", Name); fields.Set ("Rotation", Math.PI * Rotation / 180f); // In degrees radian. fields.Set("Scale", (double)Scale); return fields; }
public DBFields ToFields() { var fields = new DBFields(); fields.Set("X", (double)X); fields.Set("Y", (double)Y); fields.Set("Z", (long)Z); fields.Set("Name", Name); fields.Set("Rotation", Math.PI * Rotation / 180f); // In degrees radian. fields.Set("Scale", (double)Scale); return(fields); }
public static DBFields ToDBFields(this Dictionary <string, object> dictionary) { var dbFields = new DBFields(); foreach (var kpv in dictionary) { if (kpv.Value == null || kpv.Key == null) { throw new NullReferenceException("Key or value is null"); } dbFields.SetEx(kpv.Key, kpv.Value); } return(dbFields); }
/// <summary> /// Persists a new instance of field. Returns true on success. /// </summary> /// <returns></returns> private bool Create() { this.fieldGuid = Guid.NewGuid(); int rowsAffected = DBFields.Create( this.siteGuid, this.featureGuid, this.definitionGuid, this.fieldGuid, this.definitionName, this.name, this.label, this.defaultValue, this.controlType, this.controlSrc, this.sortOrder, this.helpKey, this.required, this.requiredMessageFormat, this.regex, this.regexMessageFormat, this.token, this.preTokenString, this.postTokenString, this.searchable, this.editPageControlWrapperCssClass, this.editPageLabelCssClass, this.editPageControlCssClass, this.datePickerIncludeTimeForDate, this.datePickerShowMonthList, this.datePickerShowYearList, this.datePickerYearRange, this.imageBrowserEmptyUrl, //this.iSettingControlSettings, this.options, this.checkBoxReturnBool, this.checkBoxReturnValueWhenTrue, this.checkBoxReturnValueWhenFalse, this.dateFormat, this.textBoxMode, this.attributes, this.IsGlobal); return(rowsAffected > 0); }
//REGISTRA CONTACTO void BuscaContacto(string id) { InicializarDropboxDatastore(Account.LinkedAccount); //RECUPERAMOS LA TABLA DE NUESTRO DATASTORE PARA REGISTRAR EN ELLA EL NUEVO CONTACTO DBTable table = DropboxDatastore.GetTable("Contactos"); //RECUPERA CONTACTO CREANDO UN FILTRO var fieldsFiltro = new DBFields(); fieldsFiltro.Set("Id", id); //APLICAMOS EL FILTRO AL QUERY var results = table.Query(fieldsFiltro); //VERIFICAMOS EL RESULTADO Y SI TIENE RECUPERAMOS EL CONTACTO if (results.Count() > 0) { temp_contacto = results.AsList() [0]; txtNombre.Text = temp_contacto.GetString("Nombre"); txtTelefono.Text = temp_contacto.GetString("Telefono"); } else { Toast.MakeText(this, "No se encontro el contacto", ToastLength.Long).Show(); } //SINCRONIZAMOS LOS DATOS DropboxDatastore.Sync(); //CERRAMOS LA CONEXION A NUESTRO DATASTORE DropboxDatastore.Close(); }
public static DBFields ToDictionary (this TodoItem t) { var fields = new DBFields(); fields.Set("Title", t.Name); fields.Set("Description", t.Notes); fields.Set("IsDone", t.Done); return fields; }
public static bool MarkAsDeleted(Guid fieldGuid) { return(DBFields.MarkAsDeleted(fieldGuid)); }
/// <summary> /// Gets an IList with all instances of field. /// </summary> public static List <Field> GetAll() { IDataReader reader = DBFields.GetAll(); return(LoadListFromReader(reader)); }
/// <summary> /// Gets an IList with all fields for a definition /// </summary> /// <param name="definitionGuid"></param> /// <returns>IList</returns> public static List <Field> GetAllForDefinition(Guid definitionGuid, bool includeDeleted = false) { IDataReader reader = DBFields.GetAllForDefinition(definitionGuid, includeDeleted); return(LoadListFromReader(reader)); }
/// <summary> /// Gets a count of Field. /// </summary> public static int GetCount() { return(DBFields.GetCount()); }
/// <summary> /// Deletes Fields by Field Definition. Returns true on success. /// </summary> /// <param name="moduleGuid"> moduleGuid </param> /// <returns>bool</returns> public static bool DeleteByDefinition(Guid definitionGuid) { return(DBFields.DeleteByDefinition(definitionGuid)); }
/// <summary> /// Deletes Fields by Site. Returns true on success. /// </summary> public static bool DeleteBySite(Guid siteGuid) { return(DBFields.DeleteBySite(siteGuid)); }
/// <summary> /// Deletes an instance of field. Returns true on success. /// </summary> /// <param name="fieldGuid"> fieldGuid </param> /// <returns>bool</returns> public static bool Delete( Guid fieldGuid) { return(DBFields.Delete( fieldGuid)); }
//REGISTRA CONTACTO void BuscaContacto (string id) { InicializarDropboxDatastore (Account.LinkedAccount); //RECUPERAMOS LA TABLA DE NUESTRO DATASTORE PARA REGISTRAR EN ELLA EL NUEVO CONTACTO DBTable table = DropboxDatastore.GetTable ("Contactos"); //RECUPERA CONTACTO CREANDO UN FILTRO var fieldsFiltro = new DBFields(); fieldsFiltro.Set("Id", id); //APLICAMOS EL FILTRO AL QUERY var results = table.Query (fieldsFiltro); //VERIFICAMOS EL RESULTADO Y SI TIENE RECUPERAMOS EL CONTACTO if (results.Count () > 0) { temp_contacto = results.AsList () [0]; txtNombre.Text = temp_contacto.GetString ("Nombre"); txtTelefono.Text = temp_contacto.GetString ("Telefono"); } else { Toast.MakeText (this, "No se encontro el contacto", ToastLength.Long).Show(); } //SINCRONIZAMOS LOS DATOS DropboxDatastore.Sync (); //CERRAMOS LA CONEXION A NUESTRO DATASTORE DropboxDatastore.Close (); }