protected void Page_Load(object sender, EventArgs e) { this.Title = this.Lab; switch (this.DoType) { case "Del": MapExt mm = new MapExt(); mm.MyPK = this.MyPK; mm.Retrieve(); mm.Delete(); this.Response.Redirect("InputCheck.aspx?FK_MapData=" + this.FK_MapData + "&ExtType=" + this.ExtType + "&RefNo=" + this.RefNo, true); return; default: break; } if (this.MyPK != null || this.DoType == "New") { Edit_InputCheck(); return; } MapExts mes = new MapExts(); mes.Retrieve(MapExtAttr.ExtType, this.ExtType, MapExtAttr.FK_MapData, this.FK_MapData); this.MapJS(mes); }
void rb_CheckedChanged(object sender, EventArgs e) { string path = BP.Sys.SystemConfig.PathOfData + "\\JSLib\\"; RadioButton rb = this.Pub1.GetRadioButtonByID("RB_0"); if (rb.Checked == false) { path = BP.Sys.SystemConfig.PathOfDataUser + "\\JSLib\\"; } ListBox lb = this.Pub1.FindControl("LB1") as ListBox; lb.Items.Clear(); lb.AutoPostBack = false; lb.SelectionMode = ListSelectionMode.Multiple; lb.Rows = 10; string file = temFile; if (string.IsNullOrEmpty(temFile) == false) { file = file.Substring(file.LastIndexOf('\\') + 4); file = file.Replace(".js", ""); } else { file = "!!!"; } MapExts mes = new MapExts(); mes.Retrieve(MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.AttrOfOper, this.OperAttrKey, MapExtAttr.ExtType, this.ExtType); string[] dirs = System.IO.Directory.GetDirectories(path); foreach (string dir in dirs) { string[] strs = Directory.GetFiles(dir); foreach (string s in strs) { if (s.Contains(".js") == false) { continue; } ListItem li = new ListItem(s.Replace(path, "").Replace(".js", ""), s); if (s.Contains(file)) { li.Selected = true; } lb.Items.Add(li); } } }
void btn_SaveInputCheck_Click(object sender, EventArgs e) { ListBox lb = this.Pub1.FindControl("LB1") as ListBox; // 检查路径. 没有就创建它。 string pathDir = BP.Sys.SystemConfig.PathOfDataUser + "\\JSLibData\\"; if (Directory.Exists(pathDir) == false) { Directory.CreateDirectory(pathDir); } // 删除已经存在的数据. MapExt me = new MapExt(); me.Retrieve(MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.ExtType, this.ExtType, MapExtAttr.AttrOfOper, this.OperAttrKey); foreach (ListItem li in lb.Items) { if (li.Selected == false) { continue; } me = (MapExt)this.Pub1.Copy(me); me.ExtType = this.ExtType; // 操作的属性. me.AttrOfOper = this.OperAttrKey; int doWay = 0; if (this.Pub1.GetRadioButtonByID("RB_0").Checked == false) { doWay = 1; } me.DoWay = doWay; me.Doc = BP.DA.DataType.ReadTextFile(li.Value); FileInfo info = new FileInfo(li.Value); me.Tag2 = info.Directory.Name; //获取函数的名称. string func = me.Doc; func = me.Doc.Substring(func.IndexOf("function") + 8); func = func.Substring(0, func.IndexOf("(")); me.Tag1 = func.Trim(); // 检查路径,没有就创建它. FileInfo fi = new FileInfo(li.Value); me.Tag = li.Value; me.FK_MapData = this.FK_MapData; me.ExtType = this.ExtType; me.MyPK = this.FK_MapData + "_" + me.ExtType + "_" + me.AttrOfOper + "_" + me.Tag1; try { me.Insert(); } catch { me.Update(); } } #region 把所有的js 文件放在一个文件里面。 MapExts mes = new MapExts(); mes.Retrieve(MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.ExtType, this.ExtType); string js = ""; foreach (MapExt me1 in mes) { js += "\r\n" + BP.DA.DataType.ReadTextFile(me1.Tag); } if (File.Exists(pathDir + "\\" + this.FK_MapData + ".js")) { File.Delete(pathDir + "\\" + this.FK_MapData + ".js"); } BP.DA.DataType.WriteFile(pathDir + "\\" + this.FK_MapData + ".js", js); #endregion 把所有的js 文件放在一个文件里面。 this.Response.Redirect("InputCheck.aspx?FK_MapData=" + this.FK_MapData + "&ExtType=" + this.ExtType + "&RefNo=" + this.RefNo, true); }