CEL_Payroll/Payroll.BO/Configuration/ConfigurationManager.cs

141 lines
5.5 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Ease.CoreV35;
//using Ease.CoreV35.Model;
//using System.Data;
//using System.IO;
//using System.Xml;
//namespace Payroll.BO
//{
// public class ConfigurationManager
// {
// public ConfigurationManager()
// {
// }
// private static ObjectsTemplate<Configaration> _logicCofiguration;
// private static ObjectsTemplate<Configaration> _uiCofiguration;
// private void ReloadConfiguration()
// {
// _logicCofiguration = Configaration.Service.Get(EnumConfigurationType.Logic);
// _uiCofiguration = Configaration.Service.Get(EnumConfigurationType.UI);
// }
// public static ObjectsTemplate<Configaration> LogicCofiguration
// {
// get
// {
// return _logicCofiguration;
// }
// }
// public static ObjectsTemplate<Configaration> UIConfiguration
// {
// get
// {
// return _uiCofiguration;
// }
// }
// private void GetChilds(ObjectsTemplate<Configaration> Source, ObjectsTemplate<Configaration> destination
// , Configaration parent)
// {
// IEnumerable<Configaration> Items = from Cnfgs in Source
// where Cnfgs.ParentID == parent.ID
// select Cnfgs;
// if (Items == null) return;
// foreach (var item in Items)
// {
// destination.Add(item);
// GetChilds(Source, destination, item);
// }
// }
// public ObjectsTemplate<Configaration> GetChilds(string NodeName
// , EnumConfigurationType type)
// {
// ObjectsTemplate<Configaration> destinations = new ObjectsTemplate<Configaration>();
// ObjectsTemplate<Configaration> SourceObject = (type == EnumConfigurationType.UI) ? _uiCofiguration : _logicCofiguration;
// Configaration fParent = SourceObject.Find(delegate(Configaration item) { return (item.Node == NodeName); });
// if (fParent != null) GetChilds(SourceObject, destinations, fParent);
// return destinations;
// }
// public ObjectsTemplate<Configaration> GetChilds(ObjectsTemplate<Configaration> sourceObject, string NodeName)
// {
// ObjectsTemplate<Configaration> destinations = new ObjectsTemplate<Configaration>();
// Configaration fParent = sourceObject.Find(delegate(Configaration item) { return (item.Node == NodeName); });
// if (fParent != null) GetChilds(sourceObject, destinations, fParent);
// return destinations;
// }
// public void LoadXMLFile(EnumConfigurationType type)
// {
// XmlDocument xmlDoc = new XmlDocument();
// //Load the file into the XmlDocument
// if (type == EnumConfigurationType.Logic)
// {
// xmlDoc.Load("LogicConfiguration.xml");
// _logicCofiguration = new ObjectsTemplate<Configaration>();
// }
// else
// {
// xmlDoc.Load("D:\\Local\\DotNetPayroll\\Source\\Payroll.BO\\Configuration\\UIConfiguration.xml");
// _uiCofiguration = new ObjectsTemplate<Configaration>();
// }
// //Find the root nede, and add it togather with its childeren
// XmlNode xnod = xmlDoc.DocumentElement;
// // Add Parent node in Collection
// Configaration parent= AddToColl(xnod, null,type);
// ReadFromXML(xnod, parent,type);
// }
// private void ReadFromXML(XmlNode xnod, Configaration parent, EnumConfigurationType type)
// {
// XmlNode xnodWorking;
// //For an element node, retrive the attributes
// if (xnod.NodeType == XmlNodeType.Element)
// {
// XmlNamedNodeMap mapAttributes = xnod.Attributes;
// if(xnod.HasChildNodes)
// {
// xnodWorking = xnod.FirstChild;
// while (xnodWorking != null)
// {
// if (xnodWorking.NodeType == XmlNodeType.Element)
// {
// Configaration oparent = AddToColl(xnodWorking, parent.ID, type);
// //Add the attributes to the ListBox
// foreach (XmlNode xnodAttribute in xnodWorking)
// {
// oparent.configurationAttributes.Add(oparent.ID,xnodAttribute.Name, xnodAttribute.InnerHtml);
// }
// //If there are any child node, call this procedrue recursively
// ReadFromXML(xnodWorking, oparent,type);
// }
// xnodWorking = xnodWorking.NextSibling;
// }
// }
// }
// }
// private Configaration AddToColl(XmlNode node, ID parentID, EnumConfigurationType type)
// {
// Payroll.BO.Configaration oConfig = new Payroll.BO.Configaration();
// oConfig.Node = node.Name;
// oConfig.Value = node.InnerHtml;
// oConfig.SetObjectID(ID.FromInteger(_uiCofiguration.Count + 1));
// oConfig.ParentID = parentID;
// oConfig.Type = type;
// if (type == EnumConfigurationType.UI) _uiCofiguration.Add(oConfig);
// else _logicCofiguration.Add(oConfig);
// return oConfig;
// }
// }
//}