Exemple #1
0
        /// <summary>
        /// 将修改的值保存到Service.Sdsite.DesignDataDocument.ProductPropGroupEle
        /// </summary>
        /// <param name="form"></param>
        /// <param name="id"></param>
        private void ShowPanel(ProductPropertyForm form, string id)
        {
            XmlElement groupItem;

            if (string.IsNullOrEmpty(id))
            {
                string groupId = Utility.Guid.NewGuid();
                groupItem = Service.Sdsite.DesignDataDocument.ProductPropGroupEle.OwnerDocument.CreateElement("GroupItem");
                Service.Sdsite.DesignDataDocument.ProductPropGroupEle.AppendChild(groupItem);
                groupItem.SetAttribute("groupId", groupId);
                groupItem.SetAttribute("isUsed", false.ToString());
                groupItem.SetAttribute("groupName", form.GroupName);
                List <KeyValuePair <string, string> > _list = new List <KeyValuePair <string, string> >();
                foreach (KeyValuePair <string, bool> item in form.productList)
                {
                    XmlElement itemEle = Service.Sdsite.DesignDataDocument.ProductPropGroupEle.OwnerDocument.CreateElement("item");
                    itemEle.SetAttribute("name", item.Key);
                    itemEle.SetAttribute("isUserAdd", item.Value.ToString());
                    groupItem.AppendChild(itemEle);
                    KeyValuePair <string, string> key = new KeyValuePair <string, string>(item.Key, "");
                    _list.Add(key);
                }
                dic.Add(groupId, _list);
                AddProuctNameList(groupId);
            }
            else
            {
                SaveList(id);
                XmlNode groupNode = Service.Sdsite.DesignDataDocument.ProductPropGroupEle.SelectSingleNode("//GroupItem[@groupId='" + id + "']");
                groupNode.RemoveAll();
                groupItem = (XmlElement)groupNode;
                groupItem.SetAttribute("groupId", id);
                groupItem.SetAttribute("isUsed", true.ToString());
                groupItem.SetAttribute("groupName", form.GroupName);

                List <KeyValuePair <string, string> > _list = new List <KeyValuePair <string, string> >();

                foreach (KeyValuePair <string, bool> item in form.productList)
                {
                    XmlElement itemEle = Service.Sdsite.DesignDataDocument.ProductPropGroupEle.OwnerDocument.CreateElement("item");
                    itemEle.SetAttribute("name", item.Key);
                    itemEle.SetAttribute("isUserAdd", item.Value.ToString());
                    groupItem.AppendChild(itemEle);

                    string value = GetValue(dic[id], item.Key);
                    KeyValuePair <string, string> vp = new KeyValuePair <string, string>(item.Key, value);
                    _list.Add(vp);
                }
                dic[id] = _list;
                ShowPropertyNameValue(dic[id]);
            }
        }
Exemple #2
0
        private void btnAddProp_Click(object sender, EventArgs e)
        {
            ProductPropertyForm form = new ProductPropertyForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                IsAdd             = true;
                _productGroupName = this.conProductProp.Text;
                ShowPanel(form, "");
                Service.Sdsite.DesignDataDocument.Save();
                if (Changed != null)
                {
                    Changed(null, EventArgs.Empty);
                }
                OnCheckChanged(EventArgs.Empty);
            }
        }
Exemple #3
0
        private void btnModifyProp_Click(object sender, EventArgs e)
        {
            XmlNode node = Service.Sdsite.DesignDataDocument.ProductPropGroupEle.SelectSingleNode("//GroupItem[@groupName='" + this.conProductProp.Text + "']");

            if (node != null && node is XmlElement)
            {
                XmlElement          groupEle = (XmlElement)node;
                ProductPropertyForm form     = new ProductPropertyForm(groupEle);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    _productGroupName = form.GroupName;
                    ShowPanel(form, groupEle.GetAttribute("groupId"));
                    Service.Sdsite.DesignDataDocument.Save();
                    if (Changed != null)
                    {
                        Changed(null, EventArgs.Empty);
                    }
                    OnCheckChanged(EventArgs.Empty);
                }
            }
        }