Example #1
0
        public ActionResult Enter()
        {
            var actionResult = default(AgileJsonResult);

            var inModel = new Mo.SysUser();

            try
            {
                UpdateModel(inModel);

                var url = Config.PDAUrl;

                var method = AgilePDAMethod.Login;

                var parameter = $"username={inModel.UserName}&password={inModel.Password}";

                var entity = AgilePDASoap.Post(url, method, parameter);

                actionResult.Content = AgileJson.ToJson(entity);

                if (entity.Status == "1")
                {
                    Identity.Login(inModel);
                }
            }
            catch
            {
            }

            return(actionResult);
        }
Example #2
0
        public ActionResult GenerateDataAccess()
        {
            var model = new Mo.SysDatabase();

            UpdateModel(model);

            var actionResult = default(AgileJsonResult);

            try
            {
                dynamic wherePart = new ExpandoObject();

                wherePart.DBName = model.DbName;

                wherePart.ID = model.TableID;

                var columns = Da.Sys.GetColumns(Config.ConnectionString_Read, wherePart);

                actionResult = new AgileJsonResult()
                {
                    Content = AgileJson.ToJson(new
                    {
                        result = HttpUtility.UrlDecode(GenerateCode.GetDataAccess(columns, model.TableName))
                    })
                };
            }
            catch { }

            return(actionResult);
        }
Example #3
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="email">用户标识</param>
        public static void Login(Mo.SysUser sysUser)
        {
            var cookies = HttpContext.Current.Response.Cookies;
            var user    = new Identity {
                UserName = sysUser.UserName, Password = sysUser.Password, LoginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
            };
            var json = AgileJson.ToJson(user);
            var key  = string.Format("{0}.Identity", Config.CookiePrefix);

            cookies[key].Value = AgileDES.Encrypt(json, Config.SecurityKey);
        }
        /// <summary>
        /// 转换为Dynamic
        /// </summary>
        /// <param name="exception">异常</param>
        /// <returns>结果</returns>
        public static string ToJson(Exception exception)
        {
            var obj = new
            {
                OccurTime  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
                Message    = HttpUtility.HtmlEncode(exception.Message),
                Source     = HttpUtility.HtmlEncode(exception.Source),
                StackTrace = HttpUtility.HtmlEncode(exception.StackTrace)
            };

            return(AgileJson.ToJson(obj));
        }
Example #5
0
        // GET: Database
        public ActionResult GetAllDatabases()
        {
            var actionResult = default(AgileJsonResult);

            try
            {
                var databases = Da.Sys.GetAllDatabases(Config.ConnectionString_Read);

                actionResult = new AgileJsonResult()
                {
                    Content = AgileJson.ToJson(new { result = databases })
                };
            }
            catch { }

            return(actionResult);
        }
Example #6
0
        public ActionResult GetAllTables()
        {
            var model = new Mo.SysDatabase();

            UpdateModel(model);

            var actionResult = default(AgileJsonResult);

            try
            {
                var tables = Da.Sys.GetAllTables(Config.ConnectionString_Read, model.DbName);

                actionResult = new AgileJsonResult()
                {
                    Content = AgileJson.ToJson(new
                    {
                        result = tables
                    })
                };
            }
            catch { }

            return(actionResult);
        }