Exemplo n.º 1
0
 private void ShowDGVUrl_Attr()
 {
     try
     {
         dgvShowUrl_Attr.Rows.Clear();
         Sp_url_attr[] spUrl = new Sp_url_attrDAL().GetAllData(dgvShowUrl.SelectedRows[0].Cells["记录的唯一索引"].Value.ToString());
         for (int i = 0; i < spUrl.Length; i++)
         {
             int d = dgvShowUrl_Attr.Rows.Add();
             dgvShowUrl_Attr.Rows[d].Cells["编号Url_Attr"].Value = d;
             dgvShowUrl_Attr.Rows[d].Cells["归属URL的代码"].Value   = spUrl[i].UrlCode;
             dgvShowUrl_Attr.Rows[d].Cells["HTML标签"].Value     = spUrl[i].HtmlTag;
             dgvShowUrl_Attr.Rows[d].Cells["属性名"].Value        = spUrl[i].AttrName;
             dgvShowUrl_Attr.Rows[d].Cells["属性别名"].Value       = spUrl[i].Alias;
             if (spUrl[i].CalcWay == "00")
             {
                 dgvShowUrl_Attr.Rows[d].Cells["结果计算方式"].Value = "替换";
             }
             if (spUrl[i].CalcWay == "10")
             {
                 dgvShowUrl_Attr.Rows[d].Cells["结果计算方式"].Value = "前缀";
             }
             if (spUrl[i].CalcWay == "11")
             {
                 dgvShowUrl_Attr.Rows[d].Cells["结果计算方式"].Value = "后缀";
             }
             if (spUrl[i].CalcWay == "12")
             {
                 dgvShowUrl_Attr.Rows[d].Cells["结果计算方式"].Value = "静态字符(通过子属性绑定)";
             }
             if (spUrl[i].CalcWay == "99")
             {
                 dgvShowUrl_Attr.Rows[d].Cells["结果计算方式"].Value = "原字符";
             }
             dgvShowUrl_Attr.Rows[d].Cells["扩展信息"].Value     = spUrl[i].ExternStr;
             dgvShowUrl_Attr.Rows[d].Cells["子属性"].Value      = spUrl[i].SubAttr;
             dgvShowUrl_Attr.Rows[d].Cells["是否关联其他属性"].Value = spUrl[i].AttachAttr;
             dgvShowUrl_Attr.Rows[d].Cells["属性代码"].Value     = spUrl[i].Code;
             if (spUrl[i].IsUrl == 1)
             {
                 dgvShowUrl_Attr.Rows[d].Cells["属性对应值是否是链接"].Value = "是";
             }
             else
             {
                 dgvShowUrl_Attr.Rows[d].Cells["属性对应值是否是链接"].Value = "否";
             }
             dgvShowUrl_Attr.Rows[d].Cells["IdUrl_Attr"].Value = spUrl[i].Id;
         }
     }
     catch
     {
     }
 }
Exemplo n.º 2
0
        private void cbUrl_SelectedIndexChanged(object sender, EventArgs e)
        {
            Sp_url url = (Sp_url)cbUrl.SelectedItem;

            if (url == null)
            {
                return;
            }


            Sp_url_attr[] spUrl = new Sp_url_attrDAL().GetAllData(url.Code);
            tvAttr.Nodes.Clear();

            for (int i = 0; i < spUrl.Length; i++)
            {
                TreeNode node = new TreeNode(spUrl[i].ToString());
                node.Tag = spUrl[i];
                tvAttr.Nodes.Add(node);
            }
        }
Exemplo n.º 3
0
        private void btnCopyUrl_Click(object sender, EventArgs e)
        {
            if (dgvShowUrl.SelectedRows.Count <= 0)
            {
                MessageBox.Show("未选中目标URL,请先添加或选中一个");
                return;
            }
            CopyUrlWnd wnd = new CopyUrlWnd();

            wnd.UrlCode = dgvShowUrl.SelectedRows[0].Cells["记录的唯一索引"].Value.ToString();

            if (wnd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Dictionary <string, List <string> > result = wnd.Result;
                foreach (var key in result.Keys)
                {
                    // 有且只有一个
                    string        urlCode   = key.ToString();
                    List <string> attrCopys = result[key];

                    Sp_url_attr[]      spUrlAttrs = new Sp_url_attrDAL().GetAllData(urlCode);
                    List <Sp_url_attr> attrs      = spUrlAttrs.ToList();

                    for (int index = 0; index < attrs.Count; index++)
                    {
                        Sp_url_attr attr = attrs[index];

                        if (!attrCopys.Contains(attr.Code))
                        {
                            continue;
                        }
                        Console.WriteLine(attr.ToString());

                        cloneAndAdd(attr, wnd.UrlCode);
                    }

                    ShowDGVUrl_Attr();
                    MessageBox.Show("拷贝成功");
                }
            }
        }