예제 #1
0
        static public DGVColumnConfigCollection CreateFromXml(XmlDocument doc)
        {
            DGVColumnConfigCollection r = new DGVColumnConfigCollection();
            XmlNode root = doc.SelectSingleNode("columns");

            foreach (XmlNode node in root.SelectNodes("column"))
            {
                string dataPropertyName = XmlHelper.GetAttribute(node, "dataPropertyName", false);
                string text             = XmlHelper.GetAttribute(node, "text", false);
                string format           = XmlHelper.GetAttribute(node, "format", true);
                string strWidth         = XmlHelper.GetAttribute(node, "width", true);


                int width = 100;
                if (!string.IsNullOrEmpty(strWidth))
                {
                    width = int.Parse(strWidth);
                }
                DGVColumnConfig item = new DGVColumnConfig(
                    dataPropertyName, format, text);
                item.Width = width;
                r.Add(item);
            }
            return(r);
        }
        public static DGVColumnConfig Create(string line)
        {
            string dataPropertyName = string.Empty;
            string format = string.Empty;
            string text = string.Empty;
            int width = 100;
            bool visible = true;

            string[] items = line.Split(';');
            foreach (string item in items)
            {
                if (item.Trim().Length == 0)
                {
                    continue;
                }

                string[] kv = item.Split('=');

                if (kv.Length == 2)
                {
                    string key = kv[0].Trim().ToUpper();
                    string value = kv[1].Trim();

                    switch (key)
                    {
                        case "DATAPROPERTYNAME":
                            dataPropertyName = value;
                            break;

                        case "FORMAT":
                            format = value;
                            break;

                        case "TEXT":
                            text = value;
                            break;

                        case "WIDTH":
                            width = int.Parse(value);
                            break;

                        case "VISIBLE":
                            visible = bool.Parse(value);
                            break;

                        default :
                            throw new FormatException(string.Format("not find key '{0}'", kv[0]));
                    }
                }
                else
                {
                    throw new FormatException(item);
                }
            }
            // dataPropertyName=adfa; b=aaa; c=fdfkdfj;
            DGVColumnConfig r = new DGVColumnConfig(dataPropertyName, format, text);
            r.Width = width;
            r.Visible = visible;
            return r;
        }
예제 #3
0
        static public DGVColumnConfigCollection Create(string[] lines)
        {
            DGVColumnConfigCollection r = new DGVColumnConfigCollection();

            foreach (string line in lines)
            {
                DGVColumnConfig item = Create(line);
                r.Add(item);
            }
            return(r);
        }
예제 #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static Xdgk.Common.DGVColumnConfigCollection GetFlowDgvColumnConfigs()
        {
            if (_flowDgvColumnConfigs == null)
            {
                _flowDgvColumnConfigs = new DGVColumnConfigCollection();
                //_flowDgvColumnConfigs.Add ( new DGVColumnConfig(

                DGVColumnConfig[] configArray = new DGVColumnConfig[]{
                    new DGVColumnConfig("ItName", "", Strings.ItName),
                    new DGVColumnConfig("ItAddress", "", Strings.ItAddress),
                    new DGVColumnConfig("ItPhone", "", Strings.ItPhone),
                    //new DGVColumnConfig("ItRemark", "", Strings.ItRemark),
                    new DGVColumnConfig("MtPoseDT", "", Strings.MtPoseDT),
                    //new DGVColumnConfig("CreateDT", "", Strings.CreateDT),
                    new DGVColumnConfig("MtBeginDT", "", Strings.MtBeginDT),
                    new DGVColumnConfig("MtTimeoutDT", "", Strings.MtTimeoutDT),
                    new DGVColumnConfig("MtLocation", "", Strings.MtLocation),
                    new DGVColumnConfig("MtContent", "", Strings.MtContent),
                    //new DGVColumnConfig("MtRemark", "", Strings.MtRemark),
                    new DGVColumnConfig("MtLevel", "", Strings.MtLevel),
                    new DGVColumnConfig("MtOperatorName", "", Strings.MtOperatorName),
                    new DGVColumnConfig("RcDT", "", Strings.RcDT),
                    new DGVColumnConfig("RcOperatorName", "", Strings.RcOperatorName),
                    new DGVColumnConfig("RpContent", "", Strings.RpContent),
                    //new DGVColumnConfig("RpRemark", "", Strings.RpRemark),
                    new DGVColumnConfig("RpEndDT", "", Strings.RpEndDT),
                    new DGVColumnConfig("RpWorker", "", Strings.RpWorker),
                    new DGVColumnConfig("FlStatus", "", Strings.FlStatus),
                    //new DGVColumnConfig("TblFlow", "", Strings.TblFlow),
                                    };

                foreach (DGVColumnConfig item in configArray)
                {
                    _flowDgvColumnConfigs.Add(item);
                }
            }
            return _flowDgvColumnConfigs;
        }
예제 #5
0
        static public DGVColumnConfig Create(string line)
        {
            string dataPropertyName = string.Empty;
            string format           = string.Empty;
            string text             = string.Empty;
            int    width            = 100;
            bool   visible          = true;

            string[] items = line.Split(';');
            foreach (string item in items)
            {
                if (item.Trim().Length == 0)
                {
                    continue;
                }

                string[] kv = item.Split('=');

                if (kv.Length == 2)
                {
                    string key   = kv[0].Trim().ToUpper();
                    string value = kv[1].Trim();

                    switch (key)
                    {
                    case "DATAPROPERTYNAME":
                        dataPropertyName = value;
                        break;

                    case "FORMAT":
                        format = value;
                        break;

                    case "TEXT":
                        text = value;
                        break;

                    case "WIDTH":
                        width = int.Parse(value);
                        break;

                    case "VISIBLE":
                        visible = bool.Parse(value);
                        break;

                    default:
                        throw new FormatException(string.Format("not find key '{0}'", kv[0]));
                    }
                }
                else
                {
                    throw new FormatException(item);
                }
            }
            // dataPropertyName=adfa; b=aaa; c=fdfkdfj;
            DGVColumnConfig r = new DGVColumnConfig(dataPropertyName, format, text);

            r.Width   = width;
            r.Visible = visible;
            return(r);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static DGVColumnConfigCollection CreateFromXml(string path)
        {
            DGVColumnConfigCollection r = new DGVColumnConfigCollection();

            XmlDocument doc = new XmlDocument();
            doc.Load(path);
            XmlNode root = doc.SelectSingleNode("columns");
            foreach (XmlNode node in root.SelectNodes("column"))
            {
                string dataPropertyName= XmlHelper.GetAttribute(node, "dataPropertyName", false);
                string text = XmlHelper.GetAttribute(node, "text", false);
                string format = XmlHelper.GetAttribute(node, "format", true);
                string strWidth = XmlHelper.GetAttribute(node, "width", true);

                int width = 100 ;
                if ( !string.IsNullOrEmpty (strWidth ))
                {
                    width = int.Parse ( strWidth );
                }
                DGVColumnConfig item = new DGVColumnConfig(
                    dataPropertyName, format, text);
                item.Width = width;
                r.Add(item);
            }

            return r;
        }