Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        /// <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));
        }
Ejemplo n.º 3
0
 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();
     }
 }
Ejemplo n.º 4
0
 /// <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);
     }
 }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
		//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;
		}
Ejemplo n.º 7
0
        //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);
        }
Ejemplo n.º 8
0
 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;
 }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        /// <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);
        }
Ejemplo n.º 12
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;
		}
Ejemplo n.º 14
0
 public static bool MarkAsDeleted(Guid fieldGuid)
 {
     return(DBFields.MarkAsDeleted(fieldGuid));
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Gets an IList with all instances of field.
        /// </summary>
        public static List <Field> GetAll()
        {
            IDataReader reader = DBFields.GetAll();

            return(LoadListFromReader(reader));
        }
Ejemplo n.º 16
0
        /// <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));
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Gets a count of Field.
 /// </summary>
 public static int GetCount()
 {
     return(DBFields.GetCount());
 }
Ejemplo n.º 18
0
 /// <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));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Deletes Fields by Site. Returns true on success.
 /// </summary>
 public static bool DeleteBySite(Guid siteGuid)
 {
     return(DBFields.DeleteBySite(siteGuid));
 }
Ejemplo n.º 20
0
 /// <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));
 }
Ejemplo n.º 21
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 ();



		}