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
        public object Options([FromBody] SCModel model)
        {
            Service_SetInternalLogin_C ServiceSetInternalLoginC = Service_SetInternalLogin_C.CreateBuilder()
                                                                  .SetBOpen(model.Static)
                                                                  .Build();


            Bind tbind = Cmd.runClient(new Bind(ServiceCmd.SC_SET_INTERALLOGIN, ServiceSetInternalLoginC.ToByteArray()));

            switch ((CenterCmd)tbind.header.CommandID)
            {
            case CenterCmd.CS_SET_INTERALLOGIN:

                //Service_SetInternalLogin_S ServiceSetInternalLoginS = Service_SetInternalLogin_S.ParseFrom(tbind.body.ToBytes());


                //if (ServiceSetInternalLoginS.IsOpen)
                //{
                //    return new { result = 0 };
                //}
                //return new { result = 1 };
                return(new { result = 0 });

            case CenterCmd.CS_CONNECT_ERROR:
                return(new { result = 2 });
            }

            return(new { result = 1 });
        }
Beispiel #3
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 #4
0
 public HttpResponseMessage GetModels(ModelSearchVM search)
 {
     return(this.ExecuteTryCatch(() =>
     {
         SCModel m = new SCModel();
         search.Localization = GetCurUSerLocalization();
         return m.Getlist(search);
     }));
 }
Beispiel #5
0
 void timer1_Elapsed1(object sender, ElapsedEventArgs e)
 {
     timer1.Stop();
     SCModel.Add(SCModel[0]);
     SCModel.RemoveAt(0);
     if (ImageUrlChanage != null)
     {
         ImageUrlChanage(this, new EventArgs());
     }
     timer1.Start();
 }
Beispiel #6
0
 protected void rbl_ops_SelectedIndexChanged(object sender, EventArgs e)
 {
     lb_updatesuccess.Text = "";
     scModel = ViewState["scModel"] as SCModel;
     if (scModel != null && scModel.ServiceInfo != null)
     {
         FillWebPanel(rbl_ops.SelectedValue);
         EnableTextBox(rbl_ops.SelectedValue);
         VisibleGridViewOpt(rbl_ops.SelectedValue);
     }
 }
Beispiel #7
0
        /// <summary>
        /// 填充页面
        /// 空,没用对象填充
        /// 有值,查看
        /// 有值,修改
        /// </summary>
        /// <param name="flag"></param>
        protected void FillWebPanel(string flag)
        {
            scModel = ViewState["scModel"] as SCModel;

            switch (flag)
            {
            //空,没用对象填充
            case "-1":
                //p_opt.Visible = false;
                p_info.Visible     = false;
                p_LinkList.Visible = false;
                p_Link.Visible     = false;
                p_Button.Visible   = false;
                break;

            //有值,查看
            case "0":
                //p_opt.Visible = true;
                p_info.Visible     = true;
                p_LinkList.Visible = true;
                p_Link.Visible     = false;
                p_Button.Visible   = false;
                break;

            //有值,修改
            case "1":
                //p_opt.Visible = true;
                p_info.Visible   = true;
                p_Button.Visible = true;
                //外部
                if (scModel.DataSourceType == "2")
                {
                    p_Link.Visible     = false;
                    p_LinkList.Visible = false;
                    b_Save.Enabled     = true;
                    b_Add.Enabled      = false;
                    b_Update.Enabled   = false;
                }
                //非外部(采集和监控)
                else
                {
                    p_LinkList.Visible = true;
                    p_Link.Visible     = true;
                    b_Save.Enabled     = true;
                    b_Add.Enabled      = true;
                }
                break;
            }
        }
