/// <summary> /// 保存列表排序,如果使用了缓存,保存成功后会清空本表的所有缓存记录,然后重新加载进缓存 /// </summary> /// <param name="page">当前页面指针</param> /// <param name="grid1">页面表格</param> /// <param name="tbxSort">表格中绑定排序的表单名</param> /// <param name="sortName">排序字段名</param> /// <returns>更新成功返回true,失败返回false</returns> public override bool UpdateSort(Page page, FineUI.Grid grid1, string tbxSort, string sortName = "Sort") { //更新排序 if (CommonBll.UpdateSort(page, grid1, tbxSort, "V_COMPONENT01_PRODUCT00", sortName, "Id")) { //判断是否启用缓存 if (CommonBll.IsUseCache()) { //删除所有缓存 DelAllCache(); //重新载入缓存 GetList(); } //添加用户操作记录 UseLogBll.GetInstence().Save(page, "{0}更新了V_COMPONENT01_PRODUCT00表排序!"); return(true); } return(false); }
/// <summary> /// 保存列表排序,如果使用了缓存,保存成功后会清空本表的所有缓存记录,然后重新加载进缓存 /// </summary> /// <param name="page">当前页面指针</param> /// <param name="grid1">页面表格</param> /// <param name="tbxSort">表格中绑定排序的表单名</param> /// <param name="sortName">排序字段名</param> /// <returns>更新成功返回true,失败返回false</returns> public bool UpdateSort(Page page, FineUI.Grid grid1, string tbxSort, string sortName = "Sort") { //更新排序 if (CommonBll.UpdateSort(page, grid1, tbxSort, "Article", sortName, "Id")) { //判断是否启用缓存 if (CommonBll.IsUseCache()) { //删除所有缓存 DelAllCache(); //重新载入缓存 GetList(); } //添加用户操作记录 CommonBll.WriteLog("{0}更新了Article表排序!"); //UseLogBll.GetInstence().Save(page, "{0}更新了Article表排序!"); return(true); } return(false); }
/// <summary>获取grid选中的行中的key</summary> /// <param name="grid">Grid控件</param> /// <param name="isMemoryPaging">true=内存分页,false=数据分页</param> /// <returns></returns> public static string GetSelectedKey(FineUI.Grid grid, bool isMemoryPaging = false) { StringBuilder sb = new StringBuilder(); int selectedCount = grid.SelectedRowIndexArray.Length; int sp = 0; if (isMemoryPaging) { sp = (grid.PageIndex * grid.PageSize); } for (int i = 0; i < selectedCount; i++) { int rowIndex = grid.SelectedRowIndexArray[i] + sp; object[] dataKeys = grid.DataKeys[rowIndex]; for (int j = 0; j < dataKeys.Length; j++) { sb.Append(dataKeys[j] + ","); } } return(StringHelper.FilterSql(sb.ToString().Trim(','))); }
public void BindOrderGrid(string st, string et, int type, string shop_name, FineUI.Grid grid) { DataTable da; try { DataSet dsCom = null; dsCom = (DataSet)SPs.Get_Purchase00(st, et, type).ExecuteDataSet(); if (dsCom.Tables.Count > 0) { da = dsCom.Tables[0].Copy(); grid.DataSource = da; grid.DataBind(); } else { da = new DataTable(); } } catch { da = new DataTable(); } }
/// <summary> /// 绑定Grid表格,使用内存分页,显示有层次感 /// </summary> /// <param name="grid">表格控件</param> /// <param name="parentValue">父Id值</param> /// <param name="sorts">排序</param> /// <param name="parentId">父Id</param> public override void BindGrid(FineUI.Grid grid, int parentValue, List <string> sorts = null, string parentId = "ParentId") { BindGrid(grid, parentValue, null, sorts, parentId); }
public static void upload(System.Web.UI.WebControls.FileUpload FileUpload1, FineUI.Grid grid) { bool fileOK = true; //文件的上传路径 string path = HttpContext.Current.Server.MapPath("~/ExperimentTen/res/Import/"); //判断上传文件夹是否存在,若不存在,则创建 if (!Directory.Exists(path)) { //创建文件夹 Directory.CreateDirectory(path); } if (FileUpload1.HasFile) { //允许上传的类型 //string[] allowExtesions = { ".doc", ".xls", ".rar", ".zip", ".ppt" }; //for (int i = 0; i < allowExtesions.Length; i++) //{ // if (fileExtesion == allowExtesions[i]) // { // //文件格式正确 允许上传 // fileOK = true; // } //} string name = FileUpload1.FileName; // 获得上传文件的名字. int size = FileUpload1.PostedFile.ContentLength; // 文件大小. if (size > (1000000 * 1024)) { fileOK = false; // Label2.Text = "文件过大"; } string type = FileUpload1.PostedFile.ContentType;// 文件类型. // 获取上传文件的类型(后缀) string fileExtesion = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower(); //string type2 = name.Substring(name.LastIndexOf(".") + 1);// LastIndexOf()最后一个索引位置匹配.Substring()里面的+1是重载. if (fileOK) { try { Random ranNum = new Random(); // 在1和1000之间的随机正整数 // int num = ranNum.Next(1, 1000); // 获取当前时间 string newname = System.DateTime.Now.ToString("yyyyMMddHHmm"); // 声明文件名,防止重复 newname = newname + name + fileExtesion; string ipath = HttpContext.Current.Server.MapPath("~/ExperimentTen/res/Import/") + "\\" + newname; // 取得根目录下面的upimg目录的路径. string fpath = HttpContext.Current.Server.MapPath("~/ExperimentTen/res/Import/") + "\\" + newname; string wpath = "~/ExperimentTen/res/Import/\\" + newname; // 获得虚拟路径 if (fileExtesion == ".jpg" || fileExtesion == ".gif" || fileExtesion == ".bmp" || fileExtesion == ".png") { FileUpload1.SaveAs(ipath); // 保存方法,参数是一个地址字符串. // Image1.ImageUrl = wpath; // Label1.Text = "你传的文件名是:" + name + "<br>文件大小为:" + size + "字节<br>文件类型是:" + type + // "<br>后缀是:" + fileExtesion + "<br>实际路径是:" + ipath + "<br>虚拟路径是:" + fpath; // Image1.Visible = true; // fileUrl.Text = ipath; } else { // Image1.Visible = false; FileUpload1.SaveAs(fpath); // Label1.Text = "你传的文件名是:" + name + "<br>文件大小为:" + size + "字节<br>文件类型是:" + type + // "<br>后缀是:" + fileExtesion + "<br>实际路径是:" + ipath + "<br>虚拟路径是:" + fpath; // fileUrl.Text = fpath; } // FileUpload1.PostedFile.SaveAs(path + newname); //Session["filename"] = newname; // Label2.Text = "上传成功"; // fileName.Text = name; // filesize.Text = size.ToString(); DataTable dt = new DataTable(); dt = NPOI_EXCEL.ExcelToDataTable(ipath, true); grid.DataSource = dt; grid.DataBind(); //lab_upload.Text = "上传成功"; } catch (Exception ex) { // Label2.Text = "上传失败"; throw ex; } } } else { //尚未选择文件 // Label2.Text = "尚未选择任何文件,请选择文件"; return; } }