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; 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("参数错误."); } string strID = rsb.ToString(); if (string.IsNullOrEmpty(strID)) { throw new Exception("请选择折旧信息删除."); } BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_DEPR_ALLOT.Proxy.Delete_Ext(strID); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; } 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; List <JsonMceTypeTree> jsonTree = BizLogicObject_MCE_D_MCE_TYPE.Proxy.getMceTypeTree(); if (jsonTree == null || jsonTree.Count == 0) { throw new Exception("获取资产分类失败."); } jsonMsg.Succeed = 1; jsonMsg.Message = jsonTree; } 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; 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; 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; 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_code"; CauseObject_V_MCE_ASSET_OUTSTOCK_BACK p = new CauseObject_V_MCE_ASSET_OUTSTOCK_BACK(); foreach (string strID in arrID) { p.SetINValue("BASE_ID", strID); } DisplayObject_V_MCE_ASSET_OUTSTOCK_BACK[] list = BizLogicObject_V_MCE_ASSET_OUTSTOCK_BACK.Proxy.Query(p); 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(); } }
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; if (string.IsNullOrEmpty(request["id"])) { throw new Exception("参数错误."); } CauseObject_MCE_B_ASSETS_FILETEMPLATE_D p = new CauseObject_MCE_B_ASSETS_FILETEMPLATE_D(); p.BASE_ID = request["id"]; DisplayObject_MCE_B_ASSETS_FILETEMPLATE_D[] list = BizLogicObject_MCE_B_ASSETS_FILETEMPLATE_D.Proxy.Query(p); if (list == null || list.Length == 0) { throw new Exception("没有明细数据."); } 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(); } }
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; StringBuilder strCondition = new StringBuilder(); CauseObject_MCE_D_DEPR_TYPE p = new CauseObject_MCE_D_DEPR_TYPE(); if (!string.IsNullOrEmpty(request["condition"]))// { strCondition.Append(" and (MCE_D_DEPR_TYPE.CODE like '%" + request["condition"].ToString().Trim() + "%' or MCE_D_DEPR_TYPE.NAME like '%" + request["condition"].ToString().Trim() + "%' )"); } if (!string.IsNullOrEmpty(strCondition.ToString())) { p.SetCustomCondition(strCondition.ToString()); } DisplayObject_MCE_D_DEPR_TYPE[] list = BizLogicObject_MCE_D_DEPR_TYPE.Proxy.Query(p); 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(); } }
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 (request["id"] == null) { throw new Exception("参数错误."); } string strID = request["id"].ToString(); 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 json = service.GetMceAssetDetail(strID); jsonMsg.Succeed = 1; jsonMsg.Message = (JsonConvert.DeserializeObject <DisplayObject_PRV_B_ASSET>(json)); } 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; JsonMceAssetsUserInfo jsonMceAssetsUserInfo = new JsonMceAssetsUserInfo(); jsonMceAssetsUserInfo.user_id = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; jsonMceAssetsUserInfo.user_name = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.NAME; jsonMceAssetsUserInfo.dept_id = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.DEPART_ID; jsonMceAssetsUserInfo.dept_name = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.DEPART_ID_NAME; jsonMceAssetsUserInfo.sys_date = DateTime.Now.ToString("yyyy-MM-dd"); jsonMceAssetsUserInfo.finance_cycle = DateTime.Now.ToString("yyyyMM"); if (request["code_type"] != null) { string strCode = BizLogicObject_MCE_B_ASSETS.Proxy.Generate_Bill_Code(request["code_type"]); jsonMceAssetsUserInfo.code = strCode; } jsonMsg.Message = jsonMceAssetsUserInfo; jsonMsg.Succeed = 1; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { string strMsg = JsonConvert.SerializeObject(jsonMsg); 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; string strID = request["id"].ToString(); 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 jsonRegionAccount = service.GetAccountInfo(strID); jsonMsg.Succeed = 1; jsonMsg.Message = (JsonConvert.DeserializeObject <JsonRegionAccount>(jsonRegionAccount)); } 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; string strType = ""; if (!string.IsNullOrEmpty(request["oType"])) { strType = request["oType"]; } else { throw new Exception("参数错误."); } 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("参数错误."); } List <string> idList = JsonConvert.DeserializeObject <List <string> >(rsb.ToString()); if (idList == null || idList.Count == 0) { throw new Exception("参数错误."); } if (strType == "submit") { BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Submit_Ext2(idList); if (!msg.Succeed) { throw new Exception(msg.Message); } } else if (strType == "audit") { BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Audit_Ext2(idList); if (!msg.Succeed) { throw new Exception(msg.Message); } } else if (strType == "delete") { BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Delete_Ext2(idList); if (!msg.Succeed) { throw new Exception(msg.Message); } } else if (strType == "stop") { BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Stop_Ext2(idList); if (!msg.Succeed) { throw new Exception(msg.Message); } } else if (strType == "continue") { BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Continue_Ext2(idList[0]); if (!msg.Succeed) { throw new Exception(msg.Message); } } jsonMsg.Succeed = 1; } 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; if (string.IsNullOrEmpty(request["id"])) { throw new Exception("参数错误."); } OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "CODE"; StringBuilder strCondition = new StringBuilder(); CauseObject_MCE_B_ASSETS_CONTRACT p = new CauseObject_MCE_B_ASSETS_CONTRACT(); p.ASSETS_ID = request["id"]; if (!string.IsNullOrEmpty(request["condition"]))// { strCondition.Append(" and (MCE_B_ASSETS_CONTRACT.CODE like '%" + request["condition"].ToString().Trim() + "%' or MDM_D_DEPT_SECOND_PARTY.NAME like '%" + request["condition"].ToString().Trim() + "%' or COM_DEPART_FIRST_PARTY.NAME like '%" + request["condition"].ToString().Trim() + "%' or COM_TYPE_TYPE_ID.NAME like '%" + request["condition"].ToString().Trim() + "%' )"); } if (!string.IsNullOrEmpty(strCondition.ToString())) { p.SetCustomCondition(strCondition.ToString()); } DisplayObject_MCE_B_ASSETS_CONTRACT[] list = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Query(p, null, orderBy); if (list != null && list.Length > 0) { foreach (DisplayObject_MCE_B_ASSETS_CONTRACT item in list) { string strFiles = ""; CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE(); pCOM_FILE.REF_TAB_ID = item.ID; pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_CONTRACT"; DisplayObject_COM_FILE[] listCOM_FILE = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE); if (listCOM_FILE != null && listCOM_FILE.Length > 0) { foreach (DisplayObject_COM_FILE file in listCOM_FILE) { if (!string.IsNullOrEmpty(file.SERVER_NAME)) { strFiles = strFiles + file.SERVER_NAME + "/" + file.CLIENT_NAME + ","; } } strFiles = strFiles.TrimEnd(','); } item.BACKUP1 = strFiles; } } 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" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01", ""); 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; 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_Contract entity = JsonConvert.DeserializeObject <JsonMCE_Contract>(rsb.ToString()); if (string.IsNullOrEmpty(entity.CODE)) { throw new Exception("参数错误,合同编号不能为空."); } if (string.IsNullOrEmpty(entity.NAME)) { throw new Exception("参数错误,合同名称不能为空."); } if (string.IsNullOrEmpty(entity.SIGN_DATE)) { throw new Exception("参数错误,签定日期不能为空."); } if (string.IsNullOrEmpty(entity.EXPIRE_DATE)) { throw new Exception("参数错误,截止日期不能为空."); } if (string.IsNullOrEmpty(entity.FIRST_PARTY)) { throw new Exception("参数错误,甲方单位不能为空."); } if (string.IsNullOrEmpty(entity.SECOND_PARTY)) { throw new Exception("参数错误,乙方单位不能为空."); } if (string.IsNullOrEmpty(entity.MONEY)) { throw new Exception("参数错误,合同金额不能为空."); } if (entity.children != null && entity.children.Count > 0) { foreach (JsonMCE_Contract_D item in entity.children) { if (string.IsNullOrEmpty(item.ASSET_ID)) { throw new Exception("参数错误,设备名称不能为空."); } } } else { throw new Exception("没有明细数据"); } BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Save_Ext2(entity); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; jsonMsg.Message = msg.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, 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; // 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_PURCHASE_PLAN entity = JsonConvert.DeserializeObject <JsonMCE_PURCHASE_PLAN>(rsb.ToString()); if (string.IsNullOrEmpty(entity.CODE)) { throw new Exception("参数错误,单号不能为空."); } if (string.IsNullOrEmpty(entity.PRV_ID)) { throw new Exception("参数错误,供应商不能为空."); } if (string.IsNullOrEmpty(entity.PURCHASE_DEPT_ID)) { throw new Exception("参数错误,采购科室不能为空."); } if (entity.children != null && entity.children.Count > 0) { foreach (JsonMCE_PURCHASE_PLAN_D item in entity.children) { if (string.IsNullOrEmpty(item.TYPE_ID)) { throw new Exception("参数错误,设备类型不能为空."); } if (string.IsNullOrEmpty(item.ASSET_NAME)) { throw new Exception("参数错误,设备名称不能为空."); } if (item.AMOUNT <= 0) { throw new Exception("参数错误,设备数量不能为空."); } if (item.PRICE <= 0) { throw new Exception("参数错误,设备价格不能为空."); } } } else { throw new Exception("没有明细数据"); } BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_PURCHASE_PLAN.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 = int.MaxValue; //pager.PageIndex = 0; StringBuilder strCondition = new StringBuilder(); if (string.IsNullOrEmpty(request["id"])) { throw new Exception("参数错误."); } CauseObject_MCE_B_ASSETS_AFFIX p = new CauseObject_MCE_B_ASSETS_AFFIX(); p.ASSETS_ID = request["id"]; if (!string.IsNullOrEmpty(request["condition"]))// { strCondition.Append(" and (MCE_B_ASSETS_AFFIX.CODE like '%" + request["condition"].ToString().Trim() + "%' or MCE_B_ASSETS_AFFIX.NAME like '%" + request["condition"].ToString().Trim() + "%' or MCE_B_ASSETS_AFFIX.SPEC like '%" + request["condition"].ToString().Trim() + "%' )"); } if (!string.IsNullOrEmpty(strCondition.ToString())) { p.SetCustomCondition(strCondition.ToString()); } DisplayObject_MCE_B_ASSETS_AFFIX[] list = BizLogicObject_MCE_B_ASSETS_AFFIX.Proxy.Query(p, null, orderBy); if (list != null && list.Length > 0) { foreach (DisplayObject_MCE_B_ASSETS_AFFIX item in list) { string strFiles = ""; CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE(); pCOM_FILE.REF_TAB_ID = item.ID; pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_AFFIX"; DisplayObject_COM_FILE[] listCOM_FILE = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE); if (listCOM_FILE != null && listCOM_FILE.Length > 0) { foreach (DisplayObject_COM_FILE file in listCOM_FILE) { if (!string.IsNullOrEmpty(file.SERVER_NAME)) { strFiles = strFiles + file.SERVER_NAME + "/" + file.CLIENT_NAME + ","; } } strFiles = strFiles.TrimEnd(','); } item.BACKUP1 = strFiles; item.BACKUP2 = BarCodeHelper.GenerateBarCode(item.CODE); } } //JSON_PAGER jsonPager = new JSON_PAGER(); //jsonPager.total = pager.TotalRecords; //jsonPager.rows = list; 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(); } }
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(); } List <string> idList = JsonConvert.DeserializeObject <List <string> >(rsb.ToString()); foreach (string strID in idList) { CauseObject_MDM_D_DEPT p = new CauseObject_MDM_D_DEPT(); p.REF_ID = strID; p.AUDIT_STATE = "COM_1002_01"; DisplayObject_MDM_D_DEPT[] listExist = BizLogicObject_MDM_D_DEPT.Proxy.Query(p); if (listExist != null && listExist.Length > 0) { throw new Exception("供应商" + listExist[0].NAME + "已经审核."); } } BizLogicMsg msg = BizLogicObject_MCE_D_MCE_TYPE.Proxy.Save_Dept_Ext(idList); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; } 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; 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("参数错误."); } JsonMceAssetsWriteOff item = JsonConvert.DeserializeObject <JsonMceAssetsWriteOff>(rsb.ToString()); /* * if (string.IsNullOrEmpty(item.code)) * { * throw new Exception("报废单号不能为空."); * } */ if (string.IsNullOrEmpty(item.create_date)) { throw new Exception("报废日期不能为空."); } if (string.IsNullOrEmpty(item.finance_cycle)) { throw new Exception("财务月份不能为空."); } BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_WRITE_OFF.Proxy.Save_Ext(item); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; jsonMsg.Message = msg.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; CauseObject_MCE_B_ASSETS_MT_EXEC p = new CauseObject_MCE_B_ASSETS_MT_EXEC(); p.ID = request["id"].ToString(); DisplayObject_MCE_B_ASSETS_MT_EXEC[] listHead = BizLogicObject_MCE_B_ASSETS_MT_EXEC.Proxy.Query(p); JSON_PAGER_MT_EXEC jsonPager = new JSON_PAGER_MT_EXEC(); if (listHead == null) { throw new Exception("获取列表信息失败."); } if (listHead[0].STATE <= 1 && listHead[0].ACTUAL_EXEC_DATE < DateTime.Now.AddYears(-100)) { listHead[0].ACTUAL_EXEC_DATE = DateTime.Now; } jsonPager.head = listHead[0]; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "ASSETS_NAME"; CauseObject_MCE_B_ASSETS_MT_EXEC_D pd = new CauseObject_MCE_B_ASSETS_MT_EXEC_D(); pd.BASE_ID = request["id"].ToString(); DisplayObject_MCE_B_ASSETS_MT_EXEC_D[] listDetail = BizLogicObject_MCE_B_ASSETS_MT_EXEC_D.Proxy.Query(pd, null, orderBy); OrderByParameter orderByAttach = new OrderByParameter(); orderByAttach.Asc = false; orderByAttach.OrderBy = "CREATE_TIME"; CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE(); pCOM_FILE.REF_TAB_ID = request["id"]; pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_MT_EXEC"; List <JsonMCEMT_APPLY_MTN_ATTACH> list = new List <JsonMCEMT_APPLY_MTN_ATTACH>(); DisplayObject_COM_FILE[] listAttach = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE, null, orderByAttach); if (listAttach != null && listAttach.Length > 0) { foreach (DisplayObject_COM_FILE item in listAttach) { JsonMCEMT_APPLY_MTN_ATTACH attach = new JsonMCEMT_APPLY_MTN_ATTACH(); attach.ID = item.ID; attach.CLIENT_NAME = item.CLIENT_NAME; attach.SERVER_NAME = item.SERVER_NAME; attach.CREATE_USER_ID = item.CREATE_USER_ID; if (!string.IsNullOrEmpty(attach.CREATE_USER_ID)) { EntityObject_COM_USER entity = new EntityObject_COM_USER(); entity.ID = attach.CREATE_USER_ID; entity = BizLogicObject_COM_USER.Proxy.Get(entity); if (entity != null) { attach.CREATE_USER_ID_NAME = entity.NAME; } } attach.CREATE_TIME = item.CREATE_TIME; list.Add(attach); } } jsonPager.attach = list; 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; // 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("参数错误."); } JsonMceType jsonMceType = JsonConvert.DeserializeObject <JsonMceType>(rsb.ToString()); if (string.IsNullOrEmpty(jsonMceType.id)) { throw new Exception("参数错误."); } if (jsonMceType.listDeptID == null || jsonMceType.listDeptID.Count == 0) { throw new Exception("请选择科室."); } BizLogicMsg msg = BizLogicObject_MCE_D_MCE_TYPE.Proxy.Save_TypeDept(jsonMceType); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; } 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 = 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(); context.Response.ContentType = "text/json"; try { HttpRequest request = context.Request; HttpPostedFile file = request.Files.Count > 0 ? request.Files[0] : null; string folder = "mce\\"; string uploadPath = HttpRuntime.AppDomainAppPath.ToString(); if (uploadPath.EndsWith("\\")) { uploadPath = uploadPath + "upload\\" + folder; } else { uploadPath = uploadPath + "\\upload\\" + folder; } string guid = Guid.NewGuid().ToString(); string uploadName = guid; string aLastName = ""; byte[] photo = new byte[] { }; //原图 byte[] thumbPhoto = new byte[] { }; //缩略图 if (file != null) { if (!Directory.Exists(uploadPath)) { Directory.CreateDirectory(uploadPath); } aLastName = System.IO.Path.GetExtension(file.FileName).ToLower(); uploadName += aLastName; file.SaveAs(uploadPath + uploadName); } else { throw new Exception("未检测到上传文件, 请重试."); } List <string> listSuffix = new List <string>(); listSuffix.Add(".jpg"); listSuffix.Add(".png"); listSuffix.Add(".jpeg"); listSuffix.Add(".gif"); listSuffix.Add(".bmp"); JsonWriteOffFile fileEntity = new JsonWriteOffFile(); fileEntity.saveName = uploadName; fileEntity.fileName = file.FileName; fileEntity.userid = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; fileEntity.username = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.NAME; fileEntity.createdate = DateTime.Now; fileEntity.fileUrl = "upload/mce"; jsonMsg.Message = fileEntity; jsonMsg.Succeed = 1; } catch (Exception e) { jsonMsg.Succeed = 0; jsonMsg.Message = e.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"; 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; if (string.IsNullOrEmpty(request["id"])) { throw new Exception("参数错误."); } CauseObject_MCE_B_ASSETS_CONTRACT p = new CauseObject_MCE_B_ASSETS_CONTRACT(); p.ID = request["id"].ToString(); DisplayObject_MCE_B_ASSETS_CONTRACT[] listHead = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Query(p); JSON_PAGER_Contract jsonPager = new JSON_PAGER_Contract(); if (listHead == null) { throw new Exception("获取列表信息失败."); } jsonPager.head = listHead[0]; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "ASSETS_CODE"; CauseObject_MCE_B_ASSETS pd = new CauseObject_MCE_B_ASSETS(); pd.SetCustomCondition(" and MCE_B_ASSETS.ID in(select asset_id from MCE_B_ASSETS_CONTRACT_D where base_id='" + request["id"].ToString() + "')"); DisplayObject_MCE_B_ASSETS[] listDetail = BizLogicObject_MCE_B_ASSETS.Proxy.Query(pd, null, orderBy); jsonPager.total = listDetail.Length; jsonPager.rows = listDetail; OrderByParameter orderByPay = new OrderByParameter(); orderByPay.Asc = true; orderByPay.OrderBy = "PERIODS"; CauseObject_MCE_B_ASSETS_CONTRACT_PAY p_Pay = new CauseObject_MCE_B_ASSETS_CONTRACT_PAY(); p_Pay.BASE_ID = request["id"]; DisplayObject_MCE_B_ASSETS_CONTRACT_PAY[] listPay = BizLogicObject_MCE_B_ASSETS_CONTRACT_PAY.Proxy.Query(p_Pay, null, orderByPay); jsonPager.payRows = listPay; OrderByParameter orderByAttach = new OrderByParameter(); orderByAttach.Asc = false; orderByAttach.OrderBy = "CREATE_TIME"; CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE(); pCOM_FILE.REF_TAB_ID = request["id"]; pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_CONTRACT"; List <JsonMCEMT_APPLY_MTN_ATTACH> list = new List <JsonMCEMT_APPLY_MTN_ATTACH>(); DisplayObject_COM_FILE[] listAttach = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE, null, orderByAttach); if (listAttach != null && listAttach.Length > 0) { foreach (DisplayObject_COM_FILE item in listAttach) { JsonMCEMT_APPLY_MTN_ATTACH attach = new JsonMCEMT_APPLY_MTN_ATTACH(); attach.ID = item.ID; attach.CLIENT_NAME = item.CLIENT_NAME; attach.SERVER_NAME = item.SERVER_NAME; attach.CREATE_USER_ID = item.CREATE_USER_ID; if (!string.IsNullOrEmpty(attach.CREATE_USER_ID)) { EntityObject_COM_USER entity = new EntityObject_COM_USER(); entity.ID = attach.CREATE_USER_ID; entity = BizLogicObject_COM_USER.Proxy.Get(entity); if (entity != null) { attach.CREATE_USER_ID_NAME = entity.NAME; } } attach.CREATE_TIME = item.CREATE_TIME; list.Add(attach); } } jsonPager.attach = list; 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; 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(); } }
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["rollid"])) { throw new Exception("参数错误."); } if (string.IsNullOrEmpty(request["assetsid"])) { throw new Exception("参数错误."); } StringBuilder strCondition = new StringBuilder(); CauseObject_V_MCE_ASSETS_ROLLEQUIP p = new CauseObject_V_MCE_ASSETS_ROLLEQUIP(); p.ROLL_ID = request["rollid"]; p.SetCustomCondition(" and V_MCE_ASSETS_ROLLEQUIP.Assets_Id<>'" + request["assetsid"] + "'"); DisplayObject_V_MCE_ASSETS_ROLLEQUIP[] list = BizLogicObject_V_MCE_ASSETS_ROLLEQUIP.Proxy.Query(p); if (list != null && list.Length > 0) { for (int i = 0; i < list.Length; i++) { if (!string.IsNullOrEmpty(list[i].PICTURE)) { list[i].PICTURE = "../../upload/mce/" + list[i].PICTURE; } else { list[i].PICTURE = "../../images/icon/imgDefault.png"; } } } 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(); } }
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_PURCHASE p = new CauseObject_MCE_B_ASSETS_PURCHASE(); p.ID = request["id"].ToString(); DisplayObject_MCE_B_ASSETS_PURCHASE[] listHead = BizLogicObject_MCE_B_ASSETS_PURCHASE.Proxy.Query(p); if (listHead == null) { throw new Exception("获取列表信息失败."); } if (!string.IsNullOrEmpty(listHead[0].ASSET_ID)) { 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 json = service.GetMceAssetDetail(listHead[0].ASSET_ID); if (!string.IsNullOrEmpty(json)) { DisplayObject_PRV_B_ASSET entity = (JsonConvert.DeserializeObject <DisplayObject_PRV_B_ASSET>(json)); if (entity != null && !string.IsNullOrEmpty(entity.PICTURE)) { listHead[0].PICTURE = entity.PICTURE; } } } jsonMsg.Succeed = 1; jsonMsg.Message = listHead[0]; } 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; 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("参数错误."); } JsonWriteOffIdentity entity = JsonConvert.DeserializeObject <JsonWriteOffIdentity>(rsb.ToString()); if (string.IsNullOrEmpty(entity.ID)) { throw new Exception("参数错误,ID不能为空."); } if (string.IsNullOrEmpty(entity.IDENTITY_STATE)) { throw new Exception("参数错误,鉴定意见不能为空."); } if (string.IsNullOrEmpty(entity.IDENTITY_USER_ID)) { throw new Exception("参数错误,鉴定人不能为空."); } if (string.IsNullOrEmpty(entity.IDENTITY_TIME)) { throw new Exception("参数错误,鉴定日期不能为空."); } if (string.IsNullOrEmpty(entity.IDENTITY_PARAM)) { throw new Exception("参数错误,鉴定参数不能为空."); } BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_WRITE_OFF.Proxy.Identity(entity); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; jsonMsg.Message = msg.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; 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("参数错误."); } JsonMceAssetsContract item = JsonConvert.DeserializeObject <JsonMceAssetsContract>(rsb.ToString()); /* * if (string.IsNullOrEmpty(item.code)) * { * throw new Exception("合同编号不能为空."); * } */ if (string.IsNullOrEmpty(item.name)) { throw new Exception("合同名称不能为空."); } /* * CauseObject_MCE_B_ASSETS_CONTRACT p = new CauseObject_MCE_B_ASSETS_CONTRACT(); * p.CODE = item.code; * * * if (!string.IsNullOrEmpty(item.id)) * { * string strCondition = " and MCE_B_ASSETS_CONTRACT.ID<>'" + item.id + "'"; * p.SetCustomCondition(strCondition); * } * * * DisplayObject_MCE_B_ASSETS_CONTRACT[] list = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Query(p); * if (list != null && list.Length > 0) * { * throw new Exception("合同编号:[" + item.code + "]已经在用."); * } */ BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Save_Ext(item); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; jsonMsg.Message = msg.Message; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { context.Response.Write(JsonConvert.SerializeObject(jsonMsg)); context.Response.End(); } }