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 int DeleteByTrans2(CauseObject_MCE_B_AOG_D cause, IDbTransaction transaction) { if (LocalMode) { return(HelperObject_MCE_B_AOG_D.Delete(cause, transaction)); //平台自动生成代码 } else { throw new InvalidConstraintException(); } }
public DisplayObject_MCE_B_AOG_D[] Query(CauseObject_MCE_B_AOG_D cause, PagingParamter paging, OrderByParameter order) { if (LocalMode) { SystemLogic.Proxy.AuditQuery(cause); //平台自动生成代码 return(HelperObject_MCE_B_AOG_D.Query(cause, paging, order)); } else { using (ServiceManager <ServiceContract_MCE_B_AOG_D> smgr = new ServiceManager <ServiceContract_MCE_B_AOG_D>(ServiceUri)) { return(smgr.Service.Query(cause, paging, order)); } } }
public BizLogicMsg Delete(CauseObject_MCE_B_AOG_D cause) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { int amount = HelperObject_MCE_B_AOG_D.Delete(cause, transaction); //平台自动生成代码 transaction.Commit(); } catch (Exception expt) { transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_AOG_D> smgr = new ServiceManager <ServiceContract_MCE_B_AOG_D>(ServiceUri)) { return(smgr.Service.Delete(cause)); } } }
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; string strIDS = ""; if (!string.IsNullOrEmpty(request["ids"])) { strIDS = request["ids"].ToString(); } if (string.IsNullOrEmpty(strIDS)) { throw new Exception("参数错误."); } string[] arrID = strIDS.Split(','); OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "assets_name"; CauseObject_MCE_B_AOG_D p = new CauseObject_MCE_B_AOG_D(); foreach (string strID in arrID) { p.SetINValue("BASE_ID", strID); } DisplayObject_MCE_B_AOG_D[] list = BizLogicObject_MCE_B_AOG_D.Proxy.Query(p); if (list != null && list.Length > 0) { foreach (DisplayObject_MCE_B_AOG_D item in list) { item.USING_ID = ""; item.USING_PERSON = ""; if (!string.IsNullOrEmpty(item.BASE_ID)) { CauseObject_MCE_B_AOG pHead = new CauseObject_MCE_B_AOG(); pHead.ID = item.BASE_ID; DisplayObject_MCE_B_AOG[] listHead = BizLogicObject_MCE_B_AOG.Proxy.Query(pHead); if (listHead != null && listHead.Length > 0) { item.USING_ID = listHead[0].USE_DEPT_ID; item.USING_PERSON = listHead[0].USE_DEPT_ID_NAME; } } } } jsonMsg.Message = list; 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(); } }