Beispiel #1
0
        public static string GetParameterSelect(string Code)
        {
            string str = string.Empty;

            try
            {
                IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
                timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                List <CascaderNullModel> returnlist  = new List <CascaderNullModel>();
                AchieveDBEntities        myDbContext = new AchieveDBEntities();

                List <tbParameter> templist = myDbContext.tbParameter.Where(p => p.FatherCode == Code).ToList();
                if (templist != null && templist.Count > 0)
                {
                    foreach (var st in templist)
                    {
                        CascaderNullModel t = new CascaderNullModel()
                        {
                            label = st.CodeName,
                            value = st.Code
                        };
                        returnlist.Add(t);
                    }

                    str = JsonConvert.SerializeObject(returnlist, Formatting.Indented, timeFormat);
                    str = ResponseHelper.ResponseMsg("1", "取数成功", str);
                }
                else
                {
                    str = JsonConvert.SerializeObject(returnlist, Formatting.Indented, timeFormat);
                    str = ResponseHelper.ResponseMsg("-1", "数据不存在", str);
                }
            }
            catch (Exception ex)
            {
                str = ResponseHelper.ResponseMsg("-1", ex.Message, "");
            }

            return(str);
        }
Beispiel #2
0
        public static string GetAllLogList()
        {
            string str = string.Empty;
            List <CascaderNullModel> tempList = new List <CascaderNullModel>();

            try
            {
                IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
                timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                List <string> strList = new List <string>();
                strList = LoadLogList();
                if (strList != null || strList.Count > 0)
                {
                    foreach (string st in strList)
                    {
                        // string labs = st.Replace("","");
                        CascaderNullModel temp = new CascaderNullModel()
                        {
                            label = st,
                            value = st
                        };
                        tempList.Add(temp);
                    }
                    tempList = tempList.OrderByDescending(p => p.value).ToList();
                    str      = JsonConvert.SerializeObject(tempList, Formatting.Indented, timeFormat);
                    str      = ResponseHelper.ResponseMsg("1", "取数成功", str);
                }
                else
                {
                    str = JsonConvert.SerializeObject(tempList, Formatting.Indented, timeFormat);
                    str = ResponseHelper.ResponseMsg("-1", "无日志信息", str);
                }
            }
            catch (Exception ex)
            {
                str = ResponseHelper.ResponseMsg("-1", ex.Message, "");
            }
            return(str);
        }