Exemplo n.º 1
0
        protected virtual MyDictionary GetData(string label)
        {
            MyDictionary table = new MyDictionary();

            XYECOM.Business.Label le = new XYECOM.Business.Label();

            XYECOM.Model.LabelInfo el = null;

            if (!string.IsNullOrEmpty(label))
            {
                long labelId = XYECOM.Core.MyConvert.GetInt64(label);
                if (labelId > 0)
                {
                    el = le.GetItem(labelId);
                }
            }

            if (el != null)
            {
                if (el.LabelRange == XYECOM.Model.LabelRange.User)
                {
                    userid = XYECOM.Core.MyConvert.GetInt32(el.GroupIdOrUserId);
                }
                string content = el.LabelContent;

                content = content.Substring(1, content.Length - 2);

                string[] strayy = content.Split(new char[] { '┆' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (string str in strayy)
                {
                    string[] tmparr = str.Split(new char[] { '$' }, StringSplitOptions.None);
                    if (tmparr.Length == 2)
                    {
                        string s = tmparr[1];
                        if (s.Contains(@"\"))
                        {
                            s = s.Replace(@"\", @"\\");
                        }
                        //if(s==@"MM\dd")
                        //{
                        //    s = @"MM\\dd";
                        //}
                        table.Add(tmparr[0].ToUpper(), s);
                    }
                }
            }
            return table;
        }
Exemplo n.º 2
0
        private void LabelByType(int flag, String fieldpath)
        {
            int id = 0;
            XmlDocument docxml = new XmlDocument();
            DataTable dt = new DataTable();
            docxml.Load(fieldpath);

            XYECOM.Model.LabelTypeInfo ltinfo = new XYECOM.Model.LabelTypeInfo();

            XmlNodeList nodetypelist = docxml.GetElementsByTagName("typeitem");

            for (int i = 0; i < nodetypelist.Count; i++)
            {
                for (int j = 0; j < nodetypelist[i].ChildNodes.Count; j++)
                {
                    fieldname = nodetypelist[i].ChildNodes[j].Name;
                    if (fieldname.Equals("LT_ID"))
                    {
                        ltinfo.LT_ID = Convert.ToInt32(nodetypelist[i].ChildNodes[j].FirstChild.Value);
                    }
                    if (fieldname.Equals("LT_Name"))
                    {
                        ltinfo.LT_Name = nodetypelist[i].ChildNodes[j].FirstChild.Value;
                    }

                    if (fieldname.Equals("LT_Remark"))
                    {
                        ltinfo.LT_Remark = nodetypelist[i].ChildNodes[j].FirstChild.Value;
                    }
                }
                id = GetTypeID(ltinfo.LT_Name, ltinfo);
            }

            XYECOM.Business.Label label = new XYECOM.Business.Label();
            XYECOM.Model.LabelInfo info = new XYECOM.Model.LabelInfo();

            XmlNodeList nodelist = docxml.GetElementsByTagName("item");

            XmlElement ele = null;

            string nodeVlaue = "";

            for (int i = 0; i < nodelist.Count; i++)
            {
                for (int j = 1; j < nodelist[i].ChildNodes.Count; j++)
                {
                    fieldname = nodelist[i].ChildNodes[j].Name;

                    ele = (XmlElement)nodelist[i];

                    nodeVlaue = XYECOM.Core.XML.XMLUtil.GetNodeValue(ele, fieldname);

                    if (fieldname.Equals("L_Name"))
                    {
                        dt = XYECOM.Core.Data.SqlHelper.ExecuteTable("select * from b_label where L_Name = '" + nodeVlaue + "'");
                        if (dt.Rows.Count > 0)
                        {
                            info.Id = Convert.ToInt32(dt.Rows[0]["L_ID"].ToString());
                        }
                        else
                        {
                            info.Id = 0;
                        }
                        info.LabelName = nodeVlaue;
                    }
                    if (fieldname.Equals("L_CName"))
                    {
                        info.LabelCName = nodeVlaue;
                    }
                    if (fieldname.Equals("LT_ID"))
                    {
                        info.LabelTypeId = id;
                    }
                    if (fieldname.Equals("L_TableName"))
                    {
                        info.LabelTableName = nodeVlaue;
                    }
                    if (fieldname.Equals("L_Content"))
                    {
                        info.LabelContent = nodeVlaue;
                    }
                    if (fieldname.Equals("L_StyleHead"))
                    {
                        info.LabelStyleHead = nodeVlaue;
                    }
                    if (fieldname.Equals("L_StyleContent"))
                    {
                        info.LabelStyleContent = nodeVlaue;
                    }
                    if (fieldname.Equals("L_StyleFooter"))
                    {
                        info.LabelStyleFooter = nodeVlaue;
                    }
                }
                if (info.Id.Equals(0))
                {
                    label.Insert(info);
                    messagein += info.LabelCName + ",";
                }
                else
                {
                    if (flag.Equals(0))
                    {
                        label.Update(info);
                        messageupdata += info.LabelCName + ",";
                    }
                    if (flag.Equals(1))
                    {
                        messagereturn += info.LabelCName + ",";
                    }
                }
            }
            this.Label2.Text = "�����ǩ��" + messagein;
            this.Label3.Text = "���±�ǩ��" + messageupdata;
            this.Label4.Text = "������ǩ��" + messagereturn;
        }