美文网首页
C# 根据XML配置文件加载列

C# 根据XML配置文件加载列

作者: a9b854aded01 | 来源:发表于2017-11-10 15:59 被阅读0次

根据XML文件路径加载配置文件 UIOperate加载配置文件列

UIOperate uio = new UIOperate(this._protocol, this._address);
            string conf_Customer_path = System.Windows.Forms.Application.StartupPath + "/" + this._conf_Directory + "/" + this._xml_CustomerCol;
            string conf_CustomerShortCut_path = System.Windows.Forms.Application.StartupPath + "/" +
                this._conf_Directory + "/" + this._xml_CustomerShortCutCol;

            if (!File.Exists(conf_Customer_path))
            {
                DataSet ds = uio.GetColInfo("frmCustomer", "QUERY");
                SetDataView.SaveConfigDataSet(ds, _conf_Directory, _xml_CustomerCol);
            }
            if (!File.Exists(conf_CustomerShortCut_path))
            {
                DataSet ds = uio.GetColInfo("frmCustomerShortCut", "QUERY");
                SetDataView.SaveConfigDataSet(ds, _conf_Directory, _xml_CustomerShortCutCol);
            }


UIOperate

public class UIOperate
    {

        UIDisplayProxyClient MyUIDisplayProxy = null;
        LocalClientProxy MyLcp = null;
        public UIOperate(LocalClientProxy.PROTOCAL protocol, string address)
        {
            MyLcp = new LocalClientProxy(protocol, address);
            MyUIDisplayProxy = MyLcp.GetUIDisplayProxy();
        }

        public System.Data.DataSet GetColInfo(string name, string type)
        {
            FeedbackInfomation fi = new FeedbackInfomation();
            string jsonResult = MyUIDisplayProxy.GetUICol(name, type);
            fi = JsonConvert.DeserializeObject<FeedbackInfomation>(jsonResult);
            if (fi.ErrorStatus == STATUS_ADAPTER.QUERY_NORMAL)
            {
                DataSet ds = JsonConvert.DeserializeObject<DataSet>(fi.Result.ToString());
                return ds;
            }
            else
            {
                return null;
            }
        }

        public DataSet GetTableStruct(string tablename)
        {
            FeedbackInfomation fi = new FeedbackInfomation();
            string jsonResult = MyUIDisplayProxy.GetUITableStruct(tablename);
            fi = JsonConvert.DeserializeObject<FeedbackInfomation>(jsonResult);
            if (fi.ErrorStatus == STATUS_ADAPTER.QUERY_NORMAL)
            {
                DataSet ds = JsonConvert.DeserializeObject<DataSet>(fi.Result.ToString());
                return ds;
            }
            else
            {
                return null;
            }
        }
    }

相关文章

网友评论

      本文标题:C# 根据XML配置文件加载列

      本文链接:https://www.haomeiwen.com/subject/dawbmxtx.html