public string GetEmailIdByAssociateId(int inAssociateId) { string oStr = string.Empty; HttpResponseMessage resp = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest); using (WcrHttpClient client = new WcrHttpClient(WcrVault.Gateway.getwcrusername, WcrVault.Gateway.getwcrpassword)) { string endpoint = "api/AccountCreation/GetAssociateEmailById?inAssociateId=" + inAssociateId.ToString(); resp = client.GetAsync(endpoint).Result; oStr = JsonConvert.DeserializeObject <string>(resp.Content.ReadAsStringAsync().Result); } WcrCryptography crypt = new WcrCryptography(); oStr = crypt.WcrSimpleDecrypt(oStr); return(oStr); }
public string SelectConsumerDetail(int ID, string uname) { WcrCryptography crypto = new WcrCryptography(); HttpResponseMessage resp = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest); using (WcrHttpClient client = new WcrHttpClient(uname)) { resp = client.GetAsync(string.Format("api/ConsumerTransactions/consumerDetail?inConsumerId={0}", ID)).Result; ConsumerDetail_ReturnDataModel returnModel = JsonConvert.DeserializeObject <ConsumerDetail_ReturnDataModel>(resp.Content.ReadAsStringAsync().Result); if (returnModel == null) { return(null); } else { returnModel.Name = crypto.DecryptUserName(returnModel.Name); returnModel.Address = crypto.WcrSimpleDecrypt(returnModel.Address); returnModel.Mob = crypto.WcrSimpleDecrypt(returnModel.Mob); returnModel.UserName = crypto.WcrSimpleDecrypt(returnModel.UserName); returnModel.EmailId = crypto.DecryptUserName(returnModel.EmailId); returnModel.Password = crypto.DecryptPassword(returnModel.Password); returnModel.ZipCode = crypto.WcrSimpleDecrypt(returnModel.ZipCode); returnModel.ConsumerPhoto = returnModel.ConsumerPhoto; returnModel.LastName = crypto.WcrSimpleDecrypt(returnModel.LastName); returnModel.Unit_Apt = crypto.WcrSimpleDecrypt(returnModel.Unit_Apt); returnModel.City = crypto.WcrSimpleDecrypt(returnModel.City); returnModel.StateId = crypto.WcrSimpleDecrypt(returnModel.StateId); DataSet ds = new DataSet("dataSet"); DataTable table = ds.Tables.Add("ConsumerDetail"); table.Columns.Add("Id", typeof(int)); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Address", typeof(string)); table.Columns.Add("Mob", typeof(string)); table.Columns.Add("UserName", typeof(string)); table.Columns.Add("EmailId", typeof(string)); table.Columns.Add("Password", typeof(string)); table.Columns.Add("ZipCode", typeof(string)); table.Columns.Add("ConsumerPhoto", typeof(string)); table.Columns.Add("LastName", typeof(string)); table.Columns.Add("Unit_Apt", typeof(string)); table.Columns.Add("City", typeof(string)); table.Columns.Add("StateId", typeof(string)); DataRow dr = table.NewRow(); dr["Id"] = ID; dr["Name"] = returnModel.Name; dr["Address"] = returnModel.Address; dr["Mob"] = returnModel.Mob; dr["UserName"] = returnModel.UserName; dr["EmailId"] = returnModel.EmailId; dr["Password"] = returnModel.Password; dr["ZipCode"] = returnModel.ZipCode; dr["ConsumerPhoto"] = returnModel.ConsumerPhoto; dr["LastName"] = returnModel.LastName; dr["Unit_Apt"] = returnModel.Unit_Apt; dr["City"] = returnModel.City; dr["StateId"] = returnModel.StateId; table.Rows.Add(dr); return(ds.GetXml()); } ////SqlCommand cmd = new SqlCommand("proc_ConsumerDetail", objCon.Con); ////cmd.CommandType = CommandType.StoredProcedure; ////cmd.Parameters.AddWithValue("@ID", ID); ////cmd.Parameters.AddWithValue("@Passphrase", WcrCryptography.SqlPassphrase); ////SqlDataAdapter adpt = new SqlDataAdapter(); ////DataSet ds = new DataSet(); ////if (objCon.Con.State == ConnectionState.Open) ////{ } ////else ////{ //// objCon.Con.Open(); ////} ////cmd.Connection = objCon.Con; ////adpt.SelectCommand = cmd; ////adpt.Fill(ds, "ConsumerDetail"); ////objCon.Con.Close(); ////return ds.GetXml(); } }
/// <summary> /// This Method will get associate detail on the basis of associateID /// </summary> /// <param name="AdvertismentID"></param> /// <returns></returns> public string GetAssociateBasicDetail(int associateID, string userName) { WcrCryptography crypto = new WcrCryptography(); HttpResponseMessage resp = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest); using (WcrHttpClient client = new WcrHttpClient(userName)) { //resp = client.GetAsync($"api/AssociateTransactions/AssociateRegistrationView?inAssociateId={associateID}").Result; resp = client.GetAsync(string.Format("api/AssociateTransactions/AssociateRegistrationView?inAssociateId={0}", associateID)).Result; AssociateRegistrationView_ReturnDataModel returnModel = JsonConvert.DeserializeObject <AssociateRegistrationView_ReturnDataModel>(resp.Content.ReadAsStringAsync().Result); returnModel.Email = crypto.DecryptUserName(returnModel.Email); returnModel.FullName = crypto.WcrSimpleDecrypt(returnModel.FullName); returnModel.LastName = crypto.WcrSimpleDecrypt(returnModel.LastName); returnModel.LicenseId = crypto.WcrSimpleDecrypt(returnModel.LicenseId); returnModel.LicenseState = crypto.WcrSimpleDecrypt(returnModel.LicenseState); returnModel.MobileNo = crypto.WcrSimpleDecrypt(returnModel.MobileNo); returnModel.Password = crypto.DecryptPassword(returnModel.Password); returnModel.Photo = returnModel.Photo; returnModel.UserName = crypto.WcrSimpleDecrypt(returnModel.UserName); returnModel.ZipCode = crypto.WcrSimpleDecrypt(returnModel.ZipCode); DataSet ds = new DataSet("dataSet"); DataTable table = ds.Tables.Add("ViewAssociateBasicDetail"); table.Columns.Add("AssociateId", typeof(int)); table.Columns.Add("Email", typeof(string)); table.Columns.Add("FullName", typeof(string)); table.Columns.Add("LastName", typeof(string)); table.Columns.Add("LicenseId", typeof(string)); table.Columns.Add("LicenseState", typeof(string)); table.Columns.Add("MobileNo", typeof(string)); table.Columns.Add("Password", typeof(string)); table.Columns.Add("Photo", typeof(string)); table.Columns.Add("UserName", typeof(string)); table.Columns.Add("ZipCode", typeof(string)); DataRow dr = table.NewRow(); dr["AssociateId"] = associateID; dr["Email"] = returnModel.Email; dr["FullName"] = returnModel.FullName; dr["LastName"] = returnModel.LastName; dr["LicenseId"] = returnModel.LicenseId; dr["LicenseState"] = returnModel.LicenseState; dr["MobileNo"] = returnModel.MobileNo; dr["Password"] = returnModel.Password; dr["Photo"] = returnModel.Photo; dr["UserName"] = returnModel.UserName; dr["ZipCode"] = returnModel.ZipCode; table.Rows.Add(dr); return(ds.GetXml()); //ds.Tables.Add(dt); //adpt.Fill(ds, "ViewAssociateBasicDetail"); //return ds.GetXml(); //DataSet ds = new DataSet(); //SqlDataAdapter adpt = new SqlDataAdapter(); //ds = JsonConvert.DeserializeObject<DataSet>(resp.Content.ReadAsStringAsync().Result); //adpt.Fill(ds, "ViewAssociateBasicDetail"); //return ds.GetXml(); } //SqlCommand cmd = new SqlCommand("proc_AssociateRegistration", objCon.Con); //cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.AddWithValue("@associateID", associateID); //cmd.Parameters.AddWithValue("@action", "View"); //cmd.Parameters.AddWithValue("@Passphrase", WcrCryptography.SqlPassphrase); //SqlDataAdapter adpt = new SqlDataAdapter(); //DataSet ds = new DataSet(); //if (objCon.Con.State == ConnectionState.Open) //{ } //else //{ // objCon.Con.Open(); //} //cmd.Connection = objCon.Con; //adpt.SelectCommand = cmd; //adpt.Fill(ds, "ViewAssociateBasicDetail"); //objCon.Con.Close(); //return ds.GetXml(); }