Example #1
0
        public JsonResult AddUserIds(string start, string end, string app, string role, string owner, string password, bool isDirect)
        {
            int    userId  = -1;
            string token   = "";
            bool   result  = false;
            string message = string.Empty;

            if (GetToken(out userId, out token))
            {
                int s, e, a, r, o;
                if (int.TryParse(start, out s) && int.TryParse(end, out e) && int.TryParse(app, out a) && int.TryParse(role, out r))
                {
                    if (s <= BuiltIns.UserDefinedUserStartId)
                    {
                        return(Json(new { Success = false, Message = "用户Id不能小于100!" }, JsonRequestBehavior.AllowGet));
                    }
                    o = -1;
                    int.TryParse(owner, out o);
                    DSClient client = new DSClient(Models.Const.ApplicationId);
                    try
                    {
                        client.AddUserIdLists(userId, token, s, e, userId, o, r, a, Utility.GetMD5String(password), isDirect);
                        result = true;
                    }
                    catch (DatabaseException exception)
                    {
                        message = exception.Message;
                    }
                }
            }

            return(Json(new { Success = result, Message = message }, JsonRequestBehavior.AllowGet));
        }