using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Web; using System.Web.Mvc; using DSWeb.Areas.CommMng.DAL; using DSWeb.Areas.RptMng.Comm; using DSWeb.TruckMng.Helper; using HcUtility.Comm; using Microsoft.Practices.EnterpriseLibrary.Data; namespace DSWeb.Areas.RptMng.Controllers { [JsonRequestBehavior] public class MsRptKfWxQryController : Controller { // // GET: /RptMng/MsRptKfWxQry public ActionResult Index() { return View(); } // // GET:/RptMng/MsRptKfWxQry/QryData public ContentResult QryData(int start, int limit, string condition) { var dbparams = new List(); var paramps_OrgCode = new CustomDbParamter(); paramps_OrgCode.ParameterName = "@PS_ORGCODE"; paramps_OrgCode.DbType = DbType.String; paramps_OrgCode.Direction = ParameterDirection.Input; paramps_OrgCode.Value = RptHelper.JsonGetValue(condition, "PS_ORGCODE").ToString(); dbparams.Add(paramps_OrgCode); var paramps_TruckNo = new CustomDbParamter(); paramps_TruckNo.ParameterName = "@PS_TRUCKNO"; paramps_TruckNo.DbType = DbType.String; paramps_TruckNo.Direction = ParameterDirection.Input; paramps_TruckNo.Value = RptHelper.JsonGetValue(condition, "PS_TRUCKNO").ToString(); dbparams.Add(paramps_TruckNo); var paramps_WxLxCode = new CustomDbParamter(); paramps_WxLxCode.ParameterName = "@PS_WXLXCODE"; paramps_WxLxCode.DbType = DbType.String; paramps_WxLxCode.Direction = ParameterDirection.Input; paramps_WxLxCode.Value = RptHelper.JsonGetValue(condition, "PS_WXLXCODE").ToString(); dbparams.Add(paramps_WxLxCode); var paramps_PgDateBgn = new CustomDbParamter(); paramps_PgDateBgn.ParameterName = "@PS_PGDATEBGN"; paramps_PgDateBgn.DbType = DbType.String; paramps_PgDateBgn.Direction = ParameterDirection.Input; paramps_PgDateBgn.Value = RptHelper.JsonGetValue(condition, "PS_PGDATEBGN").ToString(); dbparams.Add(paramps_PgDateBgn); var paramps_PgDateEnd = new CustomDbParamter(); paramps_PgDateEnd.ParameterName = "@PS_PGDATEEND"; paramps_PgDateEnd.DbType = DbType.String; paramps_PgDateEnd.Direction = ParameterDirection.Input; paramps_PgDateEnd.Value = RptHelper.JsonGetValue(condition, "PS_PGDATEEND").ToString(); dbparams.Add(paramps_PgDateEnd); var paramps_WxItem = new CustomDbParamter(); paramps_WxItem.ParameterName = "@PS_WXITEM"; paramps_WxItem.DbType = DbType.String; paramps_WxItem.Direction = ParameterDirection.Input; paramps_WxItem.Value = RptHelper.JsonGetValue(condition, "PS_WXITEM").ToString(); dbparams.Add(paramps_WxItem); var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsRptKfWxQry", dbparams, "Result_Set"); var json = RptHelper.GetRptJsonResult(start, limit, dbRptResult, "Result_Set", false); return new ContentResult() { Content = json }; } #region 参照部分 public class MsKfWxBodyRefMsKfBzWx { public string WxLxCode { get; set; } public string WxLxName { get; set; } public string CodeAndName { get; set; } } internal static List GetWxLxCodeList() { var strSql = new StringBuilder(); strSql.Append("SELECT "); strSql.Append(" WxLxCode,WxLxName"); strSql.Append(" from tMsKfBzWx"); var dataList = new List(); Database db = DatabaseFactory.CreateDatabase(); using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString())) { while (reader.Read()) { var data = new MsKfWxBodyRefMsKfBzWx(); #region Set DB data to Object data.WxLxCode = Convert.ToString(reader["WxLxCode"]); data.WxLxName = Convert.ToString(reader["WxLxName"]); data.CodeAndName = Convert.ToString(reader["WxLxCode"]) + "-" + Convert.ToString(reader["WxLxName"]); #endregion dataList.Add(data); } reader.Close(); } return dataList; } public ContentResult GetWxLxCodeList(string condition) { var list = GetWxLxCodeList(); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = list.ToList() }); return new ContentResult() { Content = json }; } #endregion } }