示例#1
0
 /// <summary>
 /// 下拉框报告期数据源
 /// </summary>
 /// <returns>下拉框报告期数据源</returns>
 public static DataTable QueryModReporttypexlk()
 {
     if (_modReporttypexlkDataTable != null)
     {
         return(_modReporttypexlkDataTable);
     }
     try
     {
         if (CommonService.ISCLIENT == ClientType.Config)
         {
             _modReporttypexlkDataTable = DataHelper.QueryData("MOD_REPORTTYPEXLK", null, null, null, null).Tables[0];
             return(_modReporttypexlkDataTable);
         }
         //定义文件夹
         String fileName = DataCenter.GetAppPath() + "\\NecessaryData\\MOD_REPORTTYPEXLK";
         if (File.Exists(fileName))
         {
             _modReporttypexlkDataTable =
                 JSONHelper.DeserializeObject <DataSet>(File.ReadAllText(fileName)).Tables[0];
             return(_modReporttypexlkDataTable);
         }
         return(DataHelper.QueryData("MOD_REPORTTYPEXLK", null, null, null, null).Tables[0]);
     }
     catch
     {
         return(DataHelper.QueryData("MOD_REPORTTYPEXLK", null, null, null, null).Tables[0]);
     }
 }
        private void AssignIndiatorParameterToSubIndicator(IndicatorEntity indicator, IndicatorEntity subIndicator)
        {
            List <ParamterObject> list  = JSONHelper.DeserializeObject <List <ParamterObject> >(indicator.Parameters);
            List <ParamterObject> list2 = JSONHelper.DeserializeObject <List <ParamterObject> >(subIndicator.Parameters);

            if ((list != null) && (list2 != null))
            {
                Dictionary <String, IndicatorEntity> dictionary = new Dictionary <String, IndicatorEntity>();
                foreach (ParamterObject obj2 in list2)
                {
                    foreach (ParamterObject obj3 in list)
                    {
                        if (!dictionary.ContainsKey(subIndicator.NO))
                        {
                            dictionary.Add(subIndicator.NO, subIndicator);
                        }
                        if (((!(obj3.Type == "419") && !(obj3.Type == "461")) && (obj3.IndicatorNo.Contains(subIndicator.NO) && !(obj2.Type != obj3.Type))) && !(obj2.DefaultValue.ToString() == obj3.DefaultValue.ToString()))
                        {
                            obj2.DefaultValue       = obj3.DefaultValue;
                            subIndicator.Parameters = JSONHelper.SerializeObject(list2);
                        }
                    }
                }
                foreach (IndicatorEntity entity in dictionary.Values)
                {
                    entity.CustomerId = DataCore.CreateInstance().GetIndicatorCusotmerId(entity);
                }
            }
        }
示例#3
0
 /// <summary>
 /// 查询专题最大报告期数据源
 /// </summary>
 /// <returns>专题最大报告期数据源</returns>
 public static DataTable QueryModMaxreportdate()
 {
     if (_modMaxreportdateDataTable != null)
     {
         return(_modMaxreportdateDataTable);
     }
     //while (!AppBaseServices.NecessaryDataIsLoaded)
     //{
     //  Thread.Sleep(10);
     //}
     try
     {
         if (CommonService.ISCLIENT == ClientType.Config)
         {
             return(DataHelper.QueryData("MOD_MAXREPORTDATE").Tables[0]);
         }
         //定义文件夹
         String fileName = DataCenter.GetAppPath() + "\\NecessaryData\\MOD_MAXREPORTDATE";
         if (File.Exists(fileName))
         {
             _modMaxreportdateDataTable =
                 JSONHelper.DeserializeObject <DataSet>(File.ReadAllText(fileName)).Tables[0];
             return(_modMaxreportdateDataTable);
         }
         return(null);
     }
     catch
     {
         return(DataHelper.QueryData("MOD_MAXREPORTDATE").Tables[0]);
     }
 }
示例#4
0
        ///// <summary>
        ///// 通过数据源名称进行数据查询
        ///// </summary>
        ///// <param name="datasourcename">数据源名称</param>
        ///// <returns>数据表</returns>
        //public static DataTable QueryByDatasoureName(String datasourcename)
        //{
        //    DataSet ds = QueryData(datasourcename);
        //    if (ds != null && ds.Tables.Count > 0)
        //        return ds.Tables[0];
        //    else
        //        return null;
        //}

        /// <summary>
        /// 查询专题分类
        /// </summary>
        /// <returns>专题分类数据表</returns>
        public static DataTable QuerySpeicalTopicCatory()
        {
            //if (EmReportWatch.SpecialCommon.CommonService.ISCLIENT == ClientType.Config)
            //{

            //  return QueryByDatasoureName("MOD_STC_ALL");
            if (CommonService.ISCLIENT == ClientType.Config)
            {
                List <String> feilds = new List <String>()
                {
                    "CATEGORYCODE", "CATEGORYNAME", "PCATEGORYCODE", "SORTCODE"
                };
                return(QueryData("MOD_STC_ALL", feilds.ToArray()).Tables[0]);
            }
            //}
            try
            {
                //定义文件夹
                String fileName = DataCenter.GetAppPath() + "\\NecessaryData\\MOD_STC_ALL";
                if (File.Exists(fileName))
                {
                    return(JSONHelper.DeserializeObject <DataSet>(File.ReadAllText(fileName)).Tables[0]);
                }
                return(null);
            }
            catch
            {
                return(null);
            }
        }
 public ResponseData <MyEntity> getEntity()
 {
     using (var httpclient = new HttpClient(new TracingHandler(ZipKinClientHelper.ServiceName)))
     {
         var callServiceUrl = "http://localhost:40179/api/values/entity";
         var response       = httpclient.GetStringAsync(callServiceUrl);
         var rst            = JSONHelper.DeserializeObject <ResponseData <MyEntity> >(response.Result);
         return(rst);
     }
 }
