示例#1
0
        public GetBotForm4UserResponse Get(GetBotForm4UserRequest request)
        {
            var                     Query1 = @"
SELECT
    
    EOV.obj_json
FROM
    eb_objects EO, eb_objects_ver EOV, eb_objects_status EOS
WHERE
    EO.id = EOV.eb_objects_id 
AND 
    EOS.eb_obj_ver_id = EOV.id 
AND 
    EO.id = ANY('@Ids')  
AND 
    EOS.status = 3 
 AND
    EO.obj_type = 18;;";
            EbDataTable             table  = this.TenantDbFactory.ObjectsDB.DoQuery(Query1.Replace("@Ids", request.BotFormIds));
            GetBotForm4UserResponse resp   = new GetBotForm4UserResponse();

            foreach (EbDataRow row in table.Rows)
            {
                var form = EbSerializers.Json_Deserialize(row[0].ToString());
                resp.BotForms.Add(form);
            }
            //int _id = Convert.ToInt32(request.BotFormIds);
            //var myService = base.ResolveService<EbObjectService>();
            //var res = (EbObjectFetchLiveVersionResponse)myService.Get(new EbObjectFetchLiveVersionRequest() { Id = _id });
            return(resp);
        }
示例#2
0
        public List <object> AuthAndGetformlist(string cid, string socialId, string wc = "tc")
        {
            MyAuthenticateResponse authResponse = this.ServiceClient.Send <MyAuthenticateResponse>(new Authenticate
            {
                provider = CredentialsAuthProvider.Name,
                UserName = "******",
                Password = "******",
                Meta     = new Dictionary <string, string> {
                    { "wc", wc }, { "cid", cid }, { "socialId", socialId }
                },
            });

            if (authResponse != null)
            {
                this.ServiceClient.BearerToken  = authResponse.BearerToken;
                this.ServiceClient.RefreshToken = authResponse.RefreshToken;
                var tokenS = (new JwtSecurityTokenHandler()).ReadToken(authResponse.BearerToken) as JwtSecurityToken;


                ViewBag.cid   = tokenS.Claims.First(claim => claim.Type == "cid").Value;
                ViewBag.wc    = tokenS.Claims.First(claim => claim.Type == "wc").Value;
                ViewBag.email = tokenS.Claims.First(claim => claim.Type == "email").Value;

                User user = this.Redis.Get <User>(string.Format("{0}-{1}-{2}", ViewBag.cid, ViewBag.email, ViewBag.wc));
                var  Ids  = String.Join(",", user.EbObjectIds);
                GetBotForm4UserResponse formlist = this.ServiceClient.Get <GetBotForm4UserResponse>(new GetBotForm4UserRequest {
                    BotFormIds = "{" + Ids + "}"
                });
                List <object> returnlist = new List <object>();
                returnlist.Add(authResponse);
                returnlist.Add(formlist.BotForms);
                return(returnlist);
            }
            else
            {
                return(null);
            }
        }