Exemplo n.º 1
0
        public ActionResult JobCommandCtrl(FormCollection form)
        {
            JsonReturnMessages data = new JsonReturnMessages()
            {
                IsSuccess = true, Msg = ""
            };
            string s1     = form["JosType"];
            string s2     = form["ComdArgs"];
            string spd_id = form["pd_id"];
            int    pd_id  = 0;

            if (!String.IsNullOrEmpty(spd_id))
            {
                pd_id = int.Parse(spd_id);
            }
            SMC_PushDll dll = BoFactory.GetSMC_PushDllBO.Get(pd_id);

            s2 = dll.pd_xml_filename + ".xml" + s2;
            string rtv = "";

            if (s1 == "AddJobPluginGroup")
            {
                TransferFile(dll);
            }
            if (s1 != "" && s2 != "")
            {
                try
                {
                    CommandSvcClient cmdClient = new CommandSvcClient();

                    rtv = cmdClient.ExecCommand(s1, s2);

                    if (rtv == "文件名参数不正确,请重试!")
                    {
                        data.IsSuccess = false;
                        data.Msg       = rtv;
                    }
                    cmdClient.Close();
                }
                catch (Exception e)
                {
                    data.IsSuccess = false;
                    data.Msg       = e.Message;
                }
                if (data.IsSuccess)
                {
                    data.Msg = rtv;
                }

                changeDllStatus(dll, s1, data.IsSuccess);
            }
            else
            {
                data.Msg = "请选择任务类型和输入参数文件名!";
            }


            return(Json(data));
        }
        public ActionResult JobCommandCtrl(FormCollection form)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "" };
            string s1 = form["JosType"];
            string s2 = form["ComdArgs"];
            string spd_id = form["pd_id"];
            int pd_id = 0;
            if (!String.IsNullOrEmpty(spd_id)) {
                pd_id = int.Parse(spd_id);
            }
            SMC_PushDll dll = BoFactory.GetSMC_PushDllBO.Get(pd_id);
            s2 = dll.pd_xml_filename + ".xml" + s2;
            string rtv = "";

            if (s1 == "AddJobPluginGroup")
            {
                TransferFile(dll);
            }
            if (s1 != "" && s2 != "")
            {
                try
                {
                    CommandSvcClient cmdClient = new CommandSvcClient();

                    rtv = cmdClient.ExecCommand(s1, s2);

                    if (rtv == "文件名参数不正确,请重试!")
                    {
                        data.IsSuccess = false;
                        data.Msg = rtv;
                    }
                    cmdClient.Close();
                }
                catch (Exception e)
                {
                    data.IsSuccess = false;
                    data.Msg = e.Message;
                }
                if (data.IsSuccess)
                {
                    data.Msg = rtv;
                }

                changeDllStatus(dll, s1, data.IsSuccess);
            }
            else
            {
                data.Msg = "请选择任务类型和输入参数文件名!";
            }

            return Json(data);
        }