示例#1
0
        public ActionResult Load()
        {
            HttpRequest  request = HttpContext.Current.Request;
            ActionResult result;

            try
            {
                string       value        = request.Form["Params"];
                dynamic      param        = JsonConvert.DeserializeObject(value);
                string       appDomainID  = param.ID;
                AddInService addInService = new AddInService();
                addInService.InitPath();
                List <Common.AddIn> addIn = addInService.GetAddIn();
                List <Common.AddIn> list  = new List <Common.AddIn>();
                foreach (Common.AddIn current in addIn)
                {
                    if (current.ID == Convert.ToInt32(appDomainID))
                    {
                        list.Add(current);
                    }
                }
                addInService.LoadAddIn(list);
                SqlHelper sqlHelper = new SqlHelper();
                sqlHelper.ExecuteNonQuery("update T_AddIn set F_Status = 1 where F_ID=" + appDomainID);
                result = this.Json(new
                {
                    errcode = 0,
                    errmsg  = "OK",
                    msgdoc  = string.Concat(new object[]
                    {
                        "http://",
                        request.Url.Host,
                        ":",
                        request.Url.Port,
                        "/AddInsDomain/help/doc"
                    })
                }, JsonRequestBehavior.DenyGet);
            }
            catch (Exception ex)
            {
                Log.log(ex.ToString());
                result = this.Json(new
                {
                    errcode = -1,
                    errmsg  = ex.Message,
                    msgdoc  = string.Concat(new object[]
                    {
                        "http://",
                        request.Url.Host,
                        ":",
                        request.Url.Port,
                        "/AddInsDomain/help/doc"
                    })
                }, JsonRequestBehavior.DenyGet);
            }
            return(result);
        }
示例#2
0
        protected void Application_Start(object sender, EventArgs e)
        {
            AddInService addInService = new AddInService();

            addInService.InitPath();
            List <AddInWebApp.Common.AddIn> addIn = addInService.GetAddIn();

            addInService.LoadAddIn(addIn);
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary.Add("addindomain", "AddInsDomain");
            dictionary.Add("controller", "AddInsService");
            dictionary.Add("action", "AddInDomains");
            dictionary.Add("id", null);
            dictionary.Add("namespaces", "AddInWebApp.Controllers");
            dictionary.Add("assembly", "AddInWebApp");
            RouteTable.Routes.Add("defaultRoute", new Route("{addindomain}/{controller}/{action}/{id}", dictionary, new AddInRouteHandler()));
        }
示例#3
0
        public ActionResult ReloadAll()
        {
            HttpRequest  request = HttpContext.Current.Request;
            ActionResult result;

            try
            {
                AddInService addInService = new AddInService();
                addInService.InitPath();
                List <Common.AddIn> addIn = addInService.GetAddIn();
                addInService.LoadAddIn(addIn);
                result = this.Json(new
                {
                    errcode = 0,
                    errmsg  = "OK",
                    msgdoc  = string.Concat(new object[]
                    {
                        "http://",
                        request.Url.Host,
                        ":",
                        request.Url.Port,
                        "/AddInsDomain/help/doc"
                    })
                }, JsonRequestBehavior.DenyGet);
            }
            catch (Exception ex)
            {
                Log.log(ex.ToString());
                result = this.Json(new
                {
                    errcode = -1,
                    errmsg  = ex.Message,
                    msgdoc  = string.Concat(new object[]
                    {
                        "http://",
                        request.Url.Host,
                        ":",
                        request.Url.Port,
                        "/AddInsDomain/help/doc"
                    })
                }, JsonRequestBehavior.DenyGet);
            }
            return(result);
        }