Ejemplo n.º 1
0
        public static string saveRegdetails(string strusrname, string strcompname, string strusrrole, string strusrtype, string strphno, string strmobno, string stremail, string strcountry, string strstate, string strcity, string strarea, string strlandmark, string straddr1, string straddr2, string strpincode, string struserid, string strorgtype, string struploading)
        {
            //Creating Object to store new User details..
            createuser Objcreateuser = new createuser();

            Objcreateuser.strusrname   = strusrname;
            Objcreateuser.strusrrole   = strusrrole;
            Objcreateuser.strusrtype   = strusrtype;
            Objcreateuser.strphno      = strphno;
            Objcreateuser.strmobno     = strmobno;
            Objcreateuser.stremail     = stremail;
            Objcreateuser.strcountry   = strcountry;
            Objcreateuser.strstate     = strstate;
            Objcreateuser.strcity      = strcity;
            Objcreateuser.strarea      = strarea;
            Objcreateuser.strlandmark  = strlandmark;
            Objcreateuser.straddr1     = straddr1;
            Objcreateuser.straddr2     = straddr2;
            Objcreateuser.strpincode   = strpincode;
            Objcreateuser.struserid    = struserid;
            Objcreateuser.OrgType      = strorgtype;
            Objcreateuser.strcompname  = strcompname;
            Objcreateuser.struploading = struploading;
            Objcreateuser.UserID       = HttpContext.Current.Session["UserID"].ToString();
            try
            {
                //WebReference.Service1 obj = new WebReference.Service1();
                //var result = obj.Userregistration(strjson);
                Uri    urlTemplate          = new Uri(ConfigurationManager.AppSettings["ServerAddress"].ToString() + "/regpage");
                var    javaScriptSerializer = new JavaScriptSerializer();
                string strjson = javaScriptSerializer.Serialize(Objcreateuser);
                var    client  = new HttpClient();
                client.BaseAddress = urlTemplate;
                client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=utf-8");
                client.Timeout = TimeSpan.FromMilliseconds(600000);
                StringContent htpcontent    = new StringContent(strjson, Encoding.UTF8, "application/json");
                var           response      = client.PostAsync("", htpcontent).Result;
                string        resultContent = response.Content.ReadAsStringAsync().Result;
                return(resultContent);
                // return result;
            }
            catch (Exception exp)
            {
                return(exp.ToString());
            }
        }
Ejemplo n.º 2
0
        public String Userregistration(string JsonString)
        {
            JavaScriptSerializer js            = new JavaScriptSerializer();
            createuser           reqcreateuser = js.Deserialize <createuser>(JsonString);

            //Uri urlTemplate = new Uri(ConfigurationManager.AppSettings["ServerAddress"].ToString() + ":5000");
            Uri    urlTemplate          = new Uri(ConfigurationManager.AppSettings["ServerAddress"].ToString() + "/regpage");
            var    javaScriptSerializer = new JavaScriptSerializer();
            string strjson = javaScriptSerializer.Serialize(reqcreateuser);
            var    client  = new HttpClient();

            client.BaseAddress = urlTemplate;
            client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=utf-8");
            client.Timeout = TimeSpan.FromMilliseconds(600000);
            StringContent htpcontent    = new StringContent(strjson, Encoding.UTF8, "application/json");
            var           response      = client.PostAsync("", htpcontent).Result;
            string        resultContent = response.Content.ReadAsStringAsync().Result;

            return(resultContent);
        }