示例#6
0
 internal static T StringToObj <T>(String str)
 {
     try
     {
         return(JSONHelper.DeserializeObject <T>(str));
     }
     catch
     {
         return(default(T));
     }
 }
示例#7
0
 /// <summary>
 /// 查询专题
 /// </summary>
 /// <returns>专题树数据源</returns>
 public static DataTable QuerySpecialTopic()
 {
     //if (EmReportWatch.SpecialCommon.CommonService.ISCLIENT == ClientType.Config)
     //{
     //return QueryByDatasoureName("MOD_SS");
     if (CommonService.ISCLIENT == ClientType.Config)
     {
         try
         {
             List <String> feilds = new List <String>()
             {
                 "SPECIALTOPICCODE",
                 "SPECIALTOPICNAME",
                 "CATEGORYCODE",
                 "SORTCODE",
                 "IMPORTANT",
                 "ISSHOWBLOCK",
                 "CONFIGFILENAME"
             };
             DataSet ds = QueryData("MOD_SS", feilds.ToArray());
             if (ds.Tables.Count == 0)
             {
                 return(null);
             }
             return(ds.Tables[0]);
         }
         catch (Exception e)
         {
             CommonService.Log(e.ToString());
             MessageBox.Show(e.ToString());
         }
     }
     //}
     //while (!AppBaseServices.NecessaryDataIsLoaded)
     //{
     //  Thread.Sleep(10);
     //}
     try
     {
         //定义文件夹
         String fileName = DataCenter.GetAppPath() + "\\NecessaryData\\MOD_SS";
         if (File.Exists(fileName))
         {
             return(JSONHelper.DeserializeObject <DataSet>(File.ReadAllText(fileName)).Tables[0]);
         }
         return(null);
     }
     catch
     {
         return(null); // QueryByDatasoureName("MOD_SS");
     }
 }
 public ResponseData <UserOutPut> Login([FromBody] UserInput input)
 {
     using (var httpclient = new HttpClient(new TracingHandler(ZipKinClientHelper.ServiceName)))
     {
         var         callServiceUrl = "http://localhost:40179/api/values/Login";
         var         strBody        = JSONHelper.SerializeObject(input);
         HttpContent content        = new StringContent(strBody);
         var         response       = httpclient.PostAsync(callServiceUrl, content).Result;
         var         strResult      = response.Content.ReadAsStringAsync().Result;
         var         rst            = JSONHelper.DeserializeObject <ResponseData <UserOutPut> >(strResult);
         return(rst);
     }
 }
示例#9
0
        /// <summary>
        /// 批量保存手卫生依从性及正确性现场调查评分数据,采用的方式是根据主表ID 删掉数据表中的数据,再批量添加进去
        /// </summary>
        /// <param name="fkdModel"></param>
        /// <param name="fkdSourceModel"></param>
        /// <returns></returns>
        public void Save(BUS_HANDHYGIENE mainModel, string handSource)
        {
            if (!string.IsNullOrWhiteSpace(mainModel.HANDID))
            {
                //根据父ID删掉BUS_RISKINFECTION_SOURCE数据库表中的数据
                EntityOperate <BUS_HANDHYGIENE_SOURCE> .DeleteByFilter("HANDID='" + mainModel.HANDID + "' and ORGANID = '" + mainModel.ORGANID + "'");
            }

            if (string.IsNullOrWhiteSpace(mainModel.HANDID))
            {
                mainModel.HANDID = CommonService.GetPrimaryId(new GI_SerialInfo()
                {
                    Name = "BUS_HANDHYGIENE", ColumnName = "HANDID", OrganID = mainModel.ORGANID
                }) + "";
                mainModel.SaveModelM();
            }
            else
            {
                mainModel.UpdateM("HANDID");
            }

            Func <string, bool> checkVal = s =>
            {
                return(string.IsNullOrWhiteSpace(s));
            };
            var handSourceList     = JSONHelper.DeserializeObject <List <BUS_HANDHYGIENE_SOURCE> >(handSource, "yyyy-MM-dd HH:ss:mm");
            var handSourceFiltered = handSourceList.Where(p => p.SJDONE != null || p.SJDTWO != null || checkVal(p.XM) != true || checkVal(p.ZY) != true || checkVal(p.JCBRQ) != true || checkVal(p.JCBRH) != true || checkVal(p.JCWJWPQ) != true || checkVal(p.JCBRHJH) != true || checkVal(p.JCWWH) != true || checkVal(p.PCQ) != true || checkVal(p.DCZ) != true);

            // var riskSourceFiltered = riskSourceList.Where(p => string.IsNullOrWhiteSpace(p.FLMC) != true || string.IsNullOrWhiteSpace(p.NR) != true || string.IsNullOrWhiteSpace(p.QZ) != true || string.IsNullOrWhiteSpace(p.KNX) != true || string.IsNullOrWhiteSpace(p.HGSS) != true || string.IsNullOrWhiteSpace(p.DQTX) != true || string.IsNullOrWhiteSpace(p.FZ) != true);

            //过滤后的数据集合大于0
            if (handSourceFiltered.Count() > 0)
            {
                //把过滤后的数据插入数据库
                foreach (var handSourceModel in handSourceFiltered)
                {
                    handSourceModel.HANDSID = CommonService.GetPrimaryId(new GI_SerialInfo()
                    {
                        Name = "BUS_HANDHYGIENE_SOURCE", ColumnName = "HANDSID", OrganID = mainModel.ORGANID
                    }) + "";
                    handSourceModel.ORGANID = mainModel.ORGANID;
                    handSourceModel.HANDID  = mainModel.HANDID;
                    handSourceModel.SaveModelM();
                }
            }
        }