Beispiel #8
0
        /// <summary>
        /// 删除某一个Link
        /// 自动修正其他Link的ID顺序
        /// 修改隐藏label,+1,以便赋值linkID
        /// //绑定gridview
        /// //重置link系列TextBox,为“”
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvItem_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            scModel = ViewState["scModel"] as SCModel;

            string linkid = gvItem.DataKeys[e.RowIndex].Value.ToString();

            if (linkid.Substring(7, 3) == "000")
            {
                return;
            }
            else
            {
                List <SCLink> scLinks = scModel.SCLinks;

                //从对象中删除Link
                int linkid_1 = 0;
                for (int i = 0; i < scLinks.Count; i++)
                {
                    if (scLinks[i].LinkID == linkid)
                    {
                        scModel.SCLinks.Remove(scLinks[i]);
                        linkid_1 = i;
                        break;
                    }
                }

                //自动修正其他Link的ID顺序
                for (int i = 0; i < scLinks.Count; i++)
                {
                    if (i >= linkid_1)
                    {
                        scLinks[i].LinkID = (Convert.ToDouble(scLinks[i].LinkID) - 1).ToString();
                    }
                }

                //修改隐藏label,+1,以便赋值linkID
                lb_hide_linkid.Text = (Convert.ToDouble(lb_hide_linkid.Text) - 1).ToString();

                ////重置link系列TextBox,为“”
                ResetLinkTB(lb_hide_linkid.Text);

                //绑定gridview
                gvItem.DataSource = scModel.SCLinks;
                gvItem.DataBind();
            }
        }
Beispiel #9
0
        // POST: api/FM
        public object Post([FromBody] SCModel model)
        {
            Service_Send_CloseServer ServiceSendCloseServer = Service_Send_CloseServer.CreateBuilder()
                                                              .SetClose(model.Static)
                                                              .Build();


            Bind tbind = Cmd.runClient(new Bind(ServiceCmd.SC_SERVER_STOP, ServiceSendCloseServer.ToByteArray()));

            switch ((CenterCmd)tbind.header.CommandID)
            {
            case CenterCmd.CS_SERVER_STOP:
                return(new { result = 0 });

            case CenterCmd.CS_CONNECT_ERROR:
                return(new { result = 2 });
            }

            return(new { result = 1 });
        }
Beispiel #10
0
        public ActionResult AddSC(SCModel obj)
        {
            string inserted = "";

            //SCModel obj = new SCModel { StudentId = studnetId, CourseId = CourseId };
            DBAdpter.StudentCourse objsc = new DBAdpter.StudentCourse();
            var alreadyAvail             = objsc.CheckStudentcourse(obj);

            if (alreadyAvail)
            {
                inserted = "already";
            }
            int i = objsc.AddStudentCourse(obj);

            if (i > 0)
            {
                inserted = "added";
            }
            return(Json(inserted));
        }
Beispiel #11
0
        /// <summary>
        /// 选择某一个link环节,进行修改操作
        /// 将信息填充至Link环节的各个TextBox中
        /// 增加按钮设置为Disable,修改按钮设置为Enable,保存按钮设置为Disable
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvItem_SelectedIndexChanged(object sender, EventArgs e)
        {
            scModel = ViewState["scModel"] as SCModel;

            //将信息填充至Link环节的各个TextBox中
            int    index  = gvItem.SelectedIndex;
            string linkid = gvItem.SelectedDataKey.Values["LinkID"].ToString();

            List <SCLink> scLinks = scModel.SCLinks;

            int scLinkIndex = 0;

            foreach (SCLink scLink in scLinks)
            {
                if (scLink.LinkID == linkid)
                {
                    tb_LinkID.Text      = scLink.LinkID;
                    tb_Description.Text = scLink.Description;
                    tb_Order.Text       = scLink.Order;
                    tb_TopicLink.Text   = scLink.TopicLink;

                    break;
                }
                scLinkIndex++;
            }

            lb_UpdateIndex.Text = scLinkIndex.ToString();

            if (linkid.EndsWith("000"))
            {
                tb_LinkID.Enabled = false;
            }
            else
            {
                tb_LinkID.Enabled = true;
            }


            //增加按钮设置为Disable,修改按钮设置为Enable,保存按钮设置为Disable
            ChangeUpdateToAdd(false);
        }
Beispiel #12
0
        /// <summary>
        /// 删除事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvItem_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            scModel = ViewState["scModel"] as SCModel;

            string linkid = gvItem.DataKeys[e.RowIndex].Value.ToString();

            if (linkid.Substring(7, 3) == "000")
            {
                return;
            }
            else
            {
                List <SCLink> scLinks = scModel.SCLinks;

                int linkid_1 = 0;
                for (int i = 0; i < scLinks.Count; i++)
                {
                    if (scLinks[i].LinkID == linkid)
                    {
                        scModel.SCLinks.Remove(scLinks[i]);
                        linkid_1 = i;
                        break;
                    }
                }

                for (int i = 0; i < scLinks.Count; i++)
                {
                    if (i >= linkid_1)
                    {
                        scLinks[i].LinkID = (Convert.ToDouble(scLinks[i].LinkID) - 1).ToString();
                    }
                }

                lb_hide_linkid.Text = (Convert.ToDouble(lb_hide_linkid.Text) - 1).ToString();
                //resetLinkTB();

                gvItem.DataSource = scModel.SCLinks;
                gvItem.DataBind();
            }
        }
