Exemple #1
0
 public static void Log(string title, string content)
 {
     try
     {
         DbContext currentDb = SysContext.GetCurrentDb();
         core_log  core_log  = new core_log();
         core_log.CreateDate   = DateTime.Now;
         core_log.CreateUserID = SysContext.WanJiangUserID;
         core_log.ID           = ObEx.ToStr((object)Guid.NewGuid());
         core_log.Logtime      = DateTime.Now;
         core_log.Title        = title;
         core_log.Logcontent   = content;
         core_log.Logtype      = "user";
         core_log.Systempath   = HttpContext.Current.Request.Path.ToString();
         core_log.UserID       = SysContext.WanJiangUserID;
         currentDb.Insert("core_log", "ID", false, (object)core_log);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Exemple #2
0
 public static void Log(Exception error)
 {
     try
     {
         DbContext currentDb = SysContext.GetCurrentDb();
         core_log  core_log  = new core_log();
         core_log.CreateDate   = DateTime.Now;
         core_log.CreateUserID = SysContext.WanJiangUserID;
         core_log.ID           = ObEx.ToStr((object)Guid.NewGuid());
         core_log.Logtime      = DateTime.Now;
         core_log.Title        = "系统异常";
         core_log.Logcontent   = error.Message;
         core_log.Logtype      = "exception";
         core_log.StackTrace   = error.StackTrace;
         core_log.Systempath   = HttpContext.Current.Request.Path.ToString();
         core_log.UserID       = SysContext.WanJiangUserID;
         currentDb.Insert("core_log", "ID", false, (object)core_log);
     }
     catch (Exception)
     {
     }
 }
Exemple #3
0
        private static IList FillTreeChild(DbContext dbContext_0, IList <Dictionary <string, object> > lstDicValues, string strIDFiled, string strTextFiled, string strParentIDFiled, string string_3, string sourceModel2, FilterTree filter)
        {
            bool flag = filter.sourceModel2 == sourceModel2;
            List <Dictionary <string, object> > list = null;

            if (string.IsNullOrEmpty(strParentIDFiled))
            {
                list = lstDicValues.ToList();
            }
            else
            {
                if (!string.IsNullOrEmpty(string_3))
                {
                    list = (from a in lstDicValues
                            where ObEx.ToStr(a[strParentIDFiled]) == string_3
                            select a).ToList();
                }
                else
                {
                    list = (from a in lstDicValues
                            where a[strParentIDFiled] == DBNull.Value || a[strParentIDFiled] == null || ObEx.ToStr(a[strParentIDFiled]) == "" || ObEx.ToStr(a[strParentIDFiled]) == "0"
                            select a).ToList();
                }
            }
            List <object> list2 = new List <object>();

            foreach (Dictionary <string, object> item in list)
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary["id"]      = item[strIDFiled];
                dictionary["text"]    = item[strTextFiled];
                dictionary["model"]   = sourceModel2;
                dictionary["iconcss"] = sourceModel2;
                string text = flag ? filter.fields2 : filter.fields;
                if (!string.IsNullOrEmpty(text))
                {
                    string[] array = text.Split(',');
                    foreach (string key in array)
                    {
                        dictionary[key] = item[key];
                    }
                }
                IList list3 = null;
                if (!string.IsNullOrEmpty(strParentIDFiled))
                {
                    list3 = FillTreeChild(dbContext_0, lstDicValues, strIDFiled, strTextFiled, strParentIDFiled, ObEx.ToStr(item[strIDFiled]), sourceModel2, filter);
                }
                if (!flag && !string.IsNullOrEmpty(filter.sourceModel2) && !string.IsNullOrEmpty(filter.refSourceField))
                {
                    ServiceConfig serviceConfig = ServiceHelper.GetServiceConfig(filter.sourceModel2);
                    string        textField     = serviceConfig.model.textField;
                    FilterGroup   filterGroup   = new FilterGroup();
                    filterGroup.rules.Add(new FilterRule
                    {
                        op    = "equal",
                        value = ObEx.ToStr(item[strIDFiled]),
                        field = filter.refSourceField
                    });
                    if (filter.filter2 != null)
                    {
                        filterGroup.groups.Add(filter.filter2);
                    }
                    List <Dictionary <string, object> > lstDic = GetAllProperty(dbContext_0, filterGroup, filter.sourceModel2, filter.parentField2, "ID", textField, filter.fields2);
                    IList list4 = FillTreeChild(dbContext_0, lstDic, "ID", textField, filter.parentField2, null, filter.sourceModel2, filter);
                    if (list3 == null)
                    {
                        list3 = list4;
                    }
                    else if (list4 != null)
                    {
                        foreach (object item2 in list4)
                        {
                            list3.Add(item2);
                        }
                    }
                }
                if (list3 != null && list3.Count > 0)
                {
                    dictionary["children"] = list3;
                }
                list2.Add(dictionary);
            }
            return(list2);
        }