/// <summary> /// /// </summary> /// <param name="json"></param> /// <param name="centers"></param> /// <param name="assists"></param> protected void Initial(out CY.CSTS.Core.Business.InstrumentStatisticalJson json, out IEnumerable<CY.CSTS.Core.Business.UnitInfo> centers, out IEnumerable<CY.CSTS.Core.Business.UnitInfo> assists) { try { centers = CY.CSTS.Core.Business.UnitInfo.SelectUnitInfosByUnitFlag(CY.Utility.Common.CodeInterface.UnitFlag.SubCenter); if (centers != null) { centers = centers.Where(item => item.AuditingState == CY.Utility.Common.CodeInterface.UnitState.Audited); } assists = CY.CSTS.Core.Business.UnitInfo.SelectUnitInfosByUnitFlag(CY.Utility.Common.CodeInterface.UnitFlag.AssistUnit); if (assists != null) { assists = assists.Where(item => item.AuditingState == CY.Utility.Common.CodeInterface.UnitState.Audited); } json = new CY.CSTS.Core.Business.InstrumentStatisticalJson(); } catch (Exception ex) { throw ex; } }
public string HandlerRequest() { StringBuilder sbResult = new StringBuilder(); try { string strJson = string.Empty; string strcJson = string.Empty; CY.CSTS.Core.Business.InstrumentStatisticalJson json = null; CY.CSTS.Core.Business.StatisticalCategoryJson cjson = null; int project = 0; if (CY.Utility.Common.RequestUtility.IsGet) { strJson = CY.Utility.Common.RequestUtility.GetQueryString("json"); strcJson = CY.Utility.Common.RequestUtility.GetQueryString("cjson"); project = CY.Utility.Common.RequestUtility.GetQueryInt("project", 1); } else if (CY.Utility.Common.RequestUtility.IsPost) { strJson = CY.Utility.Common.RequestUtility.GetFormString("json"); strcJson = CY.Utility.Common.RequestUtility.GetFormString("cjson"); project = CY.Utility.Common.RequestUtility.GetFormInt("project", 1); } if (string.IsNullOrEmpty(strJson)) { json = new CY.CSTS.Core.Business.InstrumentStatisticalJson { }; } else { json = Newtonsoft.Json.JavaScriptConvert.DeserializeObject(strJson, typeof(CY.CSTS.Core.Business.InstrumentStatisticalJson)) as CY.CSTS.Core.Business.InstrumentStatisticalJson; } if (string.IsNullOrEmpty(strcJson)) { cjson = new CY.CSTS.Core.Business.StatisticalCategoryJson { max = 50.0m, min = 0.0m, name = string.Empty, sbname = string.Empty, type = "strip", x = "", y = "" }; } else { cjson = Newtonsoft.Json.JavaScriptConvert.DeserializeObject(strcJson, typeof(CY.CSTS.Core.Business.StatisticalCategoryJson)) as CY.CSTS.Core.Business.StatisticalCategoryJson; } if (json == null || cjson == null) { throw new Exception("the json which contain the data is null"); } sbResult.Append("{"); sbResult.Append("success:true"); sbResult.Append(string.Format(",header:\"{0}\"", ConstructorHeader(cjson, project))); sbResult.Append(",list:"); sbResult.Append(ConstructorContent(json, project)); sbResult.Append("}"); } catch (Exception ex) { throw ex; } return sbResult.ToString(); }