/// <summary> /// Copies the elements of the specified <see cref="ModuleDefInfo">ModuleDefInfo</see> array to the end of the collection. /// </summary> /// <param name="value">An array of type <see cref="ModuleDefInfo">ModuleDefInfo</see> containing the Components to add to the collection.</param> public void AddRange(ModuleDefInfo[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } }
/// <summary> /// Gets a value indicating whether the collection contains the specified <see cref="ModuleDefInfoCollection">ModuleDefInfoCollection</see>. /// </summary> /// <param name="value">The <see cref="ModuleDefInfoCollection">ModuleDefInfoCollection</see> to search for in the collection.</param> /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns> public bool Contains(ModuleDefInfo value) { return this.List.Contains(value); }
public int Add(ModuleDefInfo value) { return this.List.Add(value); }
public void Remove(ModuleDefInfo value) { List.Remove(value); }
/// <summary> /// Initializes a new instance of the <see cref="ModuleDefInfoCollection">ModuleDefInfoCollection</see> class containing the specified array of <see cref="ModuleDefInfo">ModuleDefInfo</see> Components. /// </summary> /// <param name="value">An array of <see cref="ModuleDefInfo">ModuleDefInfo</see> Components with which to initialize the collection. </param> public ModuleDefInfoCollection(ModuleDefInfo[] value) { this.AddRange(value); }
/// <summary> /// 修改指定的ModuleDef信息 /// </summary> /// <param name="moduleDefInfo"></param> /// <returns></returns> public bool UpdateModuleDef(ModuleDefInfo moduleDefInfo) { IDataParameter[] parms = { DbHelper.MakeInParam("@moduledefid", (DbType)SqlDbType.Int, 4, moduleDefInfo.ModuleDefID), DbHelper.MakeInParam("@modulename", (DbType)SqlDbType.NVarChar, 20, moduleDefInfo.ModuleName), DbHelper.MakeInParam("@cachetime", (DbType)SqlDbType.Int, 4, moduleDefInfo.CacheTime), DbHelper.MakeInParam("@configfile", (DbType)SqlDbType.VarChar, 100, moduleDefInfo.ConfigFile), DbHelper.MakeInParam("@controller", (DbType)SqlDbType.VarChar, 255, moduleDefInfo.BussinessController), }; string sql = string.Format(@"UPDATE [{0}spacemoduledefs] SET [modulename]=@modulename, [cachetime]=@cachetime, [configfile]=@configfile, [controller]=@controller WHERE [moduledefid]=@moduledefid", BaseConfigs.GetTablePrefix); return RunExecuteSql(sql, parms); }
/// <summary> /// Gets the index in the collection of the specified <see cref="ModuleDefInfoCollection">ModuleDefInfoCollection</see>, if it exists in the collection. /// </summary> /// <param name="value">The <see cref="ModuleDefInfoCollection">ModuleDefInfoCollection</see> to locate in the collection.</param> /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns> public int IndexOf(ModuleDefInfo value) { return(this.List.IndexOf(value)); }
public static void UpdateModuleDefInfo(ModuleDefInfo mdi) { Space.Data.DbProvider.GetInstance().UpdateModuleDef(mdi); }
public static void AddModuleDefInfo(ModuleDefInfo mdi) { Space.Data.DbProvider.GetInstance().AddModuleDefInfo(mdi); }
/// <summary> /// Gets a value indicating whether the collection contains the specified <see cref="ModuleDefInfoCollection">ModuleDefInfoCollection</see>. /// </summary> /// <param name="value">The <see cref="ModuleDefInfoCollection">ModuleDefInfoCollection</see> to search for in the collection.</param> /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns> public bool Contains(ModuleDefInfo value) { return(this.List.Contains(value)); }
private static ModuleDefInfo GetModuleDefEntity(IDataReader reader) { ModuleDefInfo mdi = new ModuleDefInfo(); mdi.ModuleDefID = TypeConverter.ObjectToInt(reader["moduledefid"], 0); mdi.ModuleName = reader["modulename"].ToString(); mdi.CacheTime = TypeConverter.ObjectToInt(reader["cachetime"], 0); mdi.ConfigFile = reader["configfile"].ToString(); mdi.BussinessController = reader["controller"].ToString(); return mdi; }
public int Add(ModuleDefInfo value) { return(this.List.Add(value)); }
public void Insert(int index, ModuleDefInfo value) { List.Insert(index, value); }
/// <summary> /// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index. /// </summary> /// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param> /// <param name="index">The index of the array at which to begin inserting.</param> public void CopyTo(ModuleDefInfo[] array, int index) { this.List.CopyTo(array, index); }
/// <summary> /// Gets the index in the collection of the specified <see cref="ModuleDefInfoCollection">ModuleDefInfoCollection</see>, if it exists in the collection. /// </summary> /// <param name="value">The <see cref="ModuleDefInfoCollection">ModuleDefInfoCollection</see> to locate in the collection.</param> /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns> public int IndexOf(ModuleDefInfo value) { return this.List.IndexOf(value); }
/// <summary> /// 添加ModuleDef信息至数据库 /// </summary> /// <param name="moduleDefInfo"></param> /// <returns></returns> public bool AddModuleDef(ModuleDefInfo moduleDefInfo) { IDataParameter[] parms = { DbHelper.MakeInParam("@modulename", (DbType)SqlDbType.NVarChar, 20, moduleDefInfo.ModuleName), DbHelper.MakeInParam("@cachetime", (DbType)SqlDbType.Int, 4, moduleDefInfo.CacheTime), DbHelper.MakeInParam("@configfile", (DbType)SqlDbType.VarChar, 100, moduleDefInfo.ConfigFile), DbHelper.MakeInParam("@controller", (DbType)SqlDbType.VarChar, 255, moduleDefInfo.BussinessController), }; string sql = string.Format(@"INSERT INTO [{0}spacemoduledefs]([modulename], [cachetime], [configfile], [controller]) VALUES(@moduledefid, @modulename, @cachetime, @configfile, @controller)", BaseConfigs.GetTablePrefix); return RunExecuteSql(sql, parms); }
public void AddModuleDefInfo(ModuleDefInfo mdi) { IDataParameter[] parms = { DbHelper.MakeInParam("@modulename", (DbType)SqlDbType.NVarChar, 20, mdi.ModuleName), DbHelper.MakeInParam("@cachetime", (DbType)SqlDbType.Int, 4, mdi.CacheTime), DbHelper.MakeInParam("@configfile", (DbType)SqlDbType.VarChar, 100, mdi.ConfigFile), DbHelper.MakeInParam("@controller", (DbType)SqlDbType.VarChar, 255, mdi.BussinessController) }; string sql = string.Format("INSERT INTO [{0}spacemoduledefs]([modulename], [cachetime], [configfile], [controller]) VALUES(@modulename, @cachetime, @configfile, @controller)", BaseConfigs.GetTablePrefix); DbHelper.ExecuteNonQuery(CommandType.Text, sql, parms); }
protected void AddApply_Click(object sender, EventArgs e) { if (this.CheckCookie()) { string[] urllist = DNTRequest.GetString("url").Split(','); bool hasemptyvalue = false; XmlDocument xml = new XmlDocument(); try { xml.Load(listfilename); } catch { base.RegisterStartupScript("", "<script>alert('缺少对列表文件的访问权限或者列表文件不存在');window.location.href='space_moduledefmanage.aspx';</script>"); return; } XmlNodeList xnlGadgets = xml.GetElementsByTagName("Gadget"); BindGridData(); foreach (string url in urllist) { foreach (DataGridItem dgi in DataGrid1.Items) { if (dgi.ItemType == ListItemType.AlternatingItem || dgi.ItemType == ListItemType.Item) { if (url != DataGrid1.DataKeys[dgi.ItemIndex].ToString() || HadInList(url, xnlGadgets) != null) { continue; } string category = DataGrid1.Items[dgi.ItemIndex].Cells[3].Text; string modulename = DataGrid1.Items[dgi.ItemIndex].Cells[2].Text.Substring(0, DataGrid1.Items[dgi.ItemIndex].Cells[2].Text.LastIndexOf("(")); ;//DataGrid1.GetControlValue(dgi.ItemIndex, "moduledefname"); if (category == string.Empty || modulename == string.Empty) { hasemptyvalue = true; continue; } //分类节点如果不存在则创建 XmlNodeList xnl = xml.GetElementsByTagName("Category"); XmlNode categorynode = GetCategoryNode(category, xnl); if (categorynode == null) { categorynode = xml.CreateNode(XmlNodeType.Element, "Category", ""); XmlAttribute xa = xml.CreateAttribute("name"); xa.Value = category; categorynode.Attributes.Append(xa); xml.DocumentElement.AppendChild(categorynode); } //添加至列表文件 XmlNode node = xml.CreateNode(XmlNodeType.Element, "Gadget", ""); XmlAttribute xanode = xml.CreateAttribute("name"); xanode.Value = modulename; node.Attributes.Append(xanode); xanode = xml.CreateAttribute("url"); xanode.Value = url; node.Attributes.Append(xanode); categorynode.AppendChild(node); try { xml.Save(listfilename); } catch { base.RegisterStartupScript("", "<script>alert('缺少对列表文件的访问权限或者列表文件不存在');window.location.href='space_moduledefmanage.aspx';</script>"); return; } if (url.StartsWith("builtin_")) { //内置模块添加至数据库 ModulePref mp = ModuleXmlHelper.LoadModulePref(Utils.GetMapPath(BaseConfigs.GetForumPath + "space/modules/" + url)); if (mp != null) { ModuleDefInfo mdi = new ModuleDefInfo(); mdi.ModuleName = modulename; mdi.CacheTime = 0; mdi.BussinessController = mp.Controller; mdi.ConfigFile = url; SpaceProvider.AddModuleDefInfo(mdi); } } } } } if (hasemptyvalue) { base.RegisterStartupScript( "", "<script>alert('模块名称或分类名称为空的模块未被添加');window.location.href='space_moduledefmanage.aspx';</script>"); } base.RegisterStartupScript( "", "<script>window.location.href='space_moduledefmanage.aspx';</script>"); BindGridData(); } }