chore: 初始化 VPSA ASP.NET 管理端
This commit is contained in:
322
submit/new/MESCommonBase.ashx.exclude
Normal file
322
submit/new/MESCommonBase.ashx.exclude
Normal file
@@ -0,0 +1,322 @@
|
||||
<%@ WebHandler Language="C#" Class="MESCommonBase" %>
|
||||
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Data;
|
||||
using BizDataAccess;
|
||||
using System.Data.SqlClient;
|
||||
using DbCallData;
|
||||
using BasicData;
|
||||
|
||||
public class MESCommonBase : IHttpHandler
|
||||
{
|
||||
public bool IsReusable
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
context.Response.ContentType = "application/json";
|
||||
var data = context.Request;
|
||||
var stream = new StreamReader(data.InputStream).ReadToEnd();
|
||||
var dataobj = new JavaScriptSerializer().Deserialize<jsonobj>(stream);
|
||||
string responseText = "NULL";
|
||||
try
|
||||
{
|
||||
responseText = DbCallData.DbCom.DbCall(dataobj);
|
||||
context.Response.Write(responseText);
|
||||
}
|
||||
catch
|
||||
{
|
||||
context.Response.Write(responseText);
|
||||
}
|
||||
}
|
||||
|
||||
//有参数 没有返回值
|
||||
//public static bool ExecuteStoredProcedure(string procedureName, string connectionString, ref SqlParameter[] sqlParameters, out string errorMessage)
|
||||
|
||||
//有参数 有返回值
|
||||
//public static bool ExecuteStoredProcedure(string procedureName, string connectionString, ref SqlParameter[] sqlParameters, out DataSet ds, out string errorMessage)
|
||||
|
||||
//无参数 有返回值
|
||||
//public static bool ExecuteStoredProcedure(string procedureName, string connectionString, out DataTable dt, out string errorMessage)
|
||||
//public static bool ExecuteStoredProcedure(string procedureName, string connectionString, out DataSet ds, out string errorMessage)
|
||||
|
||||
/// <summary>
|
||||
/// 执行存储过程
|
||||
/// </summary>
|
||||
/// <param name="json"></param>
|
||||
/// <returns></returns>
|
||||
//private string ExePROCEDURE(jsonobj json)
|
||||
//{
|
||||
// string result = "";
|
||||
|
||||
// DataSet ds = null;
|
||||
// try
|
||||
// {
|
||||
// if (json.HasReturn)//执行有返回值的存储过程
|
||||
// {
|
||||
// if (json.Param == "" || json.Param == null)//执行没有参数的存储过程
|
||||
// {
|
||||
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, out ds, out result);
|
||||
// }
|
||||
// else//执行有参数的存储过程
|
||||
// {
|
||||
// string[] parmas;
|
||||
// SqlParameter[] thisParms;
|
||||
// try
|
||||
// {
|
||||
// parmas = json.Param.Split('|');
|
||||
// thisParms = new SqlParameter[parmas.Length];
|
||||
// for (int i = 0; i < parmas.Length; i++)
|
||||
// {
|
||||
// string[] pp = parmas[i].Split('&');
|
||||
// object inputValue=null;
|
||||
// if(pp.Length==3)
|
||||
// {
|
||||
// switch (pp[2])
|
||||
// {
|
||||
// case "Int":
|
||||
// inputValue = Convert.ToInt32( pp[1]);
|
||||
// break;
|
||||
// case "String":
|
||||
// inputValue = pp[2];
|
||||
// break;
|
||||
// case "Boolean":
|
||||
// inputValue = Convert.ToBoolean( pp[1]);
|
||||
// break;
|
||||
// case "DateTime":
|
||||
// inputValue = Convert.ToDateTime( pp[1]);
|
||||
// break;
|
||||
// default:
|
||||
// inputValue = pp[1];
|
||||
// break;
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// thisParms[i] = new SqlParameter(pp[0], inputValue);
|
||||
|
||||
// }
|
||||
// else if(pp.Length==2)
|
||||
// {
|
||||
|
||||
// thisParms[i] = new SqlParameter(pp[0], pp[1]);
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// return result = "参数有误,请检查参数的格式是否正确";
|
||||
// }
|
||||
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, ref thisParms, out ds, out result);
|
||||
// }
|
||||
// }
|
||||
// else//执行没有返回值的存储过程
|
||||
// {
|
||||
// if (json.Param == "" || json.Param == null)//执行没有参数的存储过程
|
||||
// {
|
||||
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, out ds, out result);
|
||||
// }
|
||||
// else//执行有参数的存储过程
|
||||
// {
|
||||
// string[] parmas;
|
||||
// SqlParameter[] thisParms;
|
||||
// try
|
||||
// {
|
||||
// parmas = json.Param.Split('|');
|
||||
// thisParms = new SqlParameter[parmas.Length];
|
||||
// for (int i = 0; i < parmas.Length; i++)
|
||||
// {
|
||||
// string[] pp = parmas[i].Split('&');
|
||||
// thisParms[i] = new SqlParameter(pp[0], pp[1]);
|
||||
// }
|
||||
// }catch (Exception)
|
||||
// {
|
||||
// return result = "参数有误,请检查参数的格式是否正确";
|
||||
// }
|
||||
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, ref thisParms, out result);
|
||||
// }
|
||||
// }
|
||||
// if (ds != null && ds.Tables.Count > 0)
|
||||
// {
|
||||
// result = JsonHelper.DataTableToJson(ds.Tables[0]);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// result = ex.Message;
|
||||
// }
|
||||
// return result;
|
||||
//}
|
||||
/// <summary>
|
||||
/// 执行存储过程 无返回值
|
||||
/// </summary>
|
||||
/// <param name="json"></param>
|
||||
/// <returns></returns>
|
||||
//private string ExePROCEDURE2(jsonobj json)
|
||||
//{
|
||||
// string result = "";
|
||||
|
||||
// DataSet ds = null;
|
||||
// try
|
||||
// {
|
||||
// if (json.HasReturn)//执行有返回值的存储过程
|
||||
// {
|
||||
// if (json.Param == "" || json.Param == null)//执行没有参数的存储过程
|
||||
// {
|
||||
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, out ds, out result);
|
||||
// }
|
||||
// else//执行有参数的存储过程
|
||||
// {
|
||||
// string[] parmas;
|
||||
// SqlParameter[] thisParms;
|
||||
// try
|
||||
// {
|
||||
// parmas = json.Param.Split('|');
|
||||
// thisParms = new SqlParameter[parmas.Length];
|
||||
// for (int i = 0; i < parmas.Length; i++)
|
||||
// {
|
||||
// string[] pp = parmas[i].Split('&');
|
||||
// object inputValue=null;
|
||||
// if(pp.Length==3)
|
||||
// {
|
||||
// switch (pp[2])
|
||||
// {
|
||||
// case "Int":
|
||||
// inputValue = Convert.ToInt32( pp[1]);
|
||||
// break;
|
||||
// case "String":
|
||||
// inputValue = pp[2];
|
||||
// break;
|
||||
// case "Boolean":
|
||||
// inputValue = Convert.ToBoolean( pp[1]);
|
||||
// break;
|
||||
// case "DateTime":
|
||||
// inputValue = Convert.ToDateTime( pp[1]);
|
||||
// break;
|
||||
// default:
|
||||
// inputValue = pp[1];
|
||||
// break;
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// thisParms[i] = new SqlParameter(pp[0], inputValue);
|
||||
|
||||
// }
|
||||
// else if(pp.Length==2)
|
||||
// {
|
||||
|
||||
// thisParms[i] = new SqlParameter(pp[0], pp[1]);
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// return result = "参数有误,请检查参数的格式是否正确";
|
||||
// }
|
||||
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, ref thisParms, out ds, out result);
|
||||
// }
|
||||
// }
|
||||
// else//执行没有返回值的存储过程
|
||||
// {
|
||||
// if (json.Param == "" || json.Param == null)//执行没有参数的存储过程
|
||||
// {
|
||||
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, out ds, out result);
|
||||
// }
|
||||
// else//执行有参数的存储过程
|
||||
// {
|
||||
// string[] parmas;
|
||||
// SqlParameter[] thisParms;
|
||||
// try
|
||||
// {
|
||||
// parmas = json.Param.Split('|');
|
||||
// thisParms = new SqlParameter[parmas.Length];
|
||||
// for (int i = 0; i < parmas.Length; i++)
|
||||
// {
|
||||
// string[] pp = parmas[i].Split('&');
|
||||
// thisParms[i] = new SqlParameter(pp[0], pp[1]);
|
||||
// }
|
||||
// }catch (Exception)
|
||||
// {
|
||||
// return result = "参数有误,请检查参数的格式是否正确";
|
||||
// }
|
||||
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, ref thisParms, out result);
|
||||
// }
|
||||
// }
|
||||
// if (ds != null && ds.Tables.Count > 0)
|
||||
// {
|
||||
// result = JsonHelper.DataTableToJson(ds.Tables[0]);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// result = ex.Message;
|
||||
// }
|
||||
// return result;
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 执行SQL语句
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
//private string ExeSQL(jsonobj obj)
|
||||
//{
|
||||
// string result = "";
|
||||
// try
|
||||
// {
|
||||
// if (obj.HasReturn)//执行有返回值的sql
|
||||
// {
|
||||
// if (obj.Param == "")//执行没有参数的存储过程
|
||||
// {
|
||||
// //SQLCommon.ExecuteDataset();
|
||||
// }
|
||||
// else//执行有参数的存储过程
|
||||
// {
|
||||
// }
|
||||
|
||||
// }
|
||||
// else//执行没有返回值的sql
|
||||
// {
|
||||
// if (obj.Param == "")//执行没有参数的存储过程
|
||||
// {
|
||||
// //SQLCommon.ExecuteStoredProcedure(obj.Name, connectionString, out ds, out result);
|
||||
// }
|
||||
// else//执行有参数的存储过程
|
||||
// {
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// result = ex.Message;
|
||||
// }
|
||||
// return result;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//[Serializable]
|
||||
//class jsonobj
|
||||
//{
|
||||
// public string Type;
|
||||
// public string Name;
|
||||
// public string Param;
|
||||
// public bool HasReturn;
|
||||
//}
|
||||
}
|
||||
0
submit/new/_system~.ini
Normal file
0
submit/new/_system~.ini
Normal file
Reference in New Issue
Block a user