예제 #1
0
파일: FlowXmlDefine.cs 프로젝트: JuRogn/OA
        public Dictionary< List<AppFunc>,List<TableColumn>> ListFuncTableColumn(string ObjectFolder, string strFileName, ref string MsgLinkUrl)
        {
            Dictionary<List<AppFunc>, List<TableColumn>> FuncTableColumn = new Dictionary<List<AppFunc>, List<TableColumn>>();
            try
            {
                List<AppFunc> list = new List<AppFunc>();
                string Path = System.Web.Hosting.HostingEnvironment.MapPath("~/BusinessObjects/" + ObjectFolder + "/" + strFileName + ".xml");
                XDocument xdoc = XDocument.Load(Path);
                try
                {
                    string strXml = xdoc.Document.ToString();
                    int Start = strXml.IndexOf("<MsgOpen>") + "<MsgOpen>".Length;
                    int End = strXml.IndexOf("</MsgOpen>");
                    MsgLinkUrl = strXml.Substring(Start, End - Start);
                }
                catch { }
                var xmlTree = from c in xdoc.Descendants("Function")
                              select c;
                if (xmlTree.Count() > 0)
                {
                    foreach (var v in xmlTree)
                    {
                        AppFunc sys = new AppFunc();
                        sys.Language = v.Attribute("Description").Value;
                        sys.FuncName = v.Attribute("FuncName").Value;

                        // sys.Parameter = v.Attribute("Parameter").Value;
                        sys.Address = v.Attribute("Address").Value;
                        sys.Binding = v.Attribute("Binding").Value;
                        sys.SplitChar = v.Attribute("SplitChar").Value;
                        List<Parameter> ListParam = new List<Parameter>();
                        var param = v.Descendants("ParaStr").Descendants<XElement>("Para");
                        if (param.Count() > 0)
                        {
                            foreach (var p in param)
                            {
                                Parameter para = new Parameter();
                                para.Description = p.Attribute("Description").Value.CvtString();
                                para.Name = p.Attribute("Name").Value.CvtString();
                                para.Value = p.Attribute("Value").Value.CvtString();
                                para.TableName = p.Attribute("TableName").Value.CvtString();
                                ListParam.Add(para);
                            }
                        }
                        sys.Parameter = ListParam;
                        list.Add(sys);
                    }
                }
                List<TableColumn> lists = new List<TableColumn>();
                var xmlTrees = from c in xdoc.Descendants("Object").Descendants<XElement>("Attribute")
                              select c;
                if (xmlTrees.Count() > 0)
                {
                    foreach (var v in xmlTrees)
                    {
                        TableColumn sys = new TableColumn();
                        sys.Language = v.Attribute("Description").Value;
                        sys.DataType = v.Attribute("DataType").Value;
                        sys.DataValue = v.Attribute("DataValue").Value;
                        sys.Description = v.Attribute("Description").Value;
                        sys.FieldName = v.Attribute("Name").Value;
                        lists.Add(sys);
                    }
                }
                xdoc = null;
                FuncTableColumn.Add(list, lists);
                return FuncTableColumn;
            }
            catch (Exception ex)
            {
                //ErrorLog.WriteErrorMessage(ex.Message + "|" + DateTime.Now.ToString() + "|" + ex.Source + "|" + "UserDefine.svc方法GetSystemFuncList");
            }
            return null;
        }
예제 #2
0
파일: FlowXmlDefine.cs 프로젝트: JuRogn/OA
 public List<TableColumn> ListTableColumn(string ObjectFolder, string strFileName)
 {
     try
     {
         List<TableColumn> list = new List<TableColumn>();
         string Path = System.Web.Hosting.HostingEnvironment.MapPath("~/BusinessObjects/" + ObjectFolder + "/" + strFileName + ".xml");
         XDocument xdoc = XDocument.Load(Path);
         var xmlTree = from c in xdoc.Descendants("Object").Descendants<XElement>("Attribute")
                       select c;
         if (xmlTree.Count() > 0)
         {
             foreach (var v in xmlTree)
             {
                 TableColumn sys = new TableColumn();
                 sys.Language = v.Attribute("Description").Value;
                 sys.DataType = v.Attribute("DataType").Value;
                 sys.DataValue = v.Attribute("DataValue").Value;
                 sys.Description = v.Attribute("Description").Value;
                 sys.FieldName = v.Attribute("Name").Value;
                 list.Add(sys);
             }
         }
         xdoc = null;
         return list;
     }
     catch (Exception ex)
     {
         //ErrorLog.WriteErrorMessage(ex.Message + "|" + DateTime.Now.ToString() + "|" + ex.Source + "|" + "UserDefine.svc方法GetSystemFuncList");
     }
     return null;
 }