示例#10
0
        /// <summary>
        /// 批量医院感染病例个案调查和血清学 和 病原学检测,采用的方式是根据主表ID 删掉数据表中的数据,再批量添加进去
        /// </summary>
        /// <param name="fkdModel"></param>
        /// <param name="fkdSourceModel"></param>
        /// <returns></returns>
        public void Save(BUS_INFECTIONEXAMINE examModel, string examBloodSource)
        {
            if (!string.IsNullOrWhiteSpace(examModel.EXID))
            {
                //根据父ID删掉 BUS_DRUGRESISTQUAR_SOURCE 数据库表中的数据
                EntityOperate <BUS_INFECTIONEXAMINE_BLOOD> .DeleteByFilter("EXID='" + examModel.EXID + "' and ORGANID = '" + examModel.ORGANID + "'");
            }

            if (string.IsNullOrWhiteSpace(examModel.EXID))
            {
                examModel.EXID = CommonService.GetPrimaryId(new GI_SerialInfo()
                {
                    Name = "BUS_INFECTIONEXAMINE", ColumnName = "EXID", OrganID = examModel.ORGANID
                }) + "";
                examModel.SaveModelM();
            }
            else
            {
                examModel.UpdateM("EXID");
            }

            var examBloodSourceList         = JSONHelper.DeserializeObject <List <BUS_INFECTIONEXAMINE_BLOOD> >(examBloodSource, "yyyy-MM-dd HH:ss:mm");
            Func <string, bool> checkEmNull = a =>
            {
                return(string.IsNullOrWhiteSpace(a));
            };

            var examBloodSourceFiltered = examBloodSourceList.Where(p => checkEmNull(p.BBLX) != true || p.CYSJ != null || checkEmNull(p.JCXM) != true || checkEmNull(p.JCFF) != true || checkEmNull(p.JCDW) != true || checkEmNull(p.JCJG) != true);

            //过滤后的数据集合大于0
            if (examBloodSourceFiltered.Count() > 0)
            {
                //把过滤后的数据插入数据库
                foreach (var examSourceModel in examBloodSourceFiltered)
                {
                    examSourceModel.BLOODID = CommonService.GetPrimaryId(new GI_SerialInfo()
                    {
                        Name = "BUS_INFECTIONEXAMINE_BLOOD", ColumnName = "BLOODID", OrganID = examModel.ORGANID
                    }) + "";
                    examSourceModel.ORGANID = examModel.ORGANID;
                    examSourceModel.EXID    = examModel.EXID;
                    examSourceModel.SaveModelM();
                }
            }
        }
        /// <summary>
        /// 批量保存环境检测列表数据,采用的方式是根据主表ID 删掉数据表中的数据,再批量添加进去
        /// </summary>
        /// <param name="fkdModel"></param>
        /// <param name="fkdSourceModel"></param>
        /// <returns></returns>
        public void Save(BUS_ENVIRONMENTTEST envModel, string envSource)
        {
            if (!string.IsNullOrWhiteSpace(envModel.ENVID))
            {
                //根据父ID删掉 BUS_DRUGRESISTQUAR_SOURCE 数据库表中的数据
                EntityOperate <BUS_ENVIRONMENTTEST_SOURCE> .DeleteByFilter("ENVID='" + envModel.ENVID + "' and ORGANID = '" + envModel.ORGANID + "'");
            }

            if (string.IsNullOrWhiteSpace(envModel.ENVID))
            {
                envModel.ENVID = CommonService.GetPrimaryId(new GI_SerialInfo()
                {
                    Name = "BUS_ENVIRONMENTTEST", ColumnName = "ENVID", OrganID = envModel.ORGANID
                }) + "";
                envModel.SaveModelM();
            }
            else
            {
                envModel.UpdateM("ENVID");
            }

            var envSourceList = JSONHelper.DeserializeObject <List <BUS_ENVIRONMENTTEST_SOURCE> >(envSource);
            Func <string, bool> checkEmNull = a =>
            {
                return(string.IsNullOrWhiteSpace(a));
            };

            var envSourceFiltered = envSourceList.Where(p => checkEmNull(p.SQDFL) != true || checkEmNull(p.SQKSNAME) != true || checkEmNull(p.BB) != true || checkEmNull(p.XJSL) != true || checkEmNull(p.JG) != true || checkEmNull(p.HG) != true || checkEmNull(p.BZ) != true);

            //过滤后的数据集合大于0
            if (envSourceFiltered.Count() > 0)
            {
                //把过滤后的数据插入数据库
                foreach (var envSourceModel in envSourceFiltered)
                {
                    envSourceModel.ENSID = CommonService.GetPrimaryId(new GI_SerialInfo()
                    {
                        Name = "BUS_ENVIRONMENTTEST_SOURCE", ColumnName = "ENSID", OrganID = envModel.ORGANID
                    }) + "";
                    envSourceModel.ORGANID = envModel.ORGANID;
                    envSourceModel.ENVID   = envModel.ENVID;
                    envSourceModel.SaveModelM();
                }
            }
        }
示例#12
0
 /// <summary>
 /// 经济指标图表数据源
 /// </summary>
 /// <returns>经济指标图表数据源</returns>
 public static DataTable QueryMAC_JJZBTB_TJ()
 {
     try
     {
         // return SpecialCommon.DataHelper.QueryData("MAC_JJZBTB", null, null, null, null, true, "MAC_JJZBTB_TJ").Tables[0];
         //定义文件夹
         String fileName = DataCenter.GetAppPath() + "\\NecessaryData\\MAC_JJZBTB_TJ";
         if (File.Exists(fileName))
         {
             return(JSONHelper.DeserializeObject <DataSet>(File.ReadAllText(fileName)).Tables[0]);
         }
         return(null);
     }
     catch
     {
         return(null);
     }
 }