Beispiel #13
0
        protected void b_upload_Click(object sender, EventArgs e)
        {
            if (fu_serviceconfig.FileName != "")
            {
                int index = fu_serviceconfig.FileName.LastIndexOf('.');

                if (fu_serviceconfig.FileName.Substring(0, index) == lb_BID.Text)
                {
                    fu_serviceconfig.SaveAs(xml_BusinessConfig_Path + fu_serviceconfig.FileName);
                    SCXML   scXML   = new SCXML();
                    SCModel scModel = scXML.GetSCModel(xml_BusinessConfig_Path, fu_serviceconfig.FileName);
                    bool    dbsave  = false;
                    SCDB    scDB    = new SCDB();
                    //采集数据
                    if (scModel.DataSourceType == "0")
                    {
                        User user = new Class.User();
                        dbsave = scDB.InsertSCCollectionModel(scModel, user);
                    }
                    //监控数据
                    else
                    {
                        dbsave = scDB.InsertSCNotifyModel(scModel, user);
                    }
                    if (dbsave)
                    {
                        Label1.Text = "上传成功!";
                    }
                }
                else
                {
                    Label1.Text = "文件名须与业务ID一致!";
                }
            }
            else
            {
                Label1.Text = "请选择需上传的业务配置文件!";
            }
        }
Beispiel #14
0
        /// <summary>
        /// 保存按钮
        /// 真正与数据库进行交互
        /// 保存至数据库,事务提交,更改两个表,业务表和环节表
        /// 生成XML
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void b_Save_Click(object sender, EventArgs e)
        {
            try
            {
                scModel = ViewState["scModel"] as SCModel;
                bool dbsave = false;



                //采集数据
                if (scModel.DataSourceType == "0")
                {
                    SCCollectionXML sccxml = new SCCollectionXML();
                    sccxml.CreateXML(scModel, xml_BusinessConfig_Path);// "d:/template/"

                    SCDB scDB = new SCDB();
                    dbsave = scDB.InsertSCCollectionModel(scModel, user);
                }
                //监控数据
                else if (scModel.DataSourceType == "1")
                {
                    SCNotifyXML scnxml = new SCNotifyXML();
                    scnxml.CreateXML(scModel, xml_BusinessConfig_Path); // "d:/template/"

                    SCDB scDB = new SCDB();
                    dbsave = scDB.InsertSCNotifyModel(scModel, user);
                }
                //外部数据
                else
                {
                    SCOuterXML scoxml = new SCOuterXML();
                    scoxml.CreateXML(scModel, xml_BusinessConfig_Path); // "d:/template/"

                    SCDB scDB = new SCDB();
                    dbsave = scDB.InsertSCOuterModel(scModel, user);
                }

                //判断是否成功,跳转页面
                string filesave = xml_BusinessConfig_Path + scModel.ServiceInfo.ServiceID + ".xml";
                if (dbsave && File.Exists(filesave))
                {
                    Response.Write("<script language=javascript>alert('业务保存成功!');window.location='/ServiceConfig/SCAdd.aspx'</script>");
                }
                else
                {
                    Response.Write("<script language=javascript>alert('业务保存失败!');window.location='/ServiceConfig/SCAdd.aspx'</script>");
                }

                //Cache.Remove("businessid");

                //Response.Redirect("/ServiceConfig/SCAdd.aspx");
                ////Disable Link 环节
                //EnabledLinkTB(false);
                //ResetLinkTB("");
                ////Enable ServiceInfo和DataSource 环节
                //EnabledSITB(true);
            }
            catch (Exception ex)
            {
                Server.Transfer("/Error.aspx");
                Server.ClearError();
            }
        }
Beispiel #15
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 = "业务更新失败!";
            }
        }
Beispiel #16
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);
            }
        }