public string GetInputJsonFormat(transactionModel objtrans) { InputJsonClass objdata = new InputJsonClass(); if (objtrans.HOD_ID == "1601") { if (objtrans.DISTRICT_ID == "505" || objtrans.DISTRICT_ID == "519" || objtrans.DISTRICT_ID == "520" || objtrans.DISTRICT_ID == "521" || objtrans.DISTRICT_ID == "523") { objdata.USERNAME = "******"; objdata.PASSWORD = "******"; objdata.PS_TXN_ID = objtrans.TXN_ID; objdata.RETURN_URL = "http://gramawardsachivalayam.ap.gov.in/GSWS/#!/Login"; } else { objdata.USERNAME = "******"; objdata.PASSWORD = "******"; objdata.PS_TXN_ID = objtrans.TXN_ID; objdata.RETURN_URL = "http://gramawardsachivalayam.ap.gov.in/GSWS/#!/Login"; } return(JsonConvert.SerializeObject(objdata)); } else if (objtrans.HOD_ID == "3501" || objtrans.HOD_ID == "3101" || objtrans.URL_ID == "110102401" || objtrans.URL_ID == "330104101" || objtrans.HOD_ID == "2701" || objtrans.HOD_ID == "2703") { objdata.USERNAME = "******"; objdata.PASSWORD = "******"; objdata.PS_TXN_ID = objtrans.TXN_ID; objdata.RETURN_URL = "http://gramawardsachivalayam.ap.gov.in/GSWS/#!/Login"; } else if (objtrans.HOD_ID == "1101") { objdata.USERNAME = "******"; objdata.PASSWORD = "******"; objdata.PS_TXN_ID = objtrans.TXN_ID; objdata.RETURN_URL = "http://gramawardsachivalayam.ap.gov.in/GSWS/#!/Login"; } else if (objtrans.URL_ID == "200300101") { objdata.USERNAME = "******"; objdata.PASSWORD = "******"; objdata.PS_TXN_ID = objtrans.TXN_ID; objdata.RETURN_URL = "http://gramawardsachivalayam.ap.gov.in/GSWS/#!/Login"; } else if (objtrans.HOD_ID == "2002") { objdata.USERNAME = objtrans.LOGIN_USER; objdata.PASSWORD = objtrans.LOGIN_USER; objdata.PS_TXN_ID = objtrans.TXN_ID; objdata.RETURN_URL = "http://gramawardsachivalayam.ap.gov.in/GSWS/#!/Login"; } else if (objtrans.DEPT_ID == "13" || objtrans.DEPT_ID == "20" || objtrans.DEPT_ID == "28" || objtrans.DEPT_ID == "36" || objtrans.DEPT_ID == "38") { objdata.USERNAME = "******"; objdata.PASSWORD = "******"; objdata.PS_TXN_ID = objtrans.TXN_ID; objdata.RETURN_URL = "http://gramawardsachivalayam.ap.gov.in/GSWS/#!/Login"; } else if (objtrans.HOD_ID == "2201") { objdata.USERNAME = objtrans.LOGIN_USER; objdata.PASSWORD = "******"; objdata.PS_TXN_ID = objtrans.TXN_ID; objdata.RETURN_URL = "http://gramawardsachivalayam.ap.gov.in/GSWS/#!/Login"; } else if (objtrans.URL_ID == "310101401" || objtrans.URL_ID == "310101404") { objdata.USERNAME = "******"; objdata.PASSWORD = "******"; objdata.PS_TXN_ID = objtrans.TXN_ID; objdata.RETURN_URL = "http://gramawardsachivalayam.ap.gov.in/GSWS/#!/Login"; } else if (objtrans.URL_ID == "370300102") { objdata.USERNAME = "******"; objdata.PASSWORD = "******"; objdata.PS_TXN_ID = objtrans.TXN_ID; objdata.RETURN_URL = "http://gramawardsachivalayam.ap.gov.in/GSWS/#!/Login"; } else if (objtrans.URL_ID == "200301401" || objtrans.URL_ID == "360201701" || objtrans.URL_ID == "360201401" || objtrans.URL_ID == "130101101" || objtrans.URL_ID == "280101201" || objtrans.URL_ID == "280101401" || objtrans.URL_ID == "280101301" || objtrans.URL_ID == "360201801" || objtrans.URL_ID == "3602018501" || objtrans.URL_ID == "170100102" || objtrans.URL_ID == "130101401" || objtrans.URL_ID == "130101501" || objtrans.URL_ID == "240200101") { objdata.USERNAME = objtrans.LOGIN_USER; objdata.PASSWORD = objtrans.LOGIN_USER; objdata.PS_TXN_ID = objtrans.TXN_ID; objdata.RETURN_URL = "http://gramawardsachivalayam.ap.gov.in/GSWS/#!/Login"; } else { objdata.USERNAME = objtrans.LOGIN_USER; objdata.PASSWORD = objtrans.LOGIN_USER; objdata.PS_TXN_ID = objtrans.TXN_ID; objdata.RETURN_URL = "http://gramawardsachivalayam.ap.gov.in/GSWS/#!/Login"; } return(JsonConvert.SerializeObject(objdata));; }
public IHttpActionResult closingTransaction(dynamic data) { string serialized_data = JsonConvert.SerializeObject(data); string mappath = HttpContext.Current.Server.MapPath("closingTransactionLogs"); Task WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_Log(mappath, serialized_data)); transactionModel rootobj = JsonConvert.DeserializeObject <transactionModel>(serialized_data); return(Ok(_Hel.closingTransaction(rootobj))); }
public DataTable transactionInsertion(transactionModel obj) { try { using (OracleConnection con = new OracleConnection(oradb)) { using (OracleCommand cmd = new OracleCommand()) { cmd.Connection = con; cmd.InitialLONGFetchSize = 1000; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "GSWS_IN_DEPT_RESPONSES"; cmd.Parameters.Add("P_TYPE", OracleDbType.Varchar2).Value = obj.TYPE; cmd.Parameters.Add("P_TRANSACTION_ID", OracleDbType.Varchar2).Value = obj.TXN_ID; cmd.Parameters.Add("P_DEPT_TRANS_ID", OracleDbType.Varchar2).Value = obj.DEPT_TXN_ID; cmd.Parameters.Add("P_DEPT_ID", OracleDbType.Varchar2).Value = obj.DEPT_ID; cmd.Parameters.Add("P_BEN_TRANS_ID", OracleDbType.Varchar2).Value = obj.BEN_ID; cmd.Parameters.Add("P_SERVICE_NAME", OracleDbType.Varchar2).Value = obj.SERVICE_NAME; cmd.Parameters.Add("P_STATUS_CODE", OracleDbType.Varchar2).Value = obj.STATUS_CODE; cmd.Parameters.Add("P_REMARKS", OracleDbType.Varchar2).Value = obj.REMARKS; cmd.Parameters.Add("P_IP_ADDRESS", OracleDbType.Varchar2).Value = obj.IP_ADDRESS; cmd.Parameters.Add("P_SYSTEM_NAME", OracleDbType.Varchar2).Value = obj.SYS_NAME; cmd.Parameters.Add("P_DISTRICT_ID", OracleDbType.Varchar2).Value = obj.DISTRICT_ID; cmd.Parameters.Add("P_MANDAL_ID", OracleDbType.Varchar2).Value = obj.MANDAL_ID; cmd.Parameters.Add("P_GP_WARD_ID", OracleDbType.Varchar2).Value = obj.GP_WARD_ID; cmd.Parameters.Add("P_GSWS_ID", OracleDbType.Varchar2).Value = obj.GSWS_ID; cmd.Parameters.Add("P_SERVICE_ID", OracleDbType.Varchar2).Value = obj.SERVICE_ID; cmd.Parameters.Add("P_LOGIN_USER", OracleDbType.Varchar2).Value = obj.LOGIN_USER; cmd.Parameters.Add("P_TYPE_OF_REQUEST", OracleDbType.Varchar2).Value = obj.TYPE_OF_REQUEST; cmd.Parameters.Add("P_HOD_ID", OracleDbType.Varchar2).Value = obj.HOD_ID; cmd.Parameters.Add("P_URL_ID", OracleDbType.Varchar2).Value = obj.URL_ID; cmd.Parameters.Add("P_DESIGNATION_ID", OracleDbType.Varchar2).Value = obj.DESIGNATION_ID; cmd.Parameters.Add("P_CITIZEN_NAME", OracleDbType.Varchar2).Value = obj.CITIZENNAME; cmd.Parameters.Add("P_MOBILE", OracleDbType.Varchar2).Value = obj.MOBILENUMBER; cmd.Parameters.Add("P_CUR", OracleDbType.RefCursor).Direction = ParameterDirection.Output; OracleDataAdapter oda = new OracleDataAdapter(cmd); DataTable data = new DataTable(); oda.Fill(data); return(data); } } } catch (Exception ex) { string mappath = HttpContext.Current.Server.MapPath("TransactionExceptionLogs"); Task WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_Log_Exception(mappath, "error:transactionInsertion:" + ex.Message + ":" + JsonConvert.SerializeObject(obj))); throw ex; } }
public IHttpActionResult SpandanainitiateTransaction(dynamic data) { string serialized_data = token_gen.Authorize_aesdecrpty(data); try { transactionModel rootobj = JsonConvert.DeserializeObject <transactionModel>(serialized_data); return(Ok(_Hel.initiateSpandanaTransaction(rootobj))); } catch (Exception ex) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message)); } }
public dynamic initiateSpandanaTransaction(transactionModel obj) { dynamic objdata = new ExpandoObject(); try { obj.TYPE = "1"; obj.IP_ADDRESS = HttpContext.Current.Request.UserHostAddress; obj.SYS_NAME = System.Environment.MachineName; obj.TXN_ID = obj.SECRETRAINT_CODE + DateTime.Now.ToString("yymmddHHmm") + new Random().Next(1000, 9999); DataTable dt = transactionInsertion(obj); if (dt != null && dt.Rows.Count > 0) { string encrypttext = ""; string iv = ""; iv = CryptLib.GenerateRandomIV(16); string key = CryptLib.getHashSha256("GSWS TEST", 32); string obj2 = GetInputJsonFormat(obj); encrypttext = EncryptDecryptAlgoritham.EncryptStringAES(obj2, key, iv); objdata.status = 200; if (obj.URL_ID == "340200101") { objdata.URL = "https://www.spandana.ap.gov.in/gsws/servicegrievance_registration?accessToken=" + Token() + "&Volunteerid=2255667788&AadhaarNo=" + obj.UID + "&vvstype=VVS2&DistId=" + obj.Sdistcode + "&MandalId=" + obj.Smcode + "&GpId=" + obj.Svtcode + "&GpFlag=" + obj.SRuflag + "&encryptId=" + encrypttext + "&KEY=" + key + "&IV=" + iv; } else { objdata.URL = "https://www.spandana.ap.gov.in/gsws/servicerequest_registration?HodId=" + obj.SERVICE_CODE + "&accessToken= " + Token() + "&Volunteerid=2255667788&AadhaarNo=" + obj.UID + "&vvstype=VVS2&DistId=" + obj.Sdistcode + "&MandalId=" + obj.Smcode + "&GpId=" + obj.Svtcode + "&GpFlag=" + obj.SRuflag + "&encryptId=" + encrypttext + "&KEY=" + key + "&IV=" + iv; } objdata.Reason = "Record Inserted Successfully !!!"; } else { objdata.status = 400; objdata.Reason = "Failed to Insert Record, Please Try Again !!! "; } } catch (Exception ex) { objdata.status = 500; objdata.Reason = "Something Went Wrong.Please Try Again"; //ex.Message.ToString(); } return(objdata); }
public dynamic closingTransaction(transactionModel obj) { dynamic objdata = new ExpandoObject(); try { obj.TYPE = "2"; DataTable dt = transactionInsertion(obj); if (dt != null && dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == "1") { SMSService.SMSService objsms = new SMSService.SMSService(); string Status = "402"; //objsms.SendSMS("8096424075", "Dear User \n Your Service Request Id is :" + obj.TXN_ID + "For Service" + obj.SERVICE_NAME + "on Date:" + DateTime.Now.ToString() + " at" + obj.SECRETRAINT_CODE); if (Status.Contains("402")) { objdata.status = 200; objdata.result = "Record Inserted Successfully !!!"; } else { objdata.status = 200; objdata.result = "Record Inserted Successfully !!!"; } } else { objdata.status = 400; objdata.result = "Failed to Insert Record, Please Try Again !!! "; } } catch (Exception ex) { objdata.status = 500; objdata.result = ex.Message.ToString(); } return(objdata); }
public dynamic initiateTransaction(transactionModel obj) { dynamic objdata = new ExpandoObject(); try { obj.TYPE = "1"; obj.IP_ADDRESS = HttpContext.Current.Request.UserHostAddress; obj.SYS_NAME = System.Environment.MachineName; obj.TXN_ID = obj.SECRETRAINT_CODE + DateTime.Now.ToString("yyMMddHHmm") + new Random().Next(1000, 9999); DataTable dt = transactionInsertion(obj); if (dt != null && dt.Rows.Count > 0) { string encrypttext = ""; string iv = ""; if (obj.TYPE_OF_SERVICE == "1") { iv = CryptLib.GenerateRandomIV(16); string key = CryptLib.getHashSha256("GSWS TEST", 32); string obj2 = GetInputJsonFormat(obj); encrypttext = EncryptDecryptAlgoritham.EncryptStringAES(obj2, key, iv); } else if (obj.URL_ID == "110401301" || obj.URL_ID == "110102501" || obj.URL_ID == "110102601" || obj.URL_ID == "310300104") { iv = CryptLib.GenerateRandomIV(16); string key = CryptLib.getHashSha256("GSWS TEST", 32); string obj2 = GetInputJsonFormat(obj); encrypttext = EncryptDecryptAlgoritham.EncryptStringAES(obj2, key, iv); } else if (obj.URL_ID == "200301401" || obj.URL_ID == "360201701" || obj.URL_ID == "360201401" || obj.URL_ID == "130101101" || obj.URL_ID == "280101201" || obj.URL_ID == "280101401" || obj.URL_ID == "280101301" || obj.URL_ID == "360201801" || obj.URL_ID == "3602018501" || obj.URL_ID == "170100102" || obj.URL_ID == "130101401" || obj.URL_ID == "130101501" || obj.URL_ID == "240200101") { iv = CryptLib.GenerateRandomIV(16); string key = CryptLib.getHashSha256("GSWS TEST", 32); string obj2 = GetInputJsonFormat(obj); encrypttext = EncryptDecryptAlgoritham.EncryptStringAES(obj2, key, iv); } else { } objdata.status = 200; //objdata.Translist = dt; objdata.encrypttext = encrypttext; objdata.key = iv; objdata.TransId = obj.TXN_ID; objdata.Reason = "Record Inserted Successfully !!!"; } else { objdata.status = 400; objdata.Reason = "Failed to Insert Record, Please Try Again !!! "; } } catch (Exception ex) { objdata.status = 500; objdata.Reason = "Something Went Wrong.Please Try Again"; //ex.Message.ToString(); } return(objdata); }