Exemple #1
0
        static void Main(string[] args)
        {
            ITracer       tracer         = new Tracer.Tracer();
            ISerializer   serializerJSON = new SerializerJSON();
            ISerializer   serializerXML  = new SerializerXML();
            IOutputWriter writer         = new OutputWriter.OutputWriter();

            //Process
            var test = new Foo(tracer);

            test.MyMethod();
            Thread thread = new Thread(test.MyMethod);

            thread.Start();
            thread.Join();

            //Serialize
            string       result = serializerXML.Serialize(tracer.GetTraceResult());
            StreamWriter fs     = new StreamWriter("test.xml");

            //Write
            writer.Write(result, fs);
            writer.Write(result);

            //Serialize
            result = serializerJSON.Serialize(tracer.GetTraceResult());
            StreamWriter fs2 = new StreamWriter("test.json");

            //Write
            writer.Write(result, fs2);
            writer.Write(result);

            fs.Close();
            fs2.Close();
        }
        public ActionResult Login(LoginModel login)
        {
            if (ModelState.IsValid)
            {
                //Consultar Service Nutresa.
                ParGetUserData par = new ParGetUserData
                {
                    Body = new ParGetUserDataBody
                    {
                        usuario  = Convert.ToString(ConfigurationHelper.Get("ServNutresa.Usuario")),
                        clave    = Convert.ToString(ConfigurationHelper.Get("ServNutresa.Clave")),
                        password = login.Password,
                        userName = login.Email
                    }
                };

                string   serialize = SerializerXML.Serialize <ParGetUserData>(par);
                string   action    = Convert.ToString(ConfigurationHelper.Get("ServNutresa.GetUserData"));
                string   service   = Convert.ToString(ConfigurationHelper.Get("ServNutresa.UrlUserData"));
                UserData userData  = new UserData();

                RespUser envelope = HttpWebRequestGeneric.ConsumeServiceUserByAction <RespUser>(action, serialize, service);
                userData = CastObjects.ConvertItemValueItemItem <UserData>(envelope.Body.getUserDataReturn);

                FormsAuthentication.SetAuthCookie("221ea0b2-6a56-450d-bcb7-7fa110ea0da1", true);

                //if (Url.IsLocalUrl(ReturnUrl))
                //    //return Redirect(ReturnUrl);
                //    return RedirectToAction("MyRedemptions", "Redemption");
                //else
                //    //return RedirectToAction("Index", "Profile");
                //    return RedirectToAction("MyRedemptions", "Redemption");
                return(RedirectToAction("MyRedemptions", "Redemption"));
            }
            else
            {
                return(View());
            }
        }