示例#13
0
        protected Dictionary <String, object> BuildParamDictionary(String parameters)
        {
            Dictionary <String, object> dictionary = new Dictionary <String, object>();

            if (!String.IsNullOrEmpty(parameters) && !parameters.Trim().Equals("null"))
            {
                List <ParamterObject> indicatorParameterList = JSONHelper.DeserializeObject <List <ParamterObject> >(parameters);
                base.ResolveObjectParameters(indicatorParameterList);
                foreach (ParamterObject obj2 in indicatorParameterList)
                {
                    if (obj2.Type.Equals("261"))
                    {
                        continue;
                    }
                    if (String.IsNullOrEmpty(obj2.Name))
                    {
                        if (obj2.Type != "279")
                        {
                            dictionary["fieldname"] = obj2.DefaultValue;
                        }
                        else if (obj2.Name.Trim().Equals("type"))
                        {
                            String str = obj2.DefaultValue.ToString();
                            dictionary["type"] = str.Substring(str.Length - 1, 1);
                        }
                        continue;
                    }
                    if ((obj2.Name.Trim().Equals("type") && (obj2.Type != "115")) && (obj2.Type != "219"))
                    {
                        int    result = 0;
                        String s      = obj2.DefaultValue.ToString();
                        if (!int.TryParse(s, out result))
                        {
                            s = s.Substring(s.Length - 1, 1);
                        }
                        dictionary["type"] = s;
                        continue;
                    }
                    dictionary[obj2.Name.Trim().ToLower()] = obj2.DefaultValue;
                }
            }
            return(dictionary);
        }
示例#14
0
 public void Sub()
 {
     try {
         var queueArg = new Dictionary <string, object>();
         queueArg.Add("x-dead-letter-exchange", MQ_DLX_EXCHANGE);//过期消息转向路由
         Subscribe(ref connection, ref channel, MQ_USER_EXCHANGE, MQ_USER_QUEUE, MQ_USER_ROUTEKEY, null, queueArg);
         var headers = new Dictionary <string, object>();
         //all:表示所有的键值对都匹配才能接受到消息
         //any:表示只要有键值对匹配就能接受到消息
         headers.Add("x-match", "all");
         headers.Add("RouteKey", MQ_USER_ROUTEKEY);
         channel.QueueBind(MQ_USER_QUEUE, MQ_USER_EXCHANGE, MQ_USER_ROUTEKEY, headers);
         consumer           = new EventingBasicConsumer(channel);
         consumer.Received += (model, ea) =>
         {
             try {
                 var userInfo = JSONHelper.DeserializeObject <MQMessage <UserInfo> >(ea.Body);
                 _ILogRepository.AddMQLog(userInfo);
                 //if (_IUserDetailRepository.Add(userInfo.Data.UserID, userInfo.Data.UserName))
                 //{
                 //    //处理业务逻辑成功
                 //    channel.BasicAck(ea.DeliveryTag, false);
                 //}
                 //else
                 //{
                 //处理业务逻辑失败
                 //channel.BasicReject(ea.DeliveryTag, false);
                 Reject <UserInfo>(channel, ea, userInfo);
                 //}
             }
             catch (Exception ex) {
                 //处理业务逻辑报错
                 //Reject(channel, ea);
                 //channel.BasicReject(ea.DeliveryTag, false);
             }
         };
         channel.BasicConsume(MQ_USER_QUEUE, false, consumer);
     }
     catch (Exception ex) {
     }
 }
示例#15
0
        public override String Coding()
        {
            List <String> list = new List <String>();

            foreach (IndicatorEntity entity in this._indicatorList)
            {
                list.Add(entity.IndicatorCode);
            }
            StringBuilder builder = new StringBuilder();

            builder.AppendLine("$-fun");
            builder.AppendLine(String.Format("$name={0}", String.Join(",", list.ToArray())));
            builder.AppendLine("$secucode=");
            foreach (IndicatorEntity entity2 in this._indicatorList)
            {
                String str = String.Format("$TableName={0},StartDate={1},EndDate={2},Period={3},IsHistory=0,publishcode={4}", new object[] { entity2.CustomerId, this._blockParam.StartDate.ToString("yyyy-MM-dd"), this._blockParam.EndDate.ToString("yyyy-MM-dd"), ((int)this._blockParam.Cycle) + 1, String.Join(",", this._blockList.ToArray()) });
                List <ParamterObject> indicatorParameterList = JSONHelper.DeserializeObject <List <ParamterObject> >(entity2.Parameters);
                base.ResolveObjectParameters(indicatorParameterList);
                List <String> list3 = new List <String>();
                foreach (ParamterObject obj2 in indicatorParameterList)
                {
                    if (!obj2.IsHide && !obj2.Type.Equals("261"))
                    {
                        if (String.IsNullOrEmpty(obj2.Name))
                        {
                            if (obj2.Name.Trim().Equals("type"))
                            {
                                String str2 = obj2.DefaultValue.ToString();
                                list3.Add(String.Format("type={0}", str2.Substring(str2.Length - 1, 1)));
                            }
                        }
                        else
                        {
                            list3.Add(String.Format("{0}={1}", obj2.Name.Trim(), obj2.DefaultValue));
                        }
                    }
                }
                builder.AppendLine(str + "," + String.Join(",", list3.ToArray()));
            }
            return(builder.ToString().TrimEnd(new char[0]));
        }
示例#16
0
        public override bool Decoding(byte[] bytes)
        {
            if (((bytes != null) && (bytes.Length > 0)) && bytes[0].ToString().Equals("48"))
            {
                return(false);
            }
            bool            flag   = true;
            IndicatorEntity entity = null;

            try
            {
                entity = JSONHelper.DeserializeObject <IndicatorEntity>(Encoding.UTF8.GetString(bytes));
                IndicatorDataCore.SetIndicatorEntity(this._categoryCode, entity);
            }
            catch (Exception exception)
            {
                //LogUtility.LogMessage("获取指标实体解包失败," + exception.ToString());
                flag = false;
            }
            return(flag);
        }
