最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net+easyui框架上传图片之前判断图片格式及预览
时间:2015-07-06 编辑:简简单单 来源:一聚教程网
上传图片功能虽然很简单,但是在上传图片之前验证图片的格式,并同时实现预览,还是有很多细节需要注意的,本文的就详细来解说这个。
html页面
选择图片:javascript:setImagePreview(this,localImag,preview);" type="file" />
预 览:
js代码
<%--easyui 的js--%>
<%--中文js--%>
<%--上传图片时js--%>
上传图片时,需要jquery.form.js的js文件,下载地址:http://plugins.jquery.com/form/
=================================================================================
最近有网友,总觉得看的还不是太明白,能不能将paintingBLL和paintingEntity代码贴一下-----新人求罩,我个人觉得实体层就没有必要了,下面我就将paintingBLL的源码粘一下,仅供大家参考。
using System;
using System.Data;
using System.Collections.Generic;
using Common;
using Entity;
using DALFactory;
using IDAL;
namespace BLL
{
///
/// paintingBLL
///
public partial class paintingBLL
{
private readonly IpaintingDAL dal=DataAccess.CreatepaintingDAL();
public paintingBLL()
{}
#region BasicMethod
///
/// 得到最大ID
///
public int GetMaxId()
{
return dal.GetMaxId();
}
///
/// 是否存在该记录
///
public bool Exists(int PaintingID)
{
return dal.Exists(PaintingID);
}
///
/// 增加一条数据
///
public bool Add(Entity.paintingEntity Entity)
{
return dal.Add(Entity);
}
///
/// 更新一条数据
///
public bool Update(Entity.paintingEntity Entity)
{
return dal.Update(Entity);
}
///
/// 删除一条数据
///
public bool Delete(int PaintingID)
{
return dal.Delete(PaintingID);
}
///
/// 删除一条数据
///
public bool DeleteList(string PaintingIDlist )
{
return dal.DeleteList(PaintingIDlist );
}
///
/// 得到一个对象实体
///
public Entity.paintingEntity GetEntity(int PaintingID)
{
return dal.GetEntity(PaintingID);
}
///
/// 得到一个对象实体,从缓存中
///
public Entity.paintingEntity GetEntityByCache(int PaintingID)
{
string CacheKey = "paintingEntityEntity-" + PaintingID;
object objEntity = Common.DataCache.GetCache(CacheKey);
if (objEntity == null)
{
try
{
objEntity = dal.GetEntity(PaintingID);
if (objEntity != null)
{
int EntityCache = Common.ConfigHelper.GetConfigInt("EntityCache");
Common.DataCache.SetCache(CacheKey, objEntity, DateTime.Now.AddMinutes(EntityCache), TimeSpan.Zero);
}
}
catch{}
}
return (Entity.paintingEntity)objEntity;
}
///
/// 获得数据列表
///
public DataSet GetList(string strWhere)
{
return dal.GetList(strWhere);
}
///
/// 获得数据列表
///
public DataSet GetPaintingList(string strWhere)
{
return dal.GetPaintingList(strWhere);
}
///
/// 获得前几行数据
///
public DataSet GetList(int Top,string strWhere,string filedOrder)
{
return dal.GetList(Top,strWhere,filedOrder);
}
///
/// 获得数据列表
///
public List
{
DataSet ds = dal.GetList(strWhere);
return DataTableToList(ds.Tables[0]);
}
///
/// 获得数据列表
///
public List
{
List
int rowsCount = dt.Rows.Count;
if (rowsCount > 0)
{
Entity.paintingEntity Entity;
for (int n = 0; n < rowsCount; n++)
{
Entity = dal.DataRowToEntity(dt.Rows[n]);
if (Entity != null)
{
EntityList.Add(Entity);
}
}
}
return EntityList;
}
///
/// 获得数据列表
///
public DataSet GetAllList()
{
return GetList("");
}
///
///checkbox获取数据列表
///
public int GetRecordCount(string strWhere)
{
return dal.GetRecordCount(strWhere);
}
///
/// 分页获取数据列表
///
public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
{
return dal.GetListByPage( strWhere, orderby, startIndex, endIndex);
}
///
/// 分页获取数据列表
///
//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
//{
//return dal.GetList(PageSize,PageIndex,strWhere);
//}
#endregion BasicMethod
#region ExtensionMethod
#endregion ExtensionMethod
}
}
分页
-
上一个: c#连接MySQL的教程及实例方法
相关文章
- C#复制数组的两种方式及效率比较解读 10-24
- ASP.NET Identity用法解析 10-24
- ASP.NET MVC使用Identity增删改查用户介绍 10-24
- C语言中atoi函数模拟实现介绍 10-18
- .Net反向代理组件Yarp用法介绍 10-10
- .NET使用YARP通过编码方式配置域名转发实现反向代理教程 10-10