public static void update(FilesEntity files) { DbHelper.ExecuteNonQuery("p_Files_update", files.FilesId, files.ProductId, files.IsIndex ); }
public static int insert(FilesEntity files) { return Convert.ToInt32(DbHelper.ExecuteScalar("p_Files_insert", files.ImgName, files.SystemName, files.IsIndex, files.ProductId, files.FileCode )); }
void IHttpHandler.ProcessRequest(HttpContext context) { string param = context.Request.QueryString["Param"]; switch (param.ToLower()) { case "uploadfiles": HttpPostedFile filePF = context.Request.Files[0]; string msg = ""; string error = ""; string filename = ""; int fileid = 0; if (filePF.ContentLength == 0 || Library.FileLib.isPicByFileName(filePF.FileName) == false) error = "无效图片,请重试"; else { FilesEntity file = new FilesEntity(); file.SystemName = filename = Library.ImgLib.getUploadFilename(filePF); file.ProductId = 0; file.FileCode = "1"; file.ImgName = ""; file.IsIndex = false; fileid = logic.files.insert(file); msg = "上传成功"; } string result = "{ error:'" + error + "', msg:'" + msg + "',fileid:'" + fileid + "',filename:'" + filename + "'}"; context.Response.Output.Write(result); return; case "delfile": string delmsg = "删除成功!"; string delerror = ""; int delfileid = Convert.ToInt32(context.Request.QueryString["fileid"]); try { Library.FileLib.delUploadFile(logic.files.getById(delfileid).SystemName); } catch { } logic.files.delete(delfileid); string delresult = "{ error:'" + delerror + "', msg:'" + delmsg + "'}"; context.Response.Output.Write(delresult); return; default: context.Response.Output.Write("未知错误,请联系管理员。"); return; } }
public static FilesEntity getById(int filesId) { DataRow dr = DbHelper.ExecuteDataRow("p_Files_getById", filesId); FilesEntity files = new FilesEntity(); if (dr != null) { files.FilesId = filesId; files.ImgName = dr["imgName"].ToString(); files.SystemName = dr["systemName"].ToString(); files.CreateDt = Convert.ToDateTime(dr["createDt"]); files.IsIndex = Convert.ToBoolean(dr["isIndex"]); files.ProductId = Convert.ToInt32(dr["productId"]); files.FileCode = dr["fileCode"].ToString(); } return files; }
void updateFiles(int proId) { string[] splitstr = { "," }; string[] lists = hid_photolist.Value.Split(splitstr, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < lists.Length; i = i + 2) { FilesEntity fl = new FilesEntity(); fl.FilesId = Convert.ToInt32(lists[i]); fl.ProductId = proId; fl.IsIndex = i == 0 ? true : false; //判断第一个图片 logic.files.update(fl); } }
public static void update(FilesEntity files) { Files.update(files); }
public static int insert(FilesEntity fl) { return Files.insert(fl); }