/// <summary> /// BindData() /// </summary> void BindData() { Action = We7Request.GetString("t").ToLower(); if (Action == "widget") { List <string> displayFields = new List <string>(); We7DataColumnCollection dcs = new We7DataColumnCollection(); foreach (We7DataColumn col in ModelInfo.DataSet.Tables[0].Columns) { if (col.Direction == ParameterDirection.ReturnValue || (col.IsSystem && !displayFields.Contains(col.Name))) { continue; } dcs.Add(col); } chklstWidgetList.DataSource = dcs; chklstWidgetList.DataTextField = "Label"; chklstWidgetList.DataValueField = "Name"; chklstWidgetView.DataSource = dcs; chklstWidgetView.DataTextField = "Label"; chklstWidgetView.DataValueField = "Name"; chklstWidgetList.DataBind(); chklstWidgetView.DataBind(); } if (ModelInfo.Layout != null && ModelInfo.Layout.UCContrl != null) { foreach (ListItem item in chklstWidgetView.Items) { item.Attributes["mvalue"] = item.Value; if (ModelInfo.Layout.UCContrl.WidgetDetailFieldArray != null) { item.Selected = Array.Exists(ModelInfo.Layout.UCContrl.WidgetDetailFieldArray, s => s == item.Value); } } foreach (ListItem item in chklstWidgetList.Items) { item.Attributes["mvalue"] = item.Value; if (ModelInfo.Layout.UCContrl.WidgetListFieldArray != null) { item.Selected = Array.Exists(ModelInfo.Layout.UCContrl.WidgetListFieldArray, s => s == item.Value); } } } Exist(Action); }
private string DeleteFiles() { string result = ""; string fileStr = We7Request.GetString("delFiles"); if (fileStr.Length > 0) { string[] filePathList = Utils.SplitString(fileStr, ","); int totalCount = 0; int errorCount = 0; foreach (string filePath in filePathList) { bool exist = false; bool isFile = false; string physicalPath = ""; if (filePath.Length > 0) { totalCount++; try { physicalPath = Server.MapPath(filePath); isFile = (Path.GetExtension(physicalPath).Length > 0 ? true : false); if (isFile) { exist = File.Exists(physicalPath); } else { exist = Directory.Exists(physicalPath); } } catch { } if (exist) { try { if (isFile) { File.Delete(physicalPath); } else { Directory.Delete(physicalPath, true); } } catch (Exception ex) { result += "<br/>“" + physicalPath + "” 删除失败,原因:" + ex.Message; errorCount++; } } } } result = "升级文件异常:总文件数:" + totalCount + ",其中删除失败:" + errorCount + ",详细信息:" + result; if (errorCount > 0) { We7.Framework.LogHelper.WriteLog(typeof(upgrade), result); } } return(result); }