当前位置: 首页>>代码示例>>C#>>正文


C# Lfx.Row方法代码示例

本文整理汇总了C#中Lfx.Row方法的典型用法代码示例。如果您正苦于以下问题:C# Lfx.Row方法的具体用法?C# Lfx.Row怎么用?C# Lfx.Row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lfx的用法示例。


在下文中一共展示了Lfx.Row方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProductImage

		public static System.Drawing.Image ProductImage(Lfx.Data.Connection dataBase, int productId, DownloadImage downloadImage)
		{
			string CachePath = Lfx.Environment.Folders.CacheFolder;
			string ImageFileName = "product_" + productId.ToString() + ".jpg";
			bool ImageInCache = System.IO.File.Exists(CachePath + ImageFileName);

			if(downloadImage == DownloadImage.Always
				|| (downloadImage == DownloadImage.OnlyIfNotInCache && ImageInCache == false)
				|| ((downloadImage == DownloadImage.PreferCacheOnSlowLinks && ImageInCache == false) || Lfx.Workspace.Master.SlowLink == false))
			{
				//Download image and save to cache
				Lfx.Data.Row ImagenDB = dataBase.Row("articulos_imagenes", "imagen", "id_articulo", productId);

                                if (ImagenDB != null && ImagenDB.Fields["imagen"].Value != null && ((byte[])(ImagenDB.Fields["imagen"].Value)).Length > 5)
				{
					//Guardar imagen en cache
					System.IO.BinaryWriter wr = new System.IO.BinaryWriter(System.IO.File.OpenWrite(CachePath + ImageFileName), System.Text.Encoding.Default);
                                        wr.Write(((byte[])(ImagenDB.Fields["imagen"].Value)));
					wr.Close();

                                        byte[] ByteArr = ((byte[])(ImagenDB.Fields["imagen"].Value));
                                        System.Drawing.Image Img;

                                        using (System.IO.MemoryStream loStream = new System.IO.MemoryStream(ByteArr)) {
                                                Img = System.Drawing.Image.FromStream(loStream);
                                        }
                                        return Img;
				}
				else
				{
					//Devuelve la imagen de la categoría, en lugar de la del artículo
					int CategoriaArticulo = dataBase.FieldInt("SELECT id_categoria FROM articulos WHERE id_articulo=" + productId.ToString());
					return CategoryImage(dataBase, CategoriaArticulo, downloadImage);
				}
			}

			//Serve only from cache
			if(ImageInCache)
			{
				return System.Drawing.Image.FromFile(CachePath + ImageFileName);
			}
			
			return null;
		}
开发者ID:solutema,项目名称:ultralight,代码行数:44,代码来源:Stock.cs

示例2: NombreCompletoRecibo

		public static string NombreCompletoRecibo(Lfx.Data.Connection dataBase, int iId)
		{
			// Toma el Id del recibo y devuelve el tipo y número (por ejemplo: "Recibo #003" o "Comprobante de Pago #256")
			Lfx.Data.Row TmpRecibo = dataBase.Row("recibos", "id_recibo", iId);

			if (TmpRecibo == null)
				return "";
			else if (System.Convert.ToInt32(TmpRecibo["numero"]) > 0)
				return "Recibo Nº " + System.Convert.ToInt32(TmpRecibo["numero"]).ToString("00000000");
			else
				return "Recibo S/N";
		}
开发者ID:solutema,项目名称:ultralight,代码行数:12,代码来源:Comprobante.cs

示例3: CategoryImage

		public static System.Drawing.Image CategoryImage(Lfx.Data.Connection dataBase, int categoryId, DownloadImage downloadImage)
		{
			string CachePath = Lfx.Environment.Folders.CacheFolder;
			string ImageFileName = "product_category_" + categoryId.ToString() + ".jpg";
			bool ImageInCache = System.IO.File.Exists(CachePath + ImageFileName);

                        if (downloadImage == DownloadImage.Always
                                || (downloadImage == DownloadImage.OnlyIfNotInCache && ImageInCache == false)
                                || ((downloadImage == DownloadImage.PreferCacheOnSlowLinks && ImageInCache == false) || Lfx.Workspace.Master.SlowLink == false))
			{
				//Download image and save to cache
				Lfx.Data.Row ImagenDB = dataBase.Row("articulos_categorias", "imagen", "id_categoria", categoryId);

				if(ImagenDB != null && ImagenDB["imagen"] != null && ((byte[])(ImagenDB["imagen"])).Length > 5)
				{
					//Guardar imagen en cache
					System.IO.BinaryWriter wr = new System.IO.BinaryWriter(System.IO.File.OpenWrite(CachePath + ImageFileName), System.Text.Encoding.Default);
					wr.Write(((byte[])(ImagenDB["imagen"])));
					wr.Close();

					byte[] ByteArr = ((byte[])(ImagenDB["imagen"]));
					System.IO.MemoryStream loStream = new System.IO.MemoryStream(ByteArr);
					return System.Drawing.Image.FromStream(loStream);
				}
				else
				{
					return null;
				}
			}

			//Serve only from cache
			if(ImageInCache)
				return System.Drawing.Image.FromFile(CachePath + ImageFileName);
			
			return null;
		}
开发者ID:solutema,项目名称:ultralight,代码行数:36,代码来源:Stock.cs


注:本文中的Lfx.Row方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。