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_ASSETS_DEPR p = new CauseObject_MCE_B_ASSETS_DEPR(); p.ID = request["id"].ToString(); DisplayObject_MCE_B_ASSETS_DEPR[] listHead = BizLogicObject_MCE_B_ASSETS_DEPR.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_ID"; CauseObject_MCE_B_ASSETS_DEPR_D pd = new CauseObject_MCE_B_ASSETS_DEPR_D(); pd.BASE_ID = request["id"].ToString(); DisplayObject_MCE_B_ASSETS_DEPR_D[] listDetail = BizLogicObject_MCE_B_ASSETS_DEPR_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_ASSETS_DEPR cause, IDbTransaction transaction) { if (LocalMode) { return(HelperObject_MCE_B_ASSETS_DEPR.Delete(cause, transaction)); //平台自动生成代码 } else { throw new InvalidConstraintException(); } }
public DisplayObject_MCE_B_ASSETS_DEPR[] Query(CauseObject_MCE_B_ASSETS_DEPR cause, PagingParamter paging, OrderByParameter order) { if (LocalMode) { SystemLogic.Proxy.AuditQuery(cause); //平台自动生成代码 return(HelperObject_MCE_B_ASSETS_DEPR.Query(cause, paging, order)); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR>(ServiceUri)) { return(smgr.Service.Query(cause, paging, order)); } } }
public BizLogicMsg Delete(CauseObject_MCE_B_ASSETS_DEPR cause) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { int amount = HelperObject_MCE_B_ASSETS_DEPR.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_ASSETS_DEPR> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR>(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 strID = request["id"].ToString(); StringBuilder rsb = new StringBuilder(); int bytelengg = (int)request.InputStream.Length; using (var reader = new StreamReader(request.InputStream, Encoding.UTF8)) { var read = new Char[bytelengg]; var count = reader.Read(read, 0, bytelengg); while (count > 0) { var str = new string(read, 0, count); rsb.Append(str); count = reader.Read(read, 0, bytelengg); } reader.Close(); reader.Dispose(); request.InputStream.Close(); request.InputStream.Dispose(); } if (string.IsNullOrEmpty(rsb.ToString())) { throw new Exception("参数错误."); } JsonMCE_Depr entity = JsonConvert.DeserializeObject <JsonMCE_Depr>(rsb.ToString()); if (string.IsNullOrEmpty(entity.CODE)) { throw new Exception("参数错误,单号不能为空."); } if (string.IsNullOrEmpty(entity.DEPT_ID)) { throw new Exception("参数错误,计提科室不能为空."); } if (string.IsNullOrEmpty(entity.FINANCE_CYCLE)) { throw new Exception("参数错误,财务月份不能为空."); } if (entity.children != null && entity.children.Count > 0) { foreach (JsonMceDepr_D item in entity.children) { if (string.IsNullOrEmpty(item.ASSETS_ID)) { throw new Exception("参数错误,设备不能为空."); } } } else { // throw new Exception("没有明细数据"); } CauseObject_MCE_B_ASSETS_DEPR p = new CauseObject_MCE_B_ASSETS_DEPR(); p.DEPT_ID = entity.DEPT_ID; p.FINANCE_CYCLE = entity.FINANCE_CYCLE; string strCondition = ""; if (!string.IsNullOrEmpty(entity.ID)) { strCondition = strCondition + " and MCE_B_ASSETS_DEPR.ID<>'" + entity.ID + "'"; p.SetCustomCondition(strCondition); } DisplayObject_MCE_B_ASSETS_DEPR[] list = BizLogicObject_MCE_B_ASSETS_DEPR.Proxy.Query(p); if (list != null && list.Length > 0) { throw new Exception("计提科室:[" + list[0].DEPT_ID_NAME + "],财务月份[" + list[0].FINANCE_CYCLE + "]已经存在."); } BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_DEPR.Proxy.Save_Ext(entity); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; jsonMsg.Message = msg.Message; //jsonMsg.Message = "提交成功."; } 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_DEPR p = new CauseObject_MCE_B_ASSETS_DEPR(); if (!string.IsNullOrEmpty(request["code"])) { p.CODE = "%" + request["code"].ToString() + "%"; } if (!string.IsNullOrEmpty(request["dept"])) { p.DEPT_ID = request["dept"].ToString(); } if (!string.IsNullOrEmpty(request["user"])) { p.USER_ID = request["user"].ToString(); } if (!string.IsNullOrEmpty(request["finance_cycle"])) { p.FINANCE_CYCLE = request["finance_cycle"].ToString(); } if (!string.IsNullOrEmpty(request["status"])) { p.STATE = int.Parse(request["status"].ToString()); } 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_DEPR[] list = BizLogicObject_MCE_B_ASSETS_DEPR.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(); } }