public dynamic GetFMAppStatus(FMAppSts oj) { dynamic obj = new ExpandoObject(); APITRACKMODEL objapi = new APITRACKMODEL(); try { objapi.DeptId = oj.UrlId.Substring(0, 2); objapi.HODId = oj.UrlId.Substring(2, 4); objapi.UrlId = oj.UrlId; objapi.DistrictCode = oj.DistrictCode; objapi.MandalCode = oj.MandalCode; objapi.SceretriatCode = oj.SceretriatCode; objapi.Ptype = "1"; objapi.Loginid = oj.Loginid; objapi.InputData = oj.Application; objapi.TrackingId = oj.SceretriatCode + DateTime.Now.ToString("yymmddHHmm") + new Random().Next(1000, 9999); if (Utils.IsAlphaNumeric(oj.Application)) { var val = PostFMData("https://agrimachinery.nic.in/api/services/GetApplications?Application=" + oj.Application + "&Key='APagri1234'", ""); var data = GetSerialzedData <dynamic>(val); objapi.Status = "1"; objapi.Remarks = data.AplicationStatus + "," + data.ReasonforRejection; new LoginSPHelper().APITRacking_SP(objapi); obj.Status = 100; obj.Reason = "Data Getting Successfully."; obj.Details = data; } else { obj.Status = 102; obj.Reason = "Special Characters Are Not Allowed."; } } catch (WebException wex) { string mappath = HttpContext.Current.Server.MapPath("FormerMechanizationExceptionLogs"); Task WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_ReportLog_Exception(mappath, "Error Gettting FormerMechanization Status Data API:" + wex.Message.ToString())); objapi.Status = "2"; objapi.Remarks = wex.Message.ToString(); new LoginSPHelper().APITRacking_SP(objapi); obj.Status = 102; obj.Reason = ThirdpartyMessage; } return(obj); }
public IHttpActionResult GetFMAppStatus(dynamic data) { string value = token_gen.Authorize_aesdecrpty(data); try { //string value = JsonConvert.SerializeObject(data); FMAppSts rootobj = JsonConvert.DeserializeObject <FMAppSts>(value); return(Ok(_Hel.GetFMAppStatus(rootobj))); } catch (Exception ex) { dynamic CatchData = new ExpandoObject(); CatchData.Status = 102; CatchData.Reason = "Error While Getting Application Status Data"; return(Ok(CatchData)); } }