public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; CauseObject_MCE_B_AOG p = new CauseObject_MCE_B_AOG(); p.ID = request["id"].ToString(); DisplayObject_MCE_B_AOG[] listHead = BizLogicObject_MCE_B_AOG.Proxy.Query(p); JSON_PAGER jsonPager = new JSON_PAGER(); if (listHead == null) { throw new Exception("获取列表信息失败."); } jsonPager.head = listHead[0]; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "ASSETS_NAME"; CauseObject_MCE_B_AOG_D pd = new CauseObject_MCE_B_AOG_D(); pd.BASE_ID = request["id"].ToString(); DisplayObject_MCE_B_AOG_D[] listDetail = BizLogicObject_MCE_B_AOG_D.Proxy.Query(pd, null, orderBy); jsonPager.total = listDetail.Length; jsonPager.rows = listDetail; jsonMsg.Succeed = 1; jsonMsg.Message = jsonPager; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; if (string.IsNullOrEmpty(request["id"])) { throw new Exception("参数错误."); } CauseObject_MCE_D_MCE_TYPE p = new CauseObject_MCE_D_MCE_TYPE(); p.ID = request["id"].ToString(); DisplayObject_MCE_D_MCE_TYPE[] listHead = BizLogicObject_MCE_D_MCE_TYPE.Proxy.Query(p); JSON_PAGER jsonPager = new JSON_PAGER(); if (listHead == null || listHead.Length == 0) { throw new Exception("获取列表信息失败."); } jsonPager.head = listHead[0]; CauseObject_MCE_D_TYPE_DEPT pd = new CauseObject_MCE_D_TYPE_DEPT(); pd.MCE_TYPE_ID = request["id"].ToString(); DisplayObject_MCE_D_TYPE_DEPT[] listDetail = BizLogicObject_MCE_D_TYPE_DEPT.Proxy.Query(pd); jsonPager.total = listDetail.Length; jsonPager.rows = listDetail; jsonMsg.Succeed = 1; jsonMsg.Message = jsonPager; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; if (string.IsNullOrEmpty(request["id"])) { throw new Exception("参数错误."); } CauseObject_MCE_B_ASSETS_METER p = new CauseObject_MCE_B_ASSETS_METER(); p.ID = request["id"].ToString(); DisplayObject_MCE_B_ASSETS_METER[] listHead = BizLogicObject_MCE_B_ASSETS_METER.Proxy.Query(p); JSON_PAGER jsonPager = new JSON_PAGER(); if (listHead == null) { throw new Exception("获取列表信息失败."); } jsonPager.head = listHead[0]; jsonMsg.Succeed = 1; jsonMsg.Message = jsonPager; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = false; orderBy.OrderBy = "CODE"; PagingParamter pager = new PagingParamter(); pager.PageSize = string.IsNullOrEmpty(request["limit"]) ? 10 : int.Parse(request["limit"].ToString()); pager.PageIndex = string.IsNullOrEmpty(request["offset"]) ? 0 : (int.Parse(request["offset"].ToString()) <= 0) ? 0 : int.Parse(request["offset"].ToString()) - 1; CauseObject_MCE_B_ASSETS_METER p = new CauseObject_MCE_B_ASSETS_METER(); if (!string.IsNullOrEmpty(request["status"])) { p.STATE = int.Parse(request["status"].ToString()); } if (!string.IsNullOrEmpty(request["dept"])) { p.USING_DEPT_ID = request["dept"].ToString(); } if (!string.IsNullOrEmpty(request["asset"])) { p.ASSETS_ID = request["asset"].ToString(); } if (!string.IsNullOrEmpty(request["meter_type"])) { p.METER_TYPE = request["meter_type"].ToString(); } if (!string.IsNullOrEmpty(request["code"])) { p.CODE = "%" + request["code"].ToString() + "%"; } if (!string.IsNullOrEmpty(request["beginspan"])) { p.NEXT_IDENTIFICATION = new DateSpan(); p.NEXT_IDENTIFICATION.Begin = DateTime.Parse(request["beginspan"].ToString()); } if (!string.IsNullOrEmpty(request["endspan"])) { if (p.NEXT_IDENTIFICATION == null) { p.NEXT_IDENTIFICATION = new DateSpan(); } p.NEXT_IDENTIFICATION.End = DateTime.Parse(request["endspan"].ToString()); } DisplayObject_MCE_B_ASSETS_METER[] list = BizLogicObject_MCE_B_ASSETS_METER.Proxy.Query(p, pager, orderBy); JSON_PAGER jsonPager = new JSON_PAGER(); jsonPager.total = pager.TotalRecords; jsonPager.rows = list; jsonMsg.Message = jsonPager; jsonMsg.Succeed = 1; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "CODE, NAME"; PagingParamter pager = new PagingParamter(); pager.PageSize = string.IsNullOrEmpty(request["limit"]) ? 10 : int.Parse(request["limit"].ToString()); pager.PageIndex = string.IsNullOrEmpty(request["offset"]) ? 0 : (int.Parse(request["offset"].ToString()) <= 0) ? 0 : int.Parse(request["offset"].ToString()) - 1; StringBuilder strCondition = new StringBuilder(); strCondition.Append(" and MDM_D_STOCK.STOCK_TYPE_ID = '00320003' "); List <JsonMtrPurStock> list = new System.Collections.Generic.List <JsonMtrPurStock>(); CauseObject_MDM_D_STOCK cause = new CauseObject_MDM_D_STOCK(); if (!string.IsNullOrEmpty(request["area"])) { cause.DEPT_ID = request["area"].ToString().Trim(); } if (!string.IsNullOrEmpty(request["is_area"]) && request["is_area"].ToString().Trim() == "1") { cause.DEPT_ID = BizLogicObject_MTR_D_MTR.Proxy.getAreaByDept(SystemLogic.Proxy.CurrentUser.DEPART_ID.Trim()); } if (!string.IsNullOrEmpty(request["condition"])) { strCondition.Append(string.Format(" and (upper(MDM_D_STOCK.CODE) like upper('%{0}%') or upper(MDM_D_STOCK.NAME) like upper('%{0}%')) ", request["condition"].ToString().Trim())); } cause.SetCustomCondition(strCondition.ToString()); DisplayObject_MDM_D_STOCK[] stocks = BizLogicObject_MDM_D_STOCK.Proxy.Query(cause, pager, orderBy); foreach (DisplayObject_MDM_D_STOCK item in stocks) { JsonMtrPurStock tmp = new JsonMtrPurStock(); tmp.id = item.ID.Trim(); tmp.code = item.CODE; tmp.name = item.NAME; tmp.dept = item.DEPT_ID.Trim(); tmp.deptName = item.DEPT_ID_NAME; list.Add(tmp); } JSON_PAGER jsonPager = new JSON_PAGER(); jsonPager.total = pager.TotalRecords; jsonPager.rows = list; jsonMsg.Succeed = 1; jsonMsg.Message = jsonPager; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { context.Response.Write(JsonConvert.SerializeObject(jsonMsg)); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "CODE"; PagingParamter pager = new PagingParamter(); pager.PageSize = string.IsNullOrEmpty(request["limit"]) ? 10 : int.Parse(request["limit"].ToString()); pager.PageIndex = string.IsNullOrEmpty(request["offset"]) ? 0 : (int.Parse(request["offset"].ToString()) <= 0) ? 0 : int.Parse(request["offset"].ToString()) - 1; CauseObject_MCE_B_ASSETS_METER_TYPE p = new CauseObject_MCE_B_ASSETS_METER_TYPE(); if (!string.IsNullOrEmpty(request["status"])) { p.STATE = int.Parse(request["status"].ToString()); } if (!string.IsNullOrEmpty(request["condition"])) { string strCondition = " and (MCE_B_ASSETS_METER_TYPE.code like '%" + request["condition"] + "%' or MCE_B_ASSETS_METER_TYPE.name like '%" + request["condition"] + "%' )"; p.SetCustomCondition(strCondition); } else { if (!string.IsNullOrEmpty(request["code"])) { p.CODE = "%" + request["code"].ToString() + "%"; } if (!string.IsNullOrEmpty(request["name"])) { p.NAME = "%" + request["name"].ToString() + "%"; } } DisplayObject_MCE_B_ASSETS_METER_TYPE[] list = BizLogicObject_MCE_B_ASSETS_METER_TYPE.Proxy.Query(p, pager, orderBy); JSON_PAGER jsonPager = new JSON_PAGER(); jsonPager.total = pager.TotalRecords; jsonPager.rows = list; jsonMsg.Message = jsonPager; jsonMsg.Succeed = 1; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "CODE,PERIODS"; PagingParamter pager = new PagingParamter(); pager.PageSize = string.IsNullOrEmpty(request["limit"]) ? 10 : int.Parse(request["limit"].ToString()); pager.PageIndex = string.IsNullOrEmpty(request["offset"]) ? 0 : (int.Parse(request["offset"].ToString()) <= 0) ? 0 : int.Parse(request["offset"].ToString()) - 1; CauseObject_V_MCE_QUERY_CONTRACT_PAY p = new CauseObject_V_MCE_QUERY_CONTRACT_PAY(); p.H_STATE = 3; p.CONTRACT_STATE = 1; if (!string.IsNullOrEmpty(request["status"])) { p.STATE = int.Parse(request["status"].ToString()); } if (!string.IsNullOrEmpty(request["contract_status"])) { p.CONTRACT_STATE = int.Parse(request["contract_status"].ToString()); } if (!string.IsNullOrEmpty(request["dept"])) { p.SECOND_PARTY = request["dept"].ToString(); } if (!string.IsNullOrEmpty(request["code"])) { p.CODE = "%" + request["code"].ToString() + "%"; } if (!string.IsNullOrEmpty(request["name"])) { p.NAME = "%" + request["name"].ToString() + "%"; } if (!string.IsNullOrEmpty(request["beginspan"])) { p.PLAN_PAY_DATE = new DateSpan(); p.PLAN_PAY_DATE.End = DateTime.Parse(request["beginspan"].ToString()).AddDays(1); } DisplayObject_V_MCE_QUERY_CONTRACT_PAY[] list = BizLogicObject_V_MCE_QUERY_CONTRACT_PAY.Proxy.Query(p, pager, orderBy); JSON_PAGER jsonPager = new JSON_PAGER(); jsonPager.total = pager.TotalRecords; jsonPager.rows = list; jsonMsg.Message = jsonPager; jsonMsg.Succeed = 1; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = false; orderBy.OrderBy = "CODE"; PagingParamter pager = new PagingParamter(); pager.PageSize = string.IsNullOrEmpty(request["limit"]) ? 10 : int.Parse(request["limit"].ToString()); pager.PageIndex = string.IsNullOrEmpty(request["offset"]) ? 0 : (int.Parse(request["offset"].ToString()) <= 0) ? 0 : int.Parse(request["offset"].ToString()) - 1; CauseObject_MCE_B_ASSETS_BACK p = new CauseObject_MCE_B_ASSETS_BACK(); if (!string.IsNullOrEmpty(request["status"])) { p.STATE = int.Parse(request["status"].ToString()); } if (!string.IsNullOrEmpty(request["returndept"])) { p.RETURN_DEPT_ID = request["returndept"].ToString(); } if (!string.IsNullOrEmpty(request["returnuser"])) { p.RETURN_USER_ID = request["returnuser"].ToString(); } if (!string.IsNullOrEmpty(request["code"])) { p.CODE = "%" + request["code"].ToString() + "%"; } if (!string.IsNullOrEmpty(request["prv"])) { var prv_ID = request["prv"]; p.SetCustomCondition(string.Format(" and MCE_B_ASSETS_BACK.ID in (select d.base_id from MCE_B_ASSETS_BACK_D d where d.assets_id in (select ID from mce_b_assets s2 where s2.provider_id='{0}' ))", prv_ID)); } if (!string.IsNullOrEmpty(request["beginspan"])) { p.CREATE_DATE = new DateSpan(); p.CREATE_DATE.Begin = DateTime.Parse(request["beginspan"].ToString()); } if (!string.IsNullOrEmpty(request["endspan"])) { if (p.CREATE_DATE == null) { p.CREATE_DATE = new DateSpan(); } p.CREATE_DATE.End = DateTime.Parse(request["endspan"].ToString()); } DisplayObject_MCE_B_ASSETS_BACK[] list = BizLogicObject_MCE_B_ASSETS_BACK.Proxy.Query(p, pager, orderBy); JSON_PAGER jsonPager = new JSON_PAGER(); jsonPager.total = pager.TotalRecords; jsonPager.rows = list; jsonMsg.Message = jsonPager; jsonMsg.Succeed = 1; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "FINANCE_CYCLE"; PagingParamter pager = new PagingParamter(); pager.PageSize = string.IsNullOrEmpty(request["limit"]) ? 10 : int.Parse(request["limit"].ToString()); pager.PageIndex = string.IsNullOrEmpty(request["offset"]) ? 0 : (int.Parse(request["offset"].ToString()) <= 0) ? 0 : int.Parse(request["offset"].ToString()) - 1; if (string.IsNullOrEmpty(request["id"])) { throw new Exception("参数错误."); } CauseObject_V_MCE_ASSETS_DEPR_D p = new CauseObject_V_MCE_ASSETS_DEPR_D(); p.ASSERTS_ID = request["id"]; List <DisplayObject_V_MCE_ASSETS_DEPR_D> list = new List <DisplayObject_V_MCE_ASSETS_DEPR_D>(); DisplayObject_V_MCE_ASSETS_DEPR_D[] list0 = BizLogicObject_V_MCE_ASSETS_DEPR_D.Proxy.Query(p, pager, orderBy); if (list0 != null && list0.Length > 0) { list = list0.ToList(); } object objMoney = list.Sum(l => l.MONEY); DisplayObject_V_MCE_ASSETS_DEPR_D pageItem = new DisplayObject_V_MCE_ASSETS_DEPR_D(); pageItem.FINANCE_CYCLE = "小计"; if (!string.IsNullOrEmpty(objMoney.ToString())) { pageItem.MONEY = decimal.Parse(objMoney.ToString()); } list.Add(pageItem); DisplayObject_V_MCE_ASSETS_DEPR_D[] list1 = BizLogicObject_V_MCE_ASSETS_DEPR_D.Proxy.Query(p); object objTotMoney = list1.Sum(l => l.MONEY); DisplayObject_V_MCE_ASSETS_DEPR_D totalItem = new DisplayObject_V_MCE_ASSETS_DEPR_D(); totalItem.FINANCE_CYCLE = "总计"; if (!string.IsNullOrEmpty(objTotMoney.ToString())) { totalItem.MONEY = decimal.Parse(objTotMoney.ToString()); } list.Add(totalItem); JSON_PAGER jsonPager = new JSON_PAGER(); jsonPager.total = pager.TotalRecords; jsonPager.rows = list; jsonMsg.Message = jsonPager; jsonMsg.Succeed = 1; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = false; orderBy.OrderBy = "CODE"; PagingParamter pager = new PagingParamter(); pager.PageSize = string.IsNullOrEmpty(request["limit"]) ? 10 : int.Parse(request["limit"].ToString()); pager.PageIndex = string.IsNullOrEmpty(request["offset"]) ? 0 : (int.Parse(request["offset"].ToString()) <= 0) ? 0 : int.Parse(request["offset"].ToString()) - 1; CauseObject_MCE_B_ASSETS_PURCHASE p = new CauseObject_MCE_B_ASSETS_PURCHASE(); p.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; if (!string.IsNullOrEmpty(request["status"])) { p.STATE = int.Parse(request["status"].ToString()); } if (!string.IsNullOrEmpty(request["dept"])) { p.APPLY_DEPT_ID = request["dept"].ToString(); } if (!string.IsNullOrEmpty(request["prv"])) { p.PRV_ID = request["prv"].ToString(); } if (!string.IsNullOrEmpty(request["user"])) { p.APPLY_USER_ID = request["user"].ToString(); } if (!string.IsNullOrEmpty(request["code"])) { p.CODE = "%" + request["code"].ToString() + "%"; } if (!string.IsNullOrEmpty(request["name"])) { p.ASSET_NAME = "%" + request["name"].ToString() + "%"; } string strCondition = ""; if (!string.IsNullOrEmpty(request["condition"])) { strCondition = request["condition"]; } if (!string.IsNullOrEmpty(strCondition)) { p.SetCustomCondition(strCondition); } if (!string.IsNullOrEmpty(request["beginspan"])) { p.CREATE_DATE = new DateSpan(); p.CREATE_DATE.Begin = DateTime.Parse(request["beginspan"].ToString()); } if (!string.IsNullOrEmpty(request["endspan"])) { if (p.CREATE_DATE == null) { p.CREATE_DATE = new DateSpan(); } p.CREATE_DATE.End = DateTime.Parse(request["endspan"].ToString()); } DisplayObject_MCE_B_ASSETS_PURCHASE[] list = BizLogicObject_MCE_B_ASSETS_PURCHASE.Proxy.Query(p, pager, orderBy); JSON_PAGER jsonPager = new JSON_PAGER(); jsonPager.total = pager.TotalRecords; jsonPager.rows = list; jsonMsg.Message = jsonPager; jsonMsg.Succeed = 1; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = false; orderBy.OrderBy = "CREATE_TIME"; PagingParamter pager = new PagingParamter(); pager.PageSize = string.IsNullOrEmpty(request["limit"]) ? 10 : int.Parse(request["limit"].ToString()); pager.PageIndex = string.IsNullOrEmpty(request["offset"]) ? 0 : (int.Parse(request["offset"].ToString()) <= 0) ? 0 : int.Parse(request["offset"].ToString()) - 1; CauseObject_PRV_B_ASSET p = new CauseObject_PRV_B_ASSET(); StringBuilder strCondition = new StringBuilder(); strCondition.Append(" and PRV_B_ASSET.STATE > -1 "); if (!string.IsNullOrEmpty(request["state"])) { p.STATE = int.Parse(request["state"].ToString()); } if (!string.IsNullOrEmpty(request["prv"])) { p.PRV_ID = request["prv"].ToString(); } if (!string.IsNullOrEmpty(request["refprv"])) { EntityObject_MDM_D_DEPT entityDept = new EntityObject_MDM_D_DEPT(); entityDept.ID = request["refprv"]; entityDept = BizLogicObject_MDM_D_DEPT.Proxy.Get(entityDept); if (entityDept != null) { p.PRV_ID = entityDept.REF_ID; } } if (!string.IsNullOrEmpty(request["typeid"])) { p.TYPE_ID = request["typeid"].ToString(); } if (!string.IsNullOrEmpty(request["name"])) { p.NAME = "%" + request["name"].ToString().Trim() + "%"; } if (!string.IsNullOrEmpty(request["prd"]))//生产厂家 { strCondition.Append(" and PRV_D_DEPT_PRD_ID.NAME like '%" + request["prd"].ToString().Trim() + "%'"); } if (!string.IsNullOrEmpty(strCondition.ToString())) { p.SetCustomCondition(strCondition.ToString()); } string strOrder = JsonConvert.SerializeObject(orderBy); string strPage = JsonConvert.SerializeObject(pager); string strCause = JsonConvert.SerializeObject(p); PRV_MCE_Web_Service.PRV_Web_Service service = new PRV_MCE_Web_Service.PRV_Web_Service(); if (System.Configuration.ConfigurationManager.AppSettings["PrvMceWebServiceAddress"] != null) { string strServiceURL = System.Configuration.ConfigurationManager.AppSettings["PrvMceWebServiceAddress"]; service.Url = strServiceURL; } string strJson = service.GetPrvAssetInfo(strCause, strPage, strOrder); JSON_PAGER list = JsonConvert.DeserializeObject <JSON_PAGER>(strJson); jsonMsg.Succeed = 1; jsonMsg.Message = list; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = false; orderBy.OrderBy = "CREATE_TIME"; PagingParamter pager = new PagingParamter(); pager.PageSize = string.IsNullOrEmpty(request["limit"]) ? 10 : int.Parse(request["limit"].ToString()); pager.PageIndex = string.IsNullOrEmpty(request["offset"]) ? 0 : (int.Parse(request["offset"].ToString()) <= 0) ? 0 : int.Parse(request["offset"].ToString()) - 1; CauseObject_PRV_D_DEPT p = new CauseObject_PRV_D_DEPT(); p.DEPT_TYPE_ID = "00340005"; if (!string.IsNullOrEmpty(request["status"])) { p.AUDIT_STATE = request["status"].ToString(); } if (!string.IsNullOrEmpty(request["prvid"])) { p.ID = request["prvid"].ToString(); } StringBuilder strCondition = new StringBuilder(); if (!string.IsNullOrEmpty(request["condition"])) { strCondition.Append(string.Format(" and (upper(PRV_D_DEPT.CODE) like upper('%{0}%') or upper(PRV_D_DEPT.NAME) like upper('%{0}%')) ", request["condition"].ToString().Trim())); } if (!string.IsNullOrEmpty(request["beginspan"])) { p.CREATE_TIME = new DateSpan(); p.CREATE_TIME.Begin = DateTime.Parse(request["beginspan"].ToString()); } if (!string.IsNullOrEmpty(request["endspan"])) { if (p.CREATE_TIME == null) { p.CREATE_TIME = new DateSpan(); } p.CREATE_TIME.End = DateTime.Parse(request["endspan"].ToString()); } if (!string.IsNullOrEmpty(strCondition.ToString())) { p.SetCustomCondition(strCondition.ToString()); } string strOrder = JsonConvert.SerializeObject(orderBy); string strPage = JsonConvert.SerializeObject(pager); string strCause = JsonConvert.SerializeObject(p); PRV_MCE_Web_Service.PRV_Web_Service service = new PRV_MCE_Web_Service.PRV_Web_Service(); if (System.Configuration.ConfigurationManager.AppSettings["PrvMceWebServiceAddress"] != null) { string strServiceURL = System.Configuration.ConfigurationManager.AppSettings["PrvMceWebServiceAddress"]; service.Url = strServiceURL; } string strJson = service.GetPrvInfo(strCause, strPage, strOrder); JSON_PAGER list = JsonConvert.DeserializeObject <JSON_PAGER>(strJson); jsonMsg.Succeed = 1; jsonMsg.Message = list; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "ASSETS_CODE"; PagingParamter pager = new PagingParamter(); pager.PageSize = string.IsNullOrEmpty(request["limit"]) ? 10 : int.Parse(request["limit"].ToString()); pager.PageIndex = string.IsNullOrEmpty(request["offset"]) ? 0 : (int.Parse(request["offset"].ToString()) <= 0) ? 0 : int.Parse(request["offset"].ToString()) - 1; StringBuilder strCondition = new StringBuilder(); CauseObject_MCE_B_ASSETS p = new CauseObject_MCE_B_ASSETS(); if (!string.IsNullOrEmpty(request["status"])) { p.STATE = int.Parse(request["status"].ToString()); } if (!string.IsNullOrEmpty(request["type_id"])) { p.MACHINE_TYPE_ID = request["type_id"].ToString(); } if (!string.IsNullOrEmpty(request["brand"])) //品牌 { p.BRAND_NAME = "%" + request["brand"].ToString() + "%"; } if (!string.IsNullOrEmpty(request["use_state"]))//使用状态 { p.USE_STATE = request["use_state"].ToString(); } if (!string.IsNullOrEmpty(request["ownership_type_id"]))//权属信息 { p.OWNERSHIP_TYPE_ID = request["ownership_type_id"].ToString(); } if (!string.IsNullOrEmpty(request["assets_state"]))//资产状态 { p.ASSETS_STATE = request["assets_state"].ToString(); } if (!string.IsNullOrEmpty(request["card_type_id"]))//卡片类型 { p.CARD_TYPE_ID = request["card_type_id"].ToString(); } if (!string.IsNullOrEmpty(request["is_metering"]))//是否计量 { p.IS_METERING = int.Parse(request["is_metering"].ToString()); } if (!string.IsNullOrEmpty(request["is_force_sense"]))//是否强检设备 { p.IS_FORCE_SENSE = int.Parse(request["is_force_sense"].ToString()); } if (!string.IsNullOrEmpty(request["prv"]))//供应商 { p.PROVIDER_ID = request["prv"]; } if (!string.IsNullOrEmpty(request["prd"]))//生产厂家 { strCondition.Append(" and MDM_D_DEPT_PRD_ID.NAME like '%" + request["prd"].ToString().Trim() + "%'"); } //if (!string.IsNullOrEmpty(request["prv"]))//供应商 //{ // strCondition.Append(" and MDM_D_DEPT_PROVIDER_ID.NAME like '%" + request["prv"].ToString().Trim() + "%'"); //} if (!string.IsNullOrEmpty(request["usedept"]))//领用科室 { strCondition.Append(" and COM_DEPART_USING_DEPT_ID.NAME like '%" + request["usedept"].ToString().Trim() + "%'"); } if (!string.IsNullOrEmpty(request["cust_condition"]))//定制条件 { strCondition.Append(request["cust_condition"]); } if (!string.IsNullOrEmpty(request["condition"]))//条件 { strCondition.Append(" and (MCE_B_ASSETS.assets_code like '%" + request["condition"].ToString().Trim() + "%' or MCE_B_ASSETS.assets_name like '%" + request["condition"].ToString().Trim() + "%' or MCE_B_ASSETS.spec like '%" + request["condition"].ToString().Trim() + "%' or COM_DEPART_USING_DEPT_ID.NAME like '%" + request["condition"].ToString().Trim() + "%')"); } else { if (!string.IsNullOrEmpty(request["code"])) { p.ASSETS_CODE = "%" + request["code"].ToString() + "%"; } if (!string.IsNullOrEmpty(request["name"])) { p.ASSETS_NAME = "%" + request["name"].ToString() + "%"; } if (!string.IsNullOrEmpty(request["spec"]))//规格型号 { p.SPEC = "%" + request["spec"].ToString() + "%"; } } if (!string.IsNullOrEmpty(strCondition.ToString())) { p.SetCustomCondition(strCondition.ToString()); } List <DisplayObject_MCE_B_ASSETS> list = new List <DisplayObject_MCE_B_ASSETS>(); DisplayObject_MCE_B_ASSETS[] list0 = BizLogicObject_MCE_B_ASSETS.Proxy.Query(p, pager, orderBy); if (list0 != null && list0.Length > 0) { list = list0.ToList(); } string strNeedTotal = "1"; if (!string.IsNullOrEmpty(request["needTotal"]))//需要合计 { strNeedTotal = request["needTotal"]; } if (strNeedTotal == "1") { object objORIGINAL_VALUE = list.Sum(l => l.ORIGINAL_VALUE); object objNET_VALUE = list.Sum(l => l.NET_VALUE); DisplayObject_MCE_B_ASSETS pageItem = new DisplayObject_MCE_B_ASSETS(); pageItem.ASSETS_CODE = "小计"; if (!string.IsNullOrEmpty(objORIGINAL_VALUE.ToString())) { pageItem.ORIGINAL_VALUE = decimal.Parse(objORIGINAL_VALUE.ToString()); } if (!string.IsNullOrEmpty(objNET_VALUE.ToString())) { pageItem.NET_VALUE = decimal.Parse(objNET_VALUE.ToString()); } list.Add(pageItem); DisplayObject_MCE_B_ASSETS totalItem = BizLogicObject_MCE_B_ASSETS.Proxy.GetTotalRecord(p); list.Add(totalItem); } JSON_PAGER jsonPager = new JSON_PAGER(); jsonPager.total = pager.TotalRecords; jsonPager.rows = list; string strDropDown = "0"; if (!string.IsNullOrEmpty(request["dropdown"]))// { strDropDown = request["dropdown"]; } if (strDropDown == "1" && list != null && list.Count > 0) { foreach (DisplayObject_MCE_B_ASSETS item in list) { item.NAME = item.ASSETS_NAME; } } jsonMsg.Message = jsonPager; jsonMsg.Succeed = 1; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "CODE, POST_CODE"; PagingParamter pager = new PagingParamter(); pager.PageSize = string.IsNullOrEmpty(request["limit"]) ? 10 : int.Parse(request["limit"].ToString()); pager.PageIndex = string.IsNullOrEmpty(request["offset"]) ? 0 : (int.Parse(request["offset"].ToString()) <= 0) ? 0 : int.Parse(request["offset"].ToString()) - 1; StringBuilder strCondition = new StringBuilder(); string area = string.Empty; CauseObject_COM_DEPART pItem = new CauseObject_COM_DEPART(); if (!string.IsNullOrEmpty(request["code"])) { strCondition.Append(string.Format(" and COM_DEPART.CODE like upper('%{0}%') ", request["code"].ToString().Trim())); } if (!string.IsNullOrEmpty(request["area"])) { area = request["area"].ToString().Trim(); strCondition.Append(string.Concat(" and COM_DEPART.ID in (select distinct id from com_depart where parent_id is not null start with id = '", area, "' connect by parent_id= prior id) ")); } if (!string.IsNullOrEmpty(request["mcetype_id"])) { string mcetype_id = request["mcetype_id"].ToString().Trim(); strCondition.Append(string.Concat(" and COM_DEPART.ID in (select distinct dept_id from MCE_D_TYPE_DEPT where mce_type_id='", mcetype_id, "')")); } if (!string.IsNullOrEmpty(request["is_area"]) && request["is_area"].ToString().Trim() == "1") { area = BizLogicObject_MTR_D_MTR.Proxy.getAreaByDept(SystemLogic.Proxy.CurrentUser.DEPART_ID.Trim()); strCondition.Append(string.Concat(" and COM_DEPART.ID in (select distinct id from com_depart where parent_id is not null start with id = '", area, "' connect by parent_id= prior id) ")); } if (!string.IsNullOrEmpty(request["condition"])) { strCondition.Append(string.Format(" and (upper(COM_DEPART.CODE) like upper('%{0}%') or upper(COM_DEPART.NAME) like upper('%{0}%')) ", request["condition"].ToString().Trim())); } if (!string.IsNullOrEmpty(strCondition.ToString())) { pItem.SetCustomCondition(strCondition.ToString()); } List <JsonMtrDept> list = BizLogicObject_MTR_D_MTR.Proxy.getDeptList(pItem, pager, orderBy, area); JSON_PAGER jsonPager = new JSON_PAGER(); if (list == null) { throw new Exception("获取科室列表失败."); } jsonPager.total = pager.TotalRecords; jsonPager.rows = list; jsonMsg.Succeed = 1; jsonMsg.Message = jsonPager; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { context.Response.Write(JsonConvert.SerializeObject(jsonMsg)); context.Response.End(); } }