Exemplo n.º 1
0
        /// <summary>
        /// 将除Link以外的信息保存至变量scModel中,包括ServiceInfo,和DataSource
        /// 初始化LinkID TextBox,将要显示的ID存于隐藏label中
        /// scModel 存入ViewState
        /// Enable Link 环节
        /// Disable ServiceInfo和DataSource 环节
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void b_SaveName_Click(object sender, EventArgs e)
        {
            ServiceInfo si = new ServiceInfo();

            si.ServiceName = tb_ServiceName.Text.Trim();
            si.ServiceID   = lb_BID.Text.Trim();
            si.ServiceType = ddl_SCType.SelectedValue;
            //上游业务ID
            si.SourceID = tb_SourceID.Text.Trim();
            //所属业务群
            string servicegroup = "";
            string sort         = "";

            for (int i = 0; i < chkblServiceGroup.Items.Count; i++)
            {
                if (chkblServiceGroup.Items[i].Selected)
                {
                    sort = i.ToString();
                    if (i < 10)
                    {
                        sort = "0" + sort;
                    }
                    servicegroup = servicegroup + sort + ",";
                }
            }
            if (servicegroup.Length > 0)
            {
                servicegroup = servicegroup.Substring(0, servicegroup.LastIndexOf(','));
            }
            si.ServiceGroup     = servicegroup;
            scModel.ServiceInfo = si;

            //采集类数据源
            if (ddl_Data_Type.SelectedValue == "0")
            {
                scModel.DataSourceType = ddl_Data_Type.SelectedValue;
                DataSourceCollection dsc = new DataSourceCollection();
                //dsc.DataSourceType = ddl_Data_Type.SelectedValue;  //采集,则存0
                dsc.CollectionDescription = tb_DataSourceDescription.Text.Trim();
                dsc.StartTimeValue        = tb_Des_1.Text.Trim();
                dsc.PeriodValue           = tb_Des_2.Text.Trim();
                dsc.StartTimeDescription  = s_StartTime_Tip;   //"hh:mm:ss";
                dsc.PeriodDescription     = s_PeriodTime_Tip;  // "second,0s means just once";
                scModel.DataSource        = dsc;
            }
            //监控类数据源
            else if (ddl_Data_Type.SelectedValue == "1")
            {
                scModel.DataSourceType = ddl_Data_Type.SelectedValue;
                DataSourceNotify dsn = new DataSourceNotify();
                //dsn.DataSourceType = ddl_Data_Type.SelectedValue;//监控,则存1
                dsn.NotifyDescription = tb_DataSourceDescription.Text.Trim();
                dsn.PathsValue        = tb_Des_1.Text.Trim();
                dsn.FilesValue        = tb_Des_2.Text.Trim();
                dsn.PathDescription   = s_FileDir_Tip;  //"要监控的文件目录";
                dsn.FilesDescription  = s_File_Tip;     // "需要的数据源文件,可用${yyyyMMddHH}时间通配符";

                //20160308 syy 增加多目录,多文件,用;隔开,有空,用null表示;
                dsn.GetPathFileMateFromString(dsn.PathsValue, dsn.FilesValue, dsn.PathDescription, dsn.FilesDescription); //20160308 syy

                //上游业务ID和所属业务群


                scModel.DataSource = dsn;
            }
            //外部类数据源
            else if (ddl_Data_Type.SelectedValue == "2")
            {
                scModel.DataSourceType = ddl_Data_Type.SelectedValue;
                DataSourceOuter dso = new DataSourceOuter();
                //dsn.DataSourceType = ddl_Data_Type.SelectedValue;//监控,则存1
                dso.OuterDescription = tb_DataSourceDescription.Text.Trim();
                dso.OuterPathValue   = tb_Des_1.Text.Trim();
                dso.OuterFileValue   = tb_Des_2.Text.Trim();
                dso.OuterPathDes     = s_FileDir_Tip; //"要监控的文件目录";
                dso.OuterFileDes     = s_File_Tip;    // "需要的数据源文件,可用${yyyyMMddHH}时间通配符";

                //20160308 syy 增加多目录,多文件,用;隔开,有空,用null表示;
                //dso.GetPathFileMateFromString(dso.PathsValue, dso.FilesValue, dso.PathDescription, dso.FilesDescription); //20160308 syy

                scModel.DataSource = dso;
            }

            ViewState["scModel"] = scModel; // scModel 存入ViewState

            //初始化LinkID TextBox,将要显示的ID存于隐藏label中s
            lb_hide_linkid.Text = (lb_BID.Text.Trim()) + "000";


            if (ddl_Data_Type.SelectedValue == "2")
            {
                b_Save.Enabled = true;
            }
            //Enable Link 环节
            else
            {
                EnabledLinkTB(true);
                b_Add.Enabled = true;
                ResetLinkTB(lb_hide_linkid.Text);
            }
            //Disable ServiceInfo和DataSource 环节
            EnabledSITB(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void b_Save_Click(object sender, EventArgs e)
        {
            scModel = ViewState["scModel"] as SCModel;


            ServiceInfo si = new ServiceInfo();

            si.ServiceName = tb_ServiceName.Text.Trim();
            si.ServiceID   = scModel.ServiceInfo.ServiceID;
            si.ServiceType = scModel.ServiceInfo.ServiceID.Substring(0, 2);
            //上游业务ID
            si.SourceID = tb_SourceID.Text.Trim();
            //所属业务群
            string servicegroup = "";
            string sort         = "";

            for (int i = 0; i < chkblServiceGroup.Items.Count; i++)
            {
                if (chkblServiceGroup.Items[i].Selected)
                {
                    sort = i.ToString();
                    if (i < 10)
                    {
                        sort = "0" + sort;
                    }
                    servicegroup = servicegroup + sort + ",";
                }
            }
            if (servicegroup.Length > 0)
            {
                servicegroup = servicegroup.Substring(0, servicegroup.LastIndexOf(','));
            }
            si.ServiceGroup     = servicegroup;
            scModel.ServiceInfo = si;

            //采集类数据源
            if (scModel.DataSourceType == "0")
            {
                //scModel.DataSourceType = scModel.DataSourceType;
                DataSourceCollection dsc = new DataSourceCollection();
                //dsc.DataSourceType = ddl_Data_Type.SelectedValue;  //采集,则存0
                dsc.CollectionDescription = tb_DataSourceDescription.Text.Trim();
                dsc.StartTimeValue        = tb_Des_1.Text.Trim();
                dsc.PeriodValue           = tb_Des_2.Text.Trim();
                dsc.StartTimeDescription  = s_StartTime_Tip;   //"hh:mm:ss";
                dsc.PeriodDescription     = s_PeriodTime_Tip;  // "second,0s means just once";
                scModel.DataSource        = dsc;
            }
            //监控类数据源
            else if (scModel.DataSourceType == "1")
            {
                //scModel.DataSourceType = scModel.DataSourceType;
                DataSourceNotify dsn = new DataSourceNotify();
                //dsn.DataSourceType = ddl_Data_Type.SelectedValue;//监控,则存1
                dsn.NotifyDescription = tb_DataSourceDescription.Text.Trim();
                dsn.PathsValue        = tb_Des_1.Text.Trim();
                dsn.FilesValue        = tb_Des_2.Text.Trim();
                dsn.PathDescription   = s_FileDir_Tip;  //"要监控的文件目录";
                dsn.FilesDescription  = s_File_Tip;     // "需要的数据源文件,可用${yyyyMMddHH}时间通配符";

                //20160308 syy 增加多目录,多文件,用;隔开,有空,用null表示;
                dsn.GetPathFileMateFromString(dsn.PathsValue, dsn.FilesValue, dsn.PathDescription, dsn.FilesDescription); //20160308 syy

                scModel.DataSource = dsn;
            }
            //外部类数据源
            else if (scModel.DataSourceType == "2")
            {
                DataSourceOuter dso = new DataSourceOuter();
                //dsn.DataSourceType = ddl_Data_Type.SelectedValue;//监控,则存1
                dso.OuterDescription = tb_DataSourceDescription.Text.Trim();
                dso.OuterPathValue   = tb_Des_1.Text.Trim();
                dso.OuterFileValue   = tb_Des_2.Text.Trim();
                dso.OuterPathDes     = s_FileDir_Tip; //"要监控的文件目录";
                dso.OuterFileDes     = s_File_Tip;    // "需要的数据源文件,可用${yyyyMMddHH}时间通配符";

                //20160308 syy 增加多目录,多文件,用;隔开,有空,用null表示;
                //dso.GetPathFileMateFromString(dso.PathsValue, dso.FilesValue, dso.PathDescription, dso.FilesDescription); //20160308 syy

                scModel.DataSource = dso;
            }

            bool dbsave = false;


            //采集数据
            if (scModel.DataSourceType == "0")
            {
                SCDB scDB = new SCDB();
                dbsave = scDB.UpdateSCCollectionModel(scModel, user);
                SCCollectionXML sccxml = new SCCollectionXML();
                sccxml.CreateXML(scModel, xml_BusinessConfig_Path);// "d:/template/"
            }
            //监控数据
            else if (scModel.DataSourceType == "1")
            {
                SCDB scDB = new SCDB();
                dbsave = scDB.UpdateSCNotifyModel(scModel, user);
                SCNotifyXML scnxml = new SCNotifyXML();
                scnxml.CreateXML(scModel, xml_BusinessConfig_Path); // "d:/template/"
            }
            //外部数据
            else if (scModel.DataSourceType == "2")
            {
                SCDB scDB = new SCDB();
                dbsave = scDB.UpdateSCOuterModel(scModel, user);
                SCOuterXML scnxml = new SCOuterXML();
                scnxml.CreateXML(scModel, xml_BusinessConfig_Path); // "d:/template/"
            }

            //判断是否成功,跳转页面
            string filesave = xml_BusinessConfig_Path + scModel.ServiceInfo.ServiceID + ".xml";

            if (dbsave && File.Exists(filesave))
            {
                lb_updatesuccess.Text = "业务更新成功!";
            }
            else
            {
                lb_updatesuccess.Text = "业务更新失败!";
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 填充页面
        /// </summary>
        /// <param name="scModel"></param>
        protected void FillWebPage(SCModel scModel)
        {
            if (scModel.ServiceInfo == null)
            {
                FillWebPanel("-1");
            }
            else
            {
                tb_Bid.Text         = scModel.ServiceInfo.ServiceID;
                lb_BType.Text       = scModel.ServiceInfo.ServiceTypeName;
                tb_ServiceName.Text = scModel.ServiceInfo.ServiceName;
                tb_SourceID.Text    = scModel.ServiceInfo.SourceID;
                //填充所属业务群
                //先取消所有选中项
                chkblServiceGroup.ClearSelection();
                //获取数据库中业务群信息
                string servicegroup = scModel.ServiceInfo.ServiceGroup;
                //若不为空,则进行填充
                if (servicegroup.Length > 0)
                {
                    string[] servicegroupsingle = servicegroup.Split(',');
                    for (int i = 0; i < servicegroupsingle.Length; i++)
                    {
                        if (servicegroupsingle[i].Substring(0, 1) == "0")
                        {
                            servicegroupsingle[i] = servicegroupsingle[i].Substring(1);
                        }
                        chkblServiceGroup.Items[int.Parse(servicegroupsingle[i])].Selected = true;
                    }
                }

                //数据源类型
                if (scModel.DataSourceType == "0")
                {
                    DataSourceCollection dsc = (DataSourceCollection)scModel.DataSource;
                    lb_datasource.Text            = scModel.DataSourceName;
                    tb_DataSourceDescription.Text = dsc.CollectionDescription;
                    tb_Des_1.Text = dsc.StartTimeValue;
                    tb_Des_2.Text = dsc.PeriodValue;
                    CreateCorN(scModel.DataSourceType);
                }
                //数据源类型
                else if (scModel.DataSourceType == "1")
                {
                    DataSourceNotify dsn = (DataSourceNotify)scModel.DataSource;
                    lb_datasource.Text            = scModel.DataSourceName;
                    tb_DataSourceDescription.Text = dsn.NotifyDescription;
                    tb_Des_1.Text = dsn.PathsValue;
                    tb_Des_2.Text = dsn.FilesValue;
                    CreateCorN(scModel.DataSourceType);
                }
                else
                {
                    DataSourceOuter dso = (DataSourceOuter)scModel.DataSource;
                    lb_datasource.Text            = scModel.DataSourceName;
                    tb_DataSourceDescription.Text = dso.OuterDescription;
                    tb_Des_1.Text = dso.OuterPathValue;
                    tb_Des_2.Text = dso.OuterFileValue;
                    CreateCorN(scModel.DataSourceType);
                }

                int link_count = scModel.SCLinks.Count;

                if (link_count != 0)
                {
                    tb_LinkID.Text = (Convert.ToDouble(scModel.SCLinks[link_count - 1].LinkID) + 1).ToString();
                }
                else
                {
                    tb_LinkID.Text = scModel.ServiceInfo.ServiceID + "000";
                }

                //tb_Description.Text = scModel.SCLinks[0].Description;
                //tb_Order.Text = scModel.SCLinks[0].Order;
                //tb_TopicLink.Text = scModel.SCLinks[0].TopicLink;
                tb_Description.Text = "";
                tb_Order.Text       = "";
                tb_TopicLink.Text   = "";
                gvItem.DataSource   = scModel.SCLinks;
                gvItem.DataBind();

                lb_hide_linkid.Text = tb_LinkID.Text;

                //FillOptByRole("0");


                FillWebPanel(rbl_ops.SelectedValue);
                EnableTextBox(rbl_ops.SelectedValue);
                VisibleGridViewOpt(rbl_ops.SelectedValue);
            }
        }