示例#17
0
        public static DataTable GetTreeCategoryTableFromFile(MacroDataType treeType)
        {
            DataTable table = null;

            try
            {
                String str  = MongoDBConstant.DicTreeSource[treeType];
                String path = Path.Combine(LocalStorageRootDir, str);
                if (!File.Exists(path))
                {
                    //EMLoggerHelper.Write("File name '{0}' have not been found(path:'{1}')!", new object[] { str, path });
                    return(null);
                }
                table = JSONHelper.DeserializeObject <DataSet>(File.ReadAllText(path)).Tables[0];
            }
            catch (Exception exception)
            {
                //EMLoggerHelper.Write(exception);
            }
            return(table);
        }
示例#18
0
 public override bool Decoding(byte[] bytes)
 {
     if (((bytes != null) && (bytes.Length > 0)) && bytes[0].ToString().Equals("48"))
     {
         return(false);
     }
     try
     {
         String   str        = Encoding.UTF8.GetString(bytes);
         int      index      = str.IndexOf('|');
         String   str2       = str.Substring(0, index);
         String   str3       = str.Substring(index + 1);
         String[] strArray   = str2.Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries);
         int      startIndex = 0;
         if ((strArray != null) && (strArray.Length > 0))
         {
             for (int i = 0; i < strArray.Length; i++)
             {
                 if ((i % 2) == 0)
                 {
                     int    length       = Convert.ToInt32(strArray[i]);
                     String categoryCode = str3.Substring(startIndex, length);
                     startIndex += length;
                     int    num5 = Convert.ToInt32(strArray[i + 1]);
                     String str5 = str3.Substring(startIndex, num5);
                     startIndex += num5;
                     IndicatorEntity entity = JSONHelper.DeserializeObject <IndicatorEntity>(str5);
                     this.IndicatorEntityDict[categoryCode] = entity;
                     IndicatorDataCore.SetIndicatorEntity(categoryCode, entity);
                 }
             }
         }
         return(true);
     }
     catch (Exception exception)
     {
         //LogUtility.LogMessage("获取指标实体List解包失败," + exception.Message + exception.StackTrace);
         return(false);
     }
 }
示例#19
0
        /// <summary>
        /// 批量保存感染风险评估数据,采用的方式是根据风险表ID 删掉数据表中的数据,再批量添加进去
        /// </summary>
        /// <param name="fkdModel"></param>
        /// <param name="fkdSourceModel"></param>
        /// <returns></returns>
        public void Save(BUS_RISKINFECTION riskModel, string riskSource)
        {
            if (!string.IsNullOrWhiteSpace(riskModel.RISKID))
            {
                //根据父ID删掉BUS_RISKINFECTION_SOURCE数据库表中的数据
                EntityOperate <BUS_RISKINFECTION_SOURCE> .DeleteByFilter("RISKID='" + riskModel.RISKID + "' and ORGANID = '" + riskModel.ORGANID + "'");
            }

            if (string.IsNullOrWhiteSpace(riskModel.RISKID))
            {
                riskModel.RISKID = CommonService.GetPrimaryId(new GI_SerialInfo()
                {
                    Name = "BUS_RISKINFECTION", ColumnName = "RISKID", OrganID = riskModel.ORGANID
                }) + "";
                riskModel.SaveModelM();
            }
            else
            {
                riskModel.UpdateM("RISKID");
            }

            var riskSourceList     = JSONHelper.DeserializeObject <List <BUS_RISKINFECTION_SOURCE> >(riskSource);
            var riskSourceFiltered = riskSourceList.Where(p => string.IsNullOrWhiteSpace(p.FLMC) != true || string.IsNullOrWhiteSpace(p.NR) != true || string.IsNullOrWhiteSpace(p.QZ) != true || string.IsNullOrWhiteSpace(p.KNX) != true || string.IsNullOrWhiteSpace(p.HGSS) != true || string.IsNullOrWhiteSpace(p.DQTX) != true || string.IsNullOrWhiteSpace(p.FZ) != true);

            //过滤后的数据集合大于0
            if (riskSourceFiltered.Count() > 0)
            {
                //把过滤后的数据插入数据库
                foreach (var riskSourceModel in riskSourceFiltered)
                {
                    riskSourceModel.SOURCEID = CommonService.GetPrimaryId(new GI_SerialInfo()
                    {
                        Name = "BUS_RISKINFECTION_SOURCE", ColumnName = "SOURCEID", OrganID = riskModel.ORGANID
                    }) + "";
                    riskSourceModel.ORGANID = riskModel.ORGANID;
                    riskSourceModel.RISKID  = riskModel.RISKID;
                    riskSourceModel.SaveModelM();
                }
            }
        }
示例#20
0
        /// <summary>
        /// 批量保存多重耐药菌隔离措施数据,采用的方式是根据主表ID 删掉数据表中的数据,再批量添加进去
        /// </summary>
        /// <param name="fkdModel"></param>
        /// <param name="fkdSourceModel"></param>
        /// <returns></returns>
        public void Save(BUS_DRUGRESISTQUAR drugModel, string drugSource)
        {
            if (!string.IsNullOrWhiteSpace(drugModel.DCID))
            {
                //根据父ID删掉 BUS_DRUGRESISTQUAR_SOURCE 数据库表中的数据
                EntityOperate <BUS_DRUGRESISTQUAR_SOURCE> .DeleteByFilter("DCID='" + drugModel.DCID + "' and ORGANID = '" + drugModel.ORGANID + "'");
            }

            if (string.IsNullOrWhiteSpace(drugModel.DCID))
            {
                drugModel.DCID = CommonService.GetPrimaryId(new GI_SerialInfo()
                {
                    Name = "BUS_DRUGRESISTQUAR", ColumnName = "DCID", OrganID = drugModel.ORGANID
                }) + "";
                drugModel.SaveModelM();
            }
            else
            {
                drugModel.UpdateM("DCID");
            }

            var drugSourceFiltered = JSONHelper.DeserializeObject <List <BUS_DRUGRESISTQUAR_SOURCE> >(drugSource);

            //过滤后的数据集合大于0
            if (drugSourceFiltered.Count() > 0)
            {
                //把过滤后的数据插入数据库
                foreach (var drugSourceModel in drugSourceFiltered)
                {
                    drugSourceModel.DRUGID = CommonService.GetPrimaryId(new GI_SerialInfo()
                    {
                        Name = "BUS_DRUGRESISTQUAR_SOURCE", ColumnName = "DRUGID", OrganID = drugModel.ORGANID
                    }) + "";
                    drugSourceModel.ORGANID = drugModel.ORGANID;
                    drugSourceModel.DCID    = drugModel.DCID;
                    drugSourceModel.SaveModelM();
                }
            }
        }
