Exemple #1
0
		public static void CreateXML(string fileName, IList<TableOperator> oplist) {
			Xml2.Create(fileName, "", "", "utf-8", "<root></root>");
			Xml2 xml = new Xml2(fileName);
			foreach (var info in oplist) {
				xml.AddNode("root", "Table", "Name|Entity|Insert|Update|Delete|IsExistByID|SelectByID|SelectPageList|SelectListByFK|SelectListByAll|UpdateAndInsert", "{0}|{9}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{10}".FormatWith(
					info.Table, info.Insert.ToString().ToLower(), info.Update.ToString().ToLower(), info.DeleteByID.ToString().ToLower(),
					info.IsExistByID.ToString().ToLower(), info.SelectByID.ToString().ToLower(), info.SelectPageList.ToString().ToLower(),
					info.SelectListByFK.ToString().ToLower(), info.SelectListByAll.ToString().ToLower(), info.Entity.ToString().ToLower(),
					info.UpdateAndInsert.ToString().ToLower()
				));
			}
			xml.Save();
			xml.Close();
		}
Exemple #2
0
		public static IList<TableOperator> LoadOPList(Config config, Action<TableEntity> process) {
			string xmlFile = "".GetMapPath() + config.Project + ".xml";
			bool xmlExist = FileDirectory.FileExists(xmlFile);
			IList<TableEntity> list = TableFactory.GetTable();
			foreach (TableEntity entity in list) {
				process(entity);
				if (!xmlExist) config.OPList.Add(new TableOperator() { Table = entity.Name });
				else {
					Xml2 xml = new Xml2(xmlFile);
					string[] attrs = xml.GetAttr("root//Table[@Name='" + entity.Name + "']", "Name|Insert|Update|Delete|IsExistByID|SelectByID|SelectPageList|SelectListByFK|SelectListByAll|Entity|UpdateAndInsert").Split('|');
					if (attrs[0].IsNullEmpty()) {
						config.OPList.Add(new TableOperator() { Table = entity.Name });
						var info = config.OPList[config.OPList.Count - 1];
						xml.AddNode("root", "Table", "Name|Entity|Insert|Update|Delete|IsExistByID|SelectByID|SelectPageList|SelectListByFK|SelectListByAll|UpdateAndInsert", "{0}|{9}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{10}".FormatWith(
							info.Table, info.Insert.ToString().ToLower(), info.Update.ToString().ToLower(), info.DeleteByID.ToString().ToLower(),
							info.IsExistByID.ToString().ToLower(), info.SelectByID.ToString().ToLower(), info.SelectPageList.ToString().ToLower(),
							info.SelectListByFK.ToString().ToLower(), info.SelectListByAll.ToString().ToLower(), info.Entity.ToString().ToLower(),
							info.UpdateAndInsert.ToString().ToLower()
						));
						xml.Save();
					} else {
						config.OPList.Add(new TableOperator() {
							Table = entity.Name,
							Insert = attrs[1] == "true" ? true : false,
							Update = attrs[2] == "true" ? true : false,
							DeleteByID = attrs[3] == "true" ? true : false,
							IsExistByID = attrs[4] == "true" ? true : false,
							SelectByID = attrs[5] == "true" ? true : false,
							SelectPageList = attrs[6] == "true" ? true : false,
							SelectListByFK = attrs[7] == "true" ? true : false,
							SelectListByAll = attrs[8] == "true" ? true : false,
							Entity = attrs[9] == "true" ? true : false,
							UpdateAndInsert = attrs[10] == "true" ? true : false,
						});
					}
					xml.Close();
				}
			}
			if (!xmlExist) TableStructureFactory.CreateXML(xmlFile, config.OPList);
			return config.OPList;
		}
Exemple #3
0
		private void property_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) {
			Xml2 xml = new Xml2(xmlFile);
			var info = config.OPList[listBox.SelectedIndex];
			xml.SetAttr("root//Table[@Name='" + info.Table + "']", "Entity|Insert|Update|Delete|IsExistByID|SelectByID|SelectPageList|SelectListByFK|SelectListByAll|UpdateAndInsert", "{8}|{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{9}".FormatWith(
				info.Insert.ToString().ToLower(), info.Update.ToString().ToLower(), info.DeleteByID.ToString().ToLower(),
				info.IsExistByID.ToString().ToLower(), info.SelectByID.ToString().ToLower(), info.SelectPageList.ToString().ToLower(),
				info.SelectListByFK.ToString().ToLower(), info.SelectListByAll.ToString().ToLower(), info.Entity.ToString().ToLower(),
				info.UpdateAndInsert.ToString().ToLower()
			));
			xml.Save();
			xml.Close();
		}