public void UserBalance(HttpContext context) { JObject balanceObj = new JObject(); int userId = 0; try { if (string.IsNullOrEmpty(userObj["UserID"].ToString()) == true) { balanceObj = new JObject(new JProperty("Success", false), new JProperty("Message", "Mandatory parameter missing"), new JProperty("ErrorCode", "E0001")); context.Response.Write(balanceObj); context.Response.End(); } else { userId = Convert.ToInt32(userObj["UserID"]); } Profile_V120 profileObj = new Profile_V120(); balanceObj = profileObj.UserBalance(MyConf.MyConnectionString, userId); } catch (Exception ex) { Logger.ExceptionLog("Exception in AppServices_v2 is " + ex.ToString()); } context.Response.Write(balanceObj); //Logger.TraceLog("UserBalance response " + balanceObj); HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(balanceObj.ToString())); //RMQClient.enQueueApiStat(); }
private void ProfileImage(HttpContext context) { JObject profileImageObj = new JObject(); string tempStoragePath = "", tempFileName = "", image = ""; int userId = 0; try { if (context.Request["image"] == null) { profileImageObj = new JObject(new JProperty("Success", false), new JProperty("Message", "Unable to read image")); context.Response.Write(profileImageObj); return; } if (string.IsNullOrEmpty(userObj["UserID"].ToString()) == true) { profileImageObj = new JObject(new JProperty("Success", false), new JProperty("Message", "Mandatory parameter missing"), new JProperty("ErrorCode", "E0001")); context.Response.Write(profileImageObj); context.Response.End(); } else { userId = Convert.ToInt32(userObj["UserID"]); } tempStoragePath = HttpContext.Current.Server.MapPath("/TempImages/"); tempFileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".jpg"; image = context.Request["image"].ToString(); Profile_V120 profileObj = new Profile_V120(); profileImageObj = profileObj.ProfileImage(image, tempStoragePath, tempFileName, MyConf.MyConnectionString, userId); } catch (Exception ex) { Logger.ExceptionLog("Exception in Appservice_v2 is " + ex.ToString()); } context.Response.Write(profileImageObj); //Logger.TraceLog("ProfileImage response " + profileImageObj); HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(profileImageObj.ToString())); //RMQClient.enQueueApiStat(); }
private void GetCountries(HttpContext context) { JObject responseJobj = new JObject(); try { Profile_V120 profileObj = new Profile_V120(); responseJobj = profileObj.GetCountries(MyConf.MyConnectionString); context.Response.Write(responseJobj); } catch (Exception ex) { Logger.ExceptionLog("Exception In GetCountries : " + ex.ToString()); } HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(responseJobj.ToString())); //RMQClient.enQueueApiStat(); //Logger.TraceLog("GetCountries response " + responseJobj); }
private void UpdateProfile(HttpContext context) { JObject paramObj = new JObject(); JObject updateProfileObj = new JObject(); HttpContext.Current.Request.InputStream.Position = 0; StreamReader _IS = new StreamReader(HttpContext.Current.Request.InputStream); string payload = _IS.ReadToEnd(); int userId = 0; string nickName = "", email = "", webSitrUrl = "", workNumber = "", company = ""; try { //Logger.TraceLog("UserId :"+ userObj["UserID"].ToString()); if (string.IsNullOrEmpty(userObj["UserID"].ToString()) == true) { updateProfileObj = new JObject(new JProperty("Success", false), new JProperty("Message", "Mandatory parameter missing"), new JProperty("ErrorCode", "E0001")); context.Response.Write(updateProfileObj); context.Response.End(); } else { userId = Convert.ToInt32(userObj["UserID"]); } if (context.Request["nickname"] == null) { try { paramObj = JObject.Parse(payload); } catch (Exception ex) { Logger.ExceptionLog(ex.StackTrace); context.Response.Write("Invalid Request"); context.Response.End(); } nickName = paramObj.SelectToken("nickname").ToString(); email = paramObj.SelectToken("email").ToString(); webSitrUrl = paramObj.SelectToken("websiteurl").ToString(); workNumber = paramObj.SelectToken("worknumber").ToString(); company = paramObj.SelectToken("company").ToString(); } else { nickName = context.Request["nickname"].ToString(); email = context.Request["email"].ToString(); webSitrUrl = context.Request["websiteurl"].ToString(); workNumber = context.Request["worknumber"].ToString(); company = context.Request["company"].ToString(); } Profile_V120 profileObj = new Profile_V120(); updateProfileObj = profileObj.UpdateProfile(MyConf.MyConnectionString, userId, nickName, email, workNumber, webSitrUrl, company); //Logger.TraceLog("Response :"+updateProfileObj.ToString()); } catch (Exception ex) { Logger.ExceptionLog("Exception in Appservice_v2 is " + ex.ToString()); } context.Response.Write(updateProfileObj); //Logger.TraceLog("UpdateProfile response " + updateProfileObj); HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(updateProfileObj.ToString())); //RMQClient.enQueueApiStat(); }