Beispiel #1
0
        /// <summary>
        /// 更新按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void b_Update_Click(object sender, EventArgs e)
        {
            scModel = ViewState["scModel"] as SCModel;

            SCLink scLinkUpdate = new SCLink();

            scLinkUpdate.LinkID      = tb_LinkID.Text.Trim();
            scLinkUpdate.Description = tb_Description.Text.Trim();
            scLinkUpdate.Order       = tb_Order.Text.Trim();
            scLinkUpdate.TopicLink   = tb_TopicLink.Text.Trim();
            scLinkUpdate.NextLinks   = scLinkUpdate.ChangeToTopicLinkList();//变成list,以便生成xml

            List <SCLink> scLinks     = scModel.SCLinks;
            int           updateindex = Convert.ToInt32(lb_UpdateIndex.Text);

            scModel.SCLinks[updateindex] = scLinkUpdate;//用的新的Link覆盖原有Link
            //for (int i = 0; i < scLinks.Count; i++)
            //{
            //    if (scLinks[i].LinkID == scLinkUpdate.LinkID)
            //    {
            //        scModel.SCLinks[i] = scLinkUpdate;     //用的新的Link覆盖原有Link
            //        break;
            //    }
            //}

            //绑定girview
            gvItem.DataSource = scModel.SCLinks;
            gvItem.DataBind();

            //变为增加,true,增加按钮设置为Enable,修改按钮设置为Disable,保存按钮设置为Enable
            ChangeUpdateToAdd(true);

            //重置Link //从隐藏的label中取出linkID
            ResetLinkTB(lb_hide_linkid.Text);
        }
Beispiel #2
0
        /// <summary>
        /// 增加按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void b_Add_Click(object sender, EventArgs e)
        {
            lb_LinkExist.Visible = false;

            scModel = ViewState["scModel"] as SCModel;

            if (scModel.SCLinks == null)
            {
                scModel.SCLinks = new List <SCLink>();
            }

            SCLink scLink = new SCLink();

            scLink.LinkID      = tb_LinkID.Text.Trim();
            scLink.Description = tb_Description.Text.Trim();
            scLink.Order       = tb_Order.Text;                  //命令行没有进行Trim处理,因为命令中就可能存在空格
            scLink.TopicLink   = tb_TopicLink.Text.Trim();
            scLink.NextLinks   = scLink.ChangeToTopicLinkList(); //变成list,以便生成xml
            scModel.SCLinks.Add(scLink);

            //绑定gridview数据源
            gvItem.DataSource = scModel.SCLinks;
            gvItem.DataBind();

            //修改隐藏label,+1,以便赋值linkID
            lb_hide_linkid.Text = (Convert.ToDouble(lb_hide_linkid.Text.Trim()) + 1).ToString();
            //重置link系列TextBox,为“”
            ResetLinkTB(lb_hide_linkid.Text);

            if (lb_hide_linkid.Text.Substring(7, 3) != "000")
            {
                b_Save.Enabled = true;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 数据库信息提取
        /// </summary>
        /// <param name="code">code</param>
        /// <param name="business_id">业务id</param>
        protected void GetSCDetail(string code, string business_id)
        {
            //SCModel scModel = new SCModel();
            SCDB      odb             = new SCDB();
            DataTable dt_businesstype = new DataTable();

            dt_businesstype = odb.GetBTNameByBusinessCode(code);

            DataTable dt_business = new DataTable();

            dt_business = odb.GetSCDetailByBusinessCode(code, business_id);

            if (dt_business != null && dt_business.Rows.Count == 1)
            {
                ServiceInfo si = new ServiceInfo();
                si.GetServiceInfoFromDT(dt_business);
                si.ServiceTypeName     = dt_businesstype.Rows[0][1].ToString();
                scModel.ServiceInfo    = si;
                scModel.DataSourceType = dt_business.Rows[0][3].ToString();
                if (scModel.DataSourceType == "0")
                {
                    DataSourceCollection dsc = new DataSourceCollection();
                    dsc.GetDataSourceFromDT(dt_business);
                    scModel.DataSource     = dsc;
                    scModel.DataSourceName = "采集";
                }
                else if (scModel.DataSourceType == "1")
                {
                    DataSourceNotify dsn = new DataSourceNotify();
                    dsn.GetDataSourceFromDT(dt_business);
                    scModel.DataSource     = dsn;
                    scModel.DataSourceName = "监控";
                }
                else
                {
                    DataSourceOuter dso = new DataSourceOuter();
                    dso.GetDataSourceFromDT(dt_business);
                    scModel.DataSource     = dso;
                    scModel.DataSourceName = "外部";
                }
            }

            DataTable dt_links = new DataTable();

            dt_links = odb.GetSCLinksByServiceID(code, business_id);

            List <SCLink> scList = new List <SCLink>();

            for (int i = 0; i < dt_links.Rows.Count; i++)
            {
                SCLink scLink = new SCLink();
                scLink.LinkID      = dt_links.Rows[i][0].ToString();
                scLink.Description = dt_links.Rows[i][1].ToString();
                scLink.Order       = dt_links.Rows[i][2].ToString();
                scLink.TopicLink   = dt_links.Rows[i][3].ToString();
                scLink.NextLinks   = scLink.ChangeToTopicLinkList(); //变成list,以便生成xml
                scList.Add(scLink);
            }
            scModel.SCLinks = scList;

            //return scModel;
        }