示例#21
0
 //查询专题
 /// <summary>
 /// 经济指标图表数据源
 /// </summary>
 /// <returns>经济指标图表数据源</returns>
 public static DataTable QueryMAC_JJZBTB()
 {
     //while (!AppBaseServices.NecessaryDataIsLoaded)
     //{
     //    Thread.Sleep(10);
     //}
     //return SpecialCommon.DataHelper.QueryData("MAC_JJZBTB", null, null, null, null).Tables[0];
     try
     {
         //定义文件夹
         String fileName = DataCenter.GetAppPath() + "\\NecessaryData\\MAC_JJZBTB";
         if (File.Exists(fileName))
         {
             return(JSONHelper.DeserializeObject <DataSet>(File.ReadAllText(fileName)).Tables[0]);
         }
         return(null);
     }
     catch
     {
         return(null);
     }
 }
示例#22
0
        public static void ExecuteMethod(ActionHandler AH, ActionInputParams p, NodeGingerAction GA)
        {
            try
            {
                ParameterInfo[] PIs = AH.MethodInfo.GetParameters();

                object[] parameters = new object[PIs.Count()];

                int paramnum = 0;
                foreach (ParameterInfo PI in PIs)
                {
                    if (paramnum == 0)
                    {
                        // verify param 0 is GA
                        parameters[0] = GA;
                    }
                    else
                    {
                        object ActionParam = p[PI.Name];
                        if (ActionParam != null)
                        {
                            object val = null;
                            // For each type we need to get the val correctly so the function will get it right

                            if (PI.ParameterType == typeof(string))
                            {
                                val = p[PI.Name].Value;
                            }
                            else if (PI.ParameterType.IsEnum)
                            {
                                if (p[PI.Name].Value != null)
                                {
                                    val = Enum.Parse(PI.ParameterType, p[PI.Name].Value.ToString());
                                }
                                else
                                {
                                    // TODO: err or check if it is nullable enum
                                }
                            }
                            else if (PI.ParameterType == typeof(Int32))
                            {
                                val = p[PI.Name].GetValueAsInt();
                            }
                            else if (PI.ParameterType.IsGenericType && PI.ParameterType.GetGenericTypeDefinition() == typeof(List <>))
                            {
                                // This is List of objects
                                Type itemType = PI.ParameterType.GetGenericArguments()[0]; // List item type
                                Type listType = typeof(List <>).MakeGenericType(itemType); // List with the item type
                                // val = Activator.CreateInstance(listType);
                                val = JSONHelper.DeserializeObject(p[PI.Name].Value.ToString(), listType);
                            }
                            else
                            {
                                val = p[PI.Name].Value;
                            }

                            parameters[paramnum] = val;
                        }
                        else
                        {
                            //check if param is optional then ignore
                            if (!PI.HasDefaultValue)
                            {
                                throw new Exception("GingerAction is Missing Param/Value for ActionParam - " + PI.Name);
                            }
                            else
                            {
                                // from here on all params are optional...
                            }
                        }
                    }
                    paramnum++;
                }
                AH.MethodInfo.Invoke(AH.Instance, parameters);   // here is where we call the action directly with the relevant parameters
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null)
                {
                    message += Environment.NewLine + ex.InnerException.Message;
                }
                GA.AddError("Error when trying to invoke: " + AH.ServiceActionId + " - " + message);
            }
        }
        public override String Coding()
        {
            this._customIndicatorDictionary = new Dictionary <int, IndicatorEntity>();
            foreach (IndicatorEntity entity in this.IndicatorList)
            {
                if (((entity.CustomIndicator == null) || (entity.CustomIndicator.IndicatorList == null)) || (entity.CustomIndicator.IndicatorList.Count == 0))
                {
                    this._customIndicatorDictionary[entity.CustomerId] = entity;
                }
                else
                {
                    foreach (IndicatorEntity entity2 in entity.CustomIndicator.IndicatorList)
                    {
                        this._customIndicatorDictionary[entity2.CustomerId] = entity2;
                    }
                }
            }
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("$-{0}{1}", CommonEnumerators.GetIndicatorRequestTypeCmd(this._requestDataType), Environment.NewLine);
            List <String> list  = new List <String>();
            List <String> list2 = new List <String>();

            foreach (KeyValuePair <int, IndicatorEntity> pair in this._customIndicatorDictionary)
            {
                IndicatorEntity entity3 = pair.Value;
                list.Add(entity3.IndicatorCode);
                List <String> list3 = new List <String>();
                list3.Add(String.Format("$TableName={0}", entity3.CustomerId));
                if (String.IsNullOrEmpty(entity3.Parameters) || entity3.Parameters.Equals("null"))
                {
                    list2.Add(String.Join(",", list3.ToArray()));
                    continue;
                }
                List <ParamterObject> indicatorParameterList = JSONHelper.DeserializeObject <List <ParamterObject> >(entity3.Parameters);
                base.ResolveObjectParameters(indicatorParameterList);
                foreach (ParamterObject obj2 in indicatorParameterList)
                {
                    if (obj2.Type.Equals("261"))
                    {
                        continue;
                    }
                    if (String.IsNullOrEmpty(obj2.Name))
                    {
                        if (obj2.Type != "279")
                        {
                            list3.Add(String.Format("FieldName={0}", obj2.DefaultValue));
                        }
                        else if (obj2.Name.Trim().Equals("type"))
                        {
                            String str = obj2.DefaultValue.ToString();
                            list3.Add(String.Format("type={0}", str.Substring(str.Length - 1, 1)));
                        }
                        continue;
                    }
                    if ((obj2.Name.Trim().Equals("type") && (obj2.Type != "115")) && (obj2.Type != "219"))
                    {
                        int    result = 0;
                        String s      = obj2.DefaultValue.ToString();
                        if (!int.TryParse(s, out result))
                        {
                            s = s.Substring(s.Length - 1, 1);
                        }
                        list3.Add(String.Format("type={0}", s));
                        continue;
                    }
                    list3.Add(String.Format("{0}={1}", obj2.Name.Trim(), obj2.DefaultValue));
                }
                list2.Add(String.Join(",", list3.ToArray()));
            }
            builder.AppendFormat("$name={0}{1}", String.Join(",", list.ToArray()), Environment.NewLine);
            foreach (StockEntity entity4 in this._stockList)
            {
                if (!this._categoryStockCodeDict.ContainsKey(entity4.CategoryCode))
                {
                    this._categoryStockCodeDict[entity4.CategoryCode] = new List <String>();
                }
                this._categoryStockCodeDict[entity4.CategoryCode].Add(entity4.StockCode);
            }
            List <String> list5 = new List <String>();

            foreach (KeyValuePair <int, List <String> > pair2 in this._categoryStockCodeDict)
            {
                list5.Add(String.Format("{0}:{1}", pair2.Key, String.Join(",", pair2.Value.ToArray())));
            }
            builder.AppendFormat("$secucode={0}{1}", String.Join("#", list5.ToArray()), Environment.NewLine);
            builder.Append(String.Join(Environment.NewLine, list2.ToArray()));
            return(builder.ToString());
        }
