using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using abc.Models;
using System.Data;
using System.Xml;
using System.Net.Http;
using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Threading.Tasks;
public ActionResult LoginUser(Loginguser log)
{
if (ModelState.IsValid)
{
try
{
HttpClient webClient1 = new HttpClient();
string pass = log.password;
//Uri uri = new Uri("http://m.abc.com/service/userprofile.svc/logIn?loginId=" + log.username + "&pass=" + log.password);
Uri uri = new Uri("http://m.vinipost.com/service/userprofile.svc/logInUsrTyp?loginId=" + log.username + "&pass="+pass +"&usrTyp=1");
var response1 = webClient1.GetAsync(uri).Result;
var jsonString = response1.Content.ReadAsStringAsync().Result;
string[] x = jsonString.Split('[');
string[] y = x[1].Split(']');
string res = "[" + y[0] + "]";
var _Data = JsonConvert.DeserializeObject<List<JClass>>(res);
string msg = null;
string Name = null;
foreach (JClass Student in _Data)
{
msg = Student.msg;
Name = Student.Name;
}
if(msg!=null)
{
ViewBag.reg = msg;
return View();
}
Session["Username"] =Name;
if (Session["Reviewuser"] != null)
{
string id = Session["Reviewuser"].ToString();
if (globevar.cid == 1)
{
return RedirectToAction("CabShows", "CabService");
}
return RedirectToAction("Reviews", "Review", new { id1 = id });
}
else
return RedirectToAction("Show", "User");
/* Connection obj = new Connection();
DataSet ds = new DataSet();
string pass = log.password.ToString();//globevar.Decryptdata(log.password.ToString());
string s = "select U_Type from User_Master where U_Name='" + log.username.ToString() + "' and U_Password='" + pass.ToString() + "'";
ds = obj.Getdata(s);
if (ds.Tables[0].Rows.Count > 0)
{
Session["Username"] = log.username.ToString();
if (Session["Reviewuser"] != null)
{
string id = Session["Reviewuser"].ToString();
if (globevar.cid == 1)
{
return RedirectToAction("CabShows", "CabService");
}
return RedirectToAction("Reviews", "Review", new { id1 = id });
}
else
return RedirectToAction("Show", "User");
}
else
{
ViewBag.reg = "Invalid ID or Password";
return View();
}
*/
}
catch (Exception)
{
return View();
}
}
else
return View();
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using abc.Models;
using System.Data;
using System.Xml;
using System.Net.Http;
using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Threading.Tasks;
public ActionResult LoginUser(Loginguser log)
{
if (ModelState.IsValid)
{
try
{
HttpClient webClient1 = new HttpClient();
string pass = log.password;
//Uri uri = new Uri("http://m.abc.com/service/userprofile.svc/logIn?loginId=" + log.username + "&pass=" + log.password);
Uri uri = new Uri("http://m.vinipost.com/service/userprofile.svc/logInUsrTyp?loginId=" + log.username + "&pass="+pass +"&usrTyp=1");
var response1 = webClient1.GetAsync(uri).Result;
var jsonString = response1.Content.ReadAsStringAsync().Result;
string[] x = jsonString.Split('[');
string[] y = x[1].Split(']');
string res = "[" + y[0] + "]";
var _Data = JsonConvert.DeserializeObject<List<JClass>>(res);
string msg = null;
string Name = null;
foreach (JClass Student in _Data)
{
msg = Student.msg;
Name = Student.Name;
}
if(msg!=null)
{
ViewBag.reg = msg;
return View();
}
Session["Username"] =Name;
if (Session["Reviewuser"] != null)
{
string id = Session["Reviewuser"].ToString();
if (globevar.cid == 1)
{
return RedirectToAction("CabShows", "CabService");
}
return RedirectToAction("Reviews", "Review", new { id1 = id });
}
else
return RedirectToAction("Show", "User");
/* Connection obj = new Connection();
DataSet ds = new DataSet();
string pass = log.password.ToString();//globevar.Decryptdata(log.password.ToString());
string s = "select U_Type from User_Master where U_Name='" + log.username.ToString() + "' and U_Password='" + pass.ToString() + "'";
ds = obj.Getdata(s);
if (ds.Tables[0].Rows.Count > 0)
{
Session["Username"] = log.username.ToString();
if (Session["Reviewuser"] != null)
{
string id = Session["Reviewuser"].ToString();
if (globevar.cid == 1)
{
return RedirectToAction("CabShows", "CabService");
}
return RedirectToAction("Reviews", "Review", new { id1 = id });
}
else
return RedirectToAction("Show", "User");
}
else
{
ViewBag.reg = "Invalid ID or Password";
return View();
}
*/
}
catch (Exception)
{
return View();
}
}
else
return View();
}
No comments:
Post a Comment