public void ProcessRequest(HttpContext context)
        {
            string resultJSON = string.Empty;

            try
            {
                DeveloperInfo developerInfo = HttpContext.Current.Session["DeveloperInfo"] as DeveloperInfo;
                string fullSiteName = context.Request["FullSiteName"].ToString().Trim();
                int appId = Convert.ToInt32(context.Request["AppId"]);

                BLLApp bllApp = new BLLApp();
                bllApp.AppRemove(developerInfo, fullSiteName, appId);

                resultJSON = Tools.ExecResultToJSON(true, "应用删除成功!");

                context.Response.Write(resultJSON);
            }
            catch (Exception ex)
            {
                Tools.LogWrite(ex.ToString());
                string errorMessage = Tools.ErrorMessageFilter(ex.Message);
                resultJSON = Tools.ExecResultToJSON(false, errorMessage);
                context.Response.Write(resultJSON);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            string resultJSON = string.Empty;
            string result = string.Empty;

            try
            {
                string fullSiteName = context.Request["FullSiteName"].ToString().Trim();
                int appId = Convert.ToInt32(context.Request["AppId"]);
                string defaultPages = context.Request.Form["ADefaultPageSet"].ToString().Trim();

                DeveloperInfo developerInfo = HttpContext.Current.Session["DeveloperInfo"] as DeveloperInfo;

                BLLApp bllApp = new BLLApp();
                result = bllApp.SiteDefaultPageSet(developerInfo, fullSiteName, appId, defaultPages);

                if (string.IsNullOrEmpty(result))
                {
                    resultJSON = Tools.ExecResultToJSON(true, "默认页面列表配置成功!");
                }
                else
                {
                    resultJSON = Tools.ExecResultToJSON(false, result);
                }

                context.Response.Write(resultJSON);
            }
            catch (Exception ex)
            {
                Tools.LogWrite(ex.ToString());
                string errorMessage = Tools.ErrorMessageFilter(ex.Message);
                resultJSON = Tools.ExecResultToJSON(false, errorMessage);
                context.Response.Write(resultJSON);
            }
        }
예제 #3
0
        public void ProcessRequest(HttpContext context)
        {
            string resultJSON = string.Empty;
            string result = string.Empty;

            try
            {
                DeveloperInfo developerInfo = HttpContext.Current.Session["DeveloperInfo"] as DeveloperInfo;

                int pageNumber = int.Parse(context.Request["page"]);
                int pageSize = int.Parse(context.Request["rows"]);

                int recordAmount;
                int pageAmount;

                BLLApp bllApp = new BLLApp();

                DataTable dt = bllApp.GetPageByDeveloperId(developerInfo.Id, pageNumber, pageSize, out recordAmount, out pageAmount);

                string contentJSON = JsonConvert.SerializeObject(dt, new DataTableToJosnConverter());

                resultJSON = Tools.QueryResultToJSON(contentJSON, recordAmount);

                context.Response.Write(resultJSON);
            }
            catch (Exception ex)
            {
                Tools.LogWrite(ex.ToString());
                resultJSON = Tools.ExecResultToJSON(false, ex.Message);
                context.Response.Write(resultJSON);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            string resultJSON = string.Empty;
            string result = string.Empty;

            try
            {
                DeveloperInfo developerInfo = HttpContext.Current.Session["DeveloperInfo"] as DeveloperInfo;

                string processType = context.Request["ProcessType"].ToString();
                string fullSiteName = context.Request["FullSiteName"].ToString().Trim();
                int appId = Convert.ToInt32(context.Request["AppId"]);

                BLLApp bllApp = new BLLApp();

                double siteSpaceUsed = bllApp.Site_SpaceUsed_Get(developerInfo, fullSiteName);
                if (siteSpaceUsed > developerInfo.SiteSpaceTotal)
                {
                    siteSpaceUsed = developerInfo.SiteSpaceTotal;
                }

                double dbSpaceUsed = bllApp.DB_SpaceUsed_Get(developerInfo, fullSiteName);
                if (dbSpaceUsed > developerInfo.DBSpaceTotal)
                {
                    dbSpaceUsed = developerInfo.DBSpaceTotal;
                }

                bllApp.SpaceStatistic_Update(developerInfo, appId, siteSpaceUsed, dbSpaceUsed);

                if (processType == "SiteSpaceUsedStatistics")
                {
                    resultJSON = string.Format("[[\"已用空间\",{0}],[\"未用空间\",{1}]]", siteSpaceUsed, developerInfo.SiteSpaceTotal - siteSpaceUsed);
                }
                else
                {
                    resultJSON = string.Format("[[\"已用空间\",{0}],[\"未用空间\",{1}]]", dbSpaceUsed, developerInfo.DBSpaceTotal - dbSpaceUsed);
                }

                context.Response.Write(resultJSON);
            }
            catch (Exception ex)
            {
                Tools.LogWrite(ex.ToString());
                string errorMessage = Tools.ErrorMessageFilter(ex.Message);
                resultJSON = Tools.ExecResultToJSON(false, errorMessage);
                context.Response.Write(resultJSON);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            string resultJSON = string.Empty;
            string result = string.Empty;

            try
            {
                BLLApp bllApp = new BLLApp();

                string appName = context.Request["AppName"].ToString().Trim();
                string siteName = context.Request["SiteName"].ToString().Trim();
                byte appLanguage = Convert.ToByte(context.Request["AppLanguage"]);
                int managedPipelineMode = Convert.ToInt32(context.Request["ManagedPipelineMode"]);
                string runtimeVersion = context.Request["RuntimeVersion"].ToString();

                DeveloperInfo developerInfo = HttpContext.Current.Session["DeveloperInfo"] as DeveloperInfo;

                result = bllApp.AppCreate(developerInfo, appName, siteName, appLanguage, managedPipelineMode, runtimeVersion);
                if (string.IsNullOrEmpty(result))
                {
                    resultJSON = Tools.ExecResultToJSON(true, "应用创建成功!");
                }
                else
                {
                    resultJSON = Tools.ExecResultToJSON(false, result);
                }

                context.Response.Write(resultJSON);
            }
            catch (Exception ex)
            {
                Tools.LogWrite(ex.ToString());
                string errorMessage = Tools.ErrorMessageFilter(ex.Message);
                resultJSON = Tools.ExecResultToJSON(false, errorMessage);
                context.Response.Write(resultJSON);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            string resultJSON = string.Empty;
            string result = string.Empty;

            try
            {
                string fullSiteName = context.Request["FullSiteName"].ToString().Trim();
                int appId = Convert.ToInt32(context.Request["AppId"]);
                byte clientCache = Convert.ToByte(context.Request.Form["IsAllowAccessUnConfig"]);
                string ipConfig = context.Request["IPSecurity"].ToString().Trim();

                DeveloperInfo developerInfo = HttpContext.Current.Session["DeveloperInfo"] as DeveloperInfo;

                BLLApp bllApp = new BLLApp();
                result = bllApp.SiteIpSecuritySet(developerInfo, fullSiteName, appId, clientCache, ipConfig);

                if (string.IsNullOrEmpty(result))
                {
                    resultJSON = Tools.ExecResultToJSON(true, "访问控制配置成功!");
                }
                else
                {
                    resultJSON = Tools.ExecResultToJSON(false, result);
                }

                context.Response.Write(resultJSON);
            }
            catch (Exception ex)
            {
                Tools.LogWrite(ex.ToString());
                string errorMessage = Tools.ErrorMessageFilter(ex.Message);
                resultJSON = Tools.ExecResultToJSON(false, errorMessage);
                context.Response.Write(resultJSON);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            string resultJSON = string.Empty;
            string result = string.Empty;

            try
            {
                DeveloperInfo developerInfo = HttpContext.Current.Session["DeveloperInfo"] as DeveloperInfo;
                string fullSiteName = context.Request["FullSiteName"].ToString();
                string processType = context.Request["ProcessType"].ToString();

                if (processType == "AppDownLoad")
                {
                    string tempFilePath = string.Empty;
                    try
                    {
                        string developerPath = Path.Combine(DeveloperConfig.SystemPhysicalPath, developerInfo.LoginName);
                        string appPath = Path.Combine(developerPath, fullSiteName);
                        string webPath = Path.Combine(appPath, "IISSite");

                        tempFilePath = Path.Combine(appPath, Guid.NewGuid().ToString() + ".zip");
                        using (ZipFile zip = new ZipFile())
                        {
                            zip.AddDirectory(webPath);
                            zip.Save(tempFilePath);
                        }

                        Tools.DownLoadFile(tempFilePath, fullSiteName + ".zip");
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    finally
                    {
                        File.Delete(tempFilePath);
                    }
                }
                else if (processType == "DbDownLoad")
                {
                    string backupPath = string.Empty;

                    try
                    {
                        BLLApp bllApp = new BLLApp();
                        backupPath = bllApp.DbBackup(developerInfo, fullSiteName);

                        Tools.DownLoadFile(backupPath, fullSiteName + ".bak");
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    finally
                    {
                        File.Delete(backupPath);
                    }
                }

                resultJSON = Tools.ExecResultToJSON(true, "导出成功!");
                context.Response.Write(resultJSON);
            }
            catch (Exception ex)
            {
                Tools.LogWrite(ex.ToString());
                resultJSON = Tools.ExecResultToJSON(false, ex.Message);
                context.Response.Write(resultJSON);
            }
        }