示例#24
0
 /// <summary>
 /// 将字符串转换成ApolloConfig
 /// </summary>
 /// <param name="json"></param>
 /// <returns></returns>
 public static ApolloConfig Parse(string json)
 {
     return(JSONHelper.DeserializeObject <ApolloConfig>(json));
 }
示例#25
0
        protected void ResolveObjectParameters(List <ParamterObject> indicatorParameterList)
        {
            String str  = String.Empty;
            String str2 = String.Empty;

            foreach (ParamterObject obj2 in indicatorParameterList)
            {
                String str4;
                String str5;
                if ((!obj2.Type.Equals("106") && !obj2.Type.Equals("274")) && (!obj2.Type.Equals("275") && !obj2.Type.Equals("219")))
                {
                    goto Label_018E;
                }
                String name = String.Empty;
                try
                {
                    List <NameValue> list = JSONHelper.DeserializeObject <List <NameValue> >(obj2.DefaultValue.ToString());
                    if ((list != null) && (list.Count > 0))
                    {
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (list[i].Selected)
                            {
                                name = list[i].Name;
                                break;
                            }
                        }
                        if (String.IsNullOrEmpty(name))
                        {
                            name = list[0].Name;
                        }
                    }
                }
                catch (Exception)
                {
                    name = obj2.DefaultValue.ToString();
                }
                String str7 = name;
                if (str7 == null)
                {
                    goto Label_0166;
                }
                if (!(str7 == "不复权"))
                {
                    if (str7 == "前复权")
                    {
                        goto Label_0146;
                    }
                    if (str7 == "后复权")
                    {
                        goto Label_014E;
                    }
                    if (str7 == "净价")
                    {
                        goto Label_0156;
                    }
                    if (str7 == "全价")
                    {
                        goto Label_015E;
                    }
                    goto Label_0166;
                }
                str = "1";
                goto Label_0168;
Label_0146:
                str = "3";
                goto Label_0168;
Label_014E:
                str = "2";
                goto Label_0168;
Label_0156:
                str = "1";
                goto Label_0168;
Label_015E:
                str = "2";
                goto Label_0168;
Label_0166:
                str = name;
Label_0168:
                if (!obj2.Type.Equals("219"))
                {
                    obj2.Name = "AdjustFlag";
                }
                obj2.DefaultValue = str;
                goto Label_01F7;
Label_018E:
                if (CreateParameter.IsDropDownSet(obj2.Type))
                {
                    List <NameValue> list2 = JSONHelper.DeserializeObject <List <NameValue> >(obj2.DefaultValue.ToString());
                    if ((list2 != null) && (list2.Count > 0))
                    {
                        for (int j = 0; j < list2.Count; j++)
                        {
                            if (list2[j].Selected)
                            {
                                obj2.DefaultValue = list2[j].Value;
                                break;
                            }
                        }
                    }
                }
Label_01F7:
                switch (obj2.Type.ToString())
                {
                case "133":
                {
                    str4 = obj2.DefaultValue.ToString();
                    if (!str4.Contains("一年定存"))
                    {
                        break;
                    }
                    obj2.DefaultValue = "1";
                    continue;
                }

                case "115":
                {
                    if (!obj2.DefaultValue.ToString().Equals("合并"))
                    {
                        goto Label_0444;
                    }
                    obj2.DefaultValue = "1";
                    continue;
                }

                case "314":
                {
                    if (!obj2.DefaultValue.Equals("调整前"))
                    {
                        goto Label_04DF;
                    }
                    obj2.DefaultValue = 1;
                    continue;
                }

                case "310":
                case "121":
                case "101":
                case "100":
                case "119":
                case "267":
                case "264":
                case "102":
                case "520":
                {
                    str5 = obj2.DefaultValue.ToString();
                    if ((!str5.Contains("GetLatestDay") && !str5.Contains("GetLastestClosingDate")) && !str5.Contains("GetLatestPhase"))
                    {
                        goto Label_054C;
                    }
                    obj2.DefaultValue = "N";
                    continue;
                }

                case "217":
                {
                    if (obj2.DefaultValue != null)
                    {
                        String[] strArray = obj2.DefaultValue.ToString().Split(new char[] { ':' });
                        if (strArray.Length == 2)
                        {
                            obj2.DefaultValue = strArray[1];
                            str2 = strArray[0];
                        }
                    }
                    continue;
                }

                case "444":
                {
                    if (!String.IsNullOrEmpty(str2))
                    {
                        obj2.DefaultValue = str2;
                    }
                    continue;
                }

                case "297":
                {
                    if (!obj2.DefaultValue.Equals("1"))
                    {
                        goto Label_0821;
                    }
                    obj2.DefaultValue = "30";
                    continue;
                }

                default:
                {
                    continue;
                }
                }
                if (str4.Contains("五年定存"))
                {
                    obj2.DefaultValue = "2";
                }
                else if (str4.Contains("银行间市场七日回购"))
                {
                    obj2.DefaultValue = "3";
                }
                else if (str4.Contains("最新发行的一年期"))
                {
                    obj2.DefaultValue = "4";
                }
                else if (str4.Contains("十年期国债收益"))
                {
                    obj2.DefaultValue = "5";
                }
                else if (str4.Contains("五年期国债收益"))
                {
                    obj2.DefaultValue = "6";
                }
                else if (str4.Contains("一年期国债收益"))
                {
                    obj2.DefaultValue = "7";
                }
                continue;
Label_0444:
                if (obj2.DefaultValue.ToString().Equals("母公司"))
                {
                    obj2.DefaultValue = "2";
                }
                else if (obj2.DefaultValue.ToString().Equals("合并调整"))
                {
                    obj2.DefaultValue = "3";
                }
                else if (obj2.DefaultValue.ToString().Equals("母公司调整"))
                {
                    obj2.DefaultValue = "4";
                }
                continue;
Label_04DF:
                if (obj2.DefaultValue.Equals("调整后"))
                {
                    obj2.DefaultValue = 2;
                }
                continue;
Label_054C:
                if (str5.Contains("GetLastTradingDate"))
                {
                    obj2.DefaultValue = "P";
                }
                else if (str5.Contains("GetListingFirstDate"))
                {
                    obj2.DefaultValue = "S";
                }
                else if (str5.Contains("GetThisYearFirstDay"))
                {
                    obj2.DefaultValue = "YS";
                }
                else if (str5.Contains("GetThisMonthFirstDay"))
                {
                    obj2.DefaultValue = "MS";
                }
                else if (str5.Contains("GetTradingDateBeforeClosingDate"))
                {
                    obj2.DefaultValue = "EP";
                }
                else if (str5.Contains("GetOneWeekDateBeforeClosingDate"))
                {
                    obj2.DefaultValue = "E1W";
                }
                else if (str5.Contains("GetTwoWeekDateBeforeClosingDate"))
                {
                    obj2.DefaultValue = "E2W";
                }
                else if (str5.Contains("Get52WeekDateBeforeClosingDate"))
                {
                    obj2.DefaultValue = "E52W";
                }
                else if (str5.Contains("GetOneMonthDateBeforeClosingDate"))
                {
                    obj2.DefaultValue = "E1M";
                }
                else if (str5.Contains("GetThreeMonthDateBeforeClosingDate"))
                {
                    obj2.DefaultValue = "E3M";
                }
                else if (str5.Contains("GetSixMonthDateBeforeClosingDate"))
                {
                    obj2.DefaultValue = "E6M";
                }
                else if (str5.Contains("GetOneYearDateBeforeClosingDate"))
                {
                    obj2.DefaultValue = "E1Y";
                }
                else if (str5.Contains("GetThreeYearDateBeforeClosingDate"))
                {
                    obj2.DefaultValue = "E3Y";
                }
                else if ((obj2.DefaultValue == null) || String.IsNullOrEmpty(obj2.DefaultValue.ToString()))
                {
                    obj2.DefaultValue = DateTime.Now.ToString("yyyy-MM-dd");
                }
                else
                {
                    DateTime time;
                    if (DateTime.TryParse(obj2.DefaultValue.ToString(), out time))
                    {
                        obj2.DefaultValue = time.ToString("yyyy-MM-dd");
                    }
                    else
                    {
                        obj2.DefaultValue = str5.Substring(str5.LastIndexOf(".") + 1);
                        String toolsMethodInfo = String.Format("{0}.{1}", typeof(TimeParameter).FullName, obj2.DefaultValue);
                        obj2.DefaultValue = GetMethodInfo.GetToolsMethodValue(toolsMethodInfo);
                        if (DateTime.TryParse(obj2.DefaultValue.ToString(), out time))
                        {
                            obj2.DefaultValue = time.ToString("yyyy-MM-dd");
                        }
                    }
                }
                continue;
Label_0821:
                if (obj2.DefaultValue.Equals("2"))
                {
                    obj2.DefaultValue = "90";
                }
                else if (obj2.DefaultValue.Equals("3"))
                {
                    obj2.DefaultValue = "180";
                }
            }
        }
示例#26
0
 /// <summary>
 /// 反序列化
 /// </summary>
 /// <typeparam name="T">要序列化的对象</typeparam>
 /// <param name="str">字符串</param>
 /// <returns>返回的反序列化对象结果</returns>
 public static T JsonDeserializeObject <T>(String str)
 {
     return(JSONHelper.DeserializeObject <T>(str));
 }