public void SaveDataSubscriber(string resp, int status, string TransactionID, string amount) { int Regulatery = 0; DateTime today = DateTime.Today; // DateTime date = new DateTime(2017, 07, 20); DataSet dsReg = svc.GetRegulatery(); DateTime date = Convert.ToDateTime(dsReg.Tables[0].Rows[0]["StartDate"]); if (date <= today) { Regulatery = 1; } else { Regulatery = 0; } SPayment sp = new SPayment(); sp.ChargedAmount = Convert.ToDecimal(amount); sp.PaymentType = 5; sp.PayeeID = 1; sp.PaymentFrom = 8; sp.ActivationType = 7; sp.ActivationStatus = status; sp.ActivationVia = 17; sp.ActivationResp = resp; sp.ActivationRequest = RequestRes; sp.TariffID = Convert.ToInt32(hddnTariffID.Value); sp.ALLOCATED_MSISDN = ""; sp.TransactionId = TransactionID; sp.PaymentId = 0; sp.PaymentMode = "Subscriber PortIn"; sp.TransactionStatus = "Fail"; sp.TransactionStatusId = 25; sp.CusName = txtCustomerName.Text.Trim(); sp.Address = txtAddress.Text.Trim(); sp.Mobile = txtAlternateNumber.Text.Trim(); sp.EmailID = txtEmailAddress.Text.Trim(); sp.Regulatery = Regulatery; int dist = 1; int loginID = 1; string sim = txtSIMCARD.Text.Trim(); string zip = txtZIPCode.Text.Trim(); string Language = "ENGLISH"; string ChannelID = ConfigurationManager.AppSettings.Get("TXN_SERIES"); try { int s = svc.InsertSubscriberActivationDetailService(dist, loginID, sim, zip, Language, ChannelID, sp); WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Success when sim not activated In Subscriber Case"); } catch (Exception ex) { WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Fail when sim not activated In Subscriber Case"); } //ShowPopUpMsg("PORTIN Request Fail \n Please Try Again"); resetControls(1); }
//--In case of company topupbutton protected void btnCompanyTopup_Click(object sender, EventArgs e) { try { if (ddlDistributor.SelectedIndex > 0) { if (Convert.ToDouble(txtTopupAmount.Text.Trim()) > 0) { SPayment sp = new SPayment(); sp.ChargedAmount = Convert.ToDecimal(txtTopupAmount.Text.Trim()); sp.PaymentType = 3; sp.PayeeID = Convert.ToInt32(ddlDistributor.SelectedValue); sp.PaymentFrom = 9; sp.ActivationVia = 17; sp.TransactionStatus = "Success"; sp.CheckSumm = ""; sp.Remarks = Convert.ToString(txtReason.Text.Trim()); sp.PaymentMode = "Company Topup"; sp.TransactionStatusId = 24; sp.Currency = Convert.ToInt32(Session["CurrencyId"]); int dist = Convert.ToInt32(ddlDistributor.SelectedValue); int loginID = Convert.ToInt32(Session["LoginID"]); int a = svc.InsertCompanyTopupBalanceService(dist, loginID, sp); if (a > 0) { Distributor[] dst = svc.GetSingleDistributorService(Convert.ToInt32(ddlDistributor.SelectedValue)); if (dst.Length > 0) { lblBalanceAmount.Text = Convert.ToString(Session["CurrencyName"]) + " " + Convert.ToString(dst[0].balanceAmount); hddnDistributorID.Value = Convert.ToString(dst[0].distributorID); } ShowPopUpMsg("Topup Successful"); txtTopupAmount.Text = "0.00"; txtReason.Text = string.Empty; lblwarning.Text = ""; lblwarning.Style.Add("display", "none"); } else { ShowPopUpMsg("Topup Unsuccessful\n Please Try Again"); } } else { lblwarning.Text = "Amount Should be Greater Than Zero"; lblwarning.Style.Add("display", "block"); } } else { ShowPopUpMsg("Please Select Distributor"); } } catch (Exception ex) { ShowPopUpMsg("Topup Unsuccessfull\n Please Try Again"); } }
// GET: /Payment/Create public ActionResult Refund(int id) { SPayment payment = serviceProxy.GetPayment(id); PaymentData pd = new PaymentData(); pd.Amount = payment.amount; pd.FilmTitle = payment.filmtitle; pd.ID = payment.rental_id.Value; pd.customerID = payment.customer_id; pd.rentalID = payment.rental_id.Value; pd.staffID = payment.staff_id; pd.PaymentDate = payment.payment_date; return(View(pd)); }
public void SaveDataSubscriber(string resp, int status, string TransactionID, string amount) { SPayment sp = new SPayment(); sp.ChargedAmount = Convert.ToDecimal(amount); sp.PaymentType = 4; sp.PayeeID = 1; sp.PaymentFrom = 8; sp.ActivationType = 6; sp.ActivationStatus = status; sp.ActivationVia = 17; sp.ActivationResp = resp; sp.ActivationRequest = RequestRes; sp.TariffID = Convert.ToInt32(hddnTariffID.Value); sp.ALLOCATED_MSISDN = ""; sp.TransactionId = TransactionID; sp.PaymentMode = "Subscriber EasyGo Activation"; sp.TransactionStatus = "Fail"; sp.TransactionStatusId = 25; sp.CusName = txtCustomerName.Text.Trim(); sp.Address = txtAddress.Text.Trim(); sp.Mobile = txtAlternateNumber.Text.Trim(); sp.EmailID = txtEmail.Text.Trim(); int dist = 1; int loginID = 1; string sim = txtSIMCARD.Text.Trim(); string zip = txtZIPCode.Text.Trim(); string Language = "ENGLISH"; string ChannelID = ConfigurationManager.AppSettings.Get("TXN_SERIES"); try { int s = svc.InsertSubscriberActivationDetailService(dist, loginID, sim, zip, Language, ChannelID, sp); WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Success when EasyGo sim not activated In Subscriber Case"); } catch (Exception ex) { WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Fail when EasyGo sim not activated In Subscriber Case"); } //ShowPopUpMsg("SIM activation Fail"); resetControls(1); }
public int InsertPayment(string ststus) { int a = 0; DataSet ds = null; try { if (Session["LoginID"] != null) { SPayment sp = new SPayment(); sp.ChargedAmount = Convert.ToDecimal(Session["Amount"]); sp.PaymentType = 3; sp.PayeeID = Convert.ToInt32(Session["DistributorID"]); sp.PaymentFrom = 9; sp.ActivationVia = 18; sp.TransactionStatusId = 23; sp.TransactionStatus = ststus; sp.PaymentMode = "PayPal Topup"; sp.TxnDate = DateTime.Now.ToString(); sp.Currency = Convert.ToInt32(Session["CurrencyId"]); int dist = Convert.ToInt32(Session["DistributorID"]); int loginID = Convert.ToInt32(Session["LoginID"]); ds = svc.InsertPaypalTopupService(dist, loginID, sp); if (ds != null) { a = Convert.ToInt32(ds.Tables[0].Rows[0][0]); } return(a); } else { return(a); } } catch (Exception ex) { return(a); } }
public void SaveDataCompany(string resp, int status, string TransactionID, string Amount) { SPayment sp = new SPayment(); sp.ChargedAmount = Convert.ToDecimal(Amount); sp.PaymentType = 5; sp.PayeeID = 1;// Convert.ToInt32(Session["DistributorID"]); sp.PaymentFrom = 9; sp.ActivationType = 7; sp.ActivationStatus = status; sp.ActivationVia = 17; sp.ActivationResp = resp; sp.ActivationRequest = RequestRes; sp.TariffID = 0; sp.ALLOCATED_MSISDN = ""; sp.TransactionId = TransactionID; sp.PaymentMode = "Subscriber PortIn"; sp.TransactionStatusId = 25; sp.TransactionStatus = "Fail"; int dist = 1; //Convert.ToInt32(Session["DistributorID"]); int loginID = 1; // Convert.ToInt32(Session["LoginID"]); string sim = txtSIMCARD.Text.Trim(); string zip = txtZIPCode.Text.Trim(); string Language = "ENGLISH"; string ChannelID = ConfigurationManager.AppSettings.Get("TXN_SERIES"); try { int s = svc.UpdateAccountBalanceService(dist, loginID, sim, zip, Language, ChannelID, sp); WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Success when sim PortIn Not Success In Subscriber Case"); } catch (Exception ex) { WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Fail when sim PortIn Not Success In Subscriber Case"); } //ShowPopUpMsg("PORTIN Request Fail"); resetControls(1); }
public void SaveData(string resp, int status, string TransactionID) { SPayment sp = new SPayment(); sp.ChargedAmount = Convert.ToDecimal(AmountPay); sp.PaymentType = 4; sp.PayeeID = Convert.ToInt32(Session["DistributorID"]); sp.PaymentFrom = 9; sp.ActivationType = 6; sp.ActivationStatus = status; sp.ActivationVia = 18; sp.ActivationResp = resp; sp.ActivationRequest = ActivationRequestString; sp.TariffID = Convert.ToInt32(TariffID); sp.ALLOCATED_MSISDN = ""; sp.TransactionId = TransactionID; sp.PaymentId = Convert.ToInt32(Session["PaymentId"]); sp.TransactionStatusId = 25; int dist = Convert.ToInt32(Session["DistributorID"]); int loginID = Convert.ToInt32(Session["LoginID"]); string sim = SIMCARD; string zip = ZIPCode; string Language = "ENGLISH"; string ChannelID = ConfigurationManager.AppSettings.Get("TXN_SERIES"); try { int s = svc.UpdatePaypalAccountBalanceService(dist, loginID, sim, zip, Language, ChannelID, sp); WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save success when sim Not activated In Distributor Case"); } catch (Exception ex) { WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Fail when sim not activate In Distributor Case"); } //ShowPopUpMsg("SIM activation Fail"); }
public void WriteLog(int dist, int loginID, string sim, string zip, string Language, string ChannelID, SPayment sp, string msgg) { try { StringBuilder logdata = new StringBuilder(); logdata.Append(dist + "|"); logdata.Append(loginID + "|"); logdata.Append(sim + "|"); logdata.Append(zip + "|"); logdata.Append(Language + "|"); logdata.Append(ChannelID + "|"); logdata.Append(sp.ChargedAmount + "|"); logdata.Append(sp.PaymentType + "|"); logdata.Append(sp.PayeeID + "|"); logdata.Append(sp.PaymentFrom + "|"); logdata.Append(sp.ActivationType + "|"); logdata.Append(sp.ActivationStatus + "|"); logdata.Append(sp.ActivationVia + "|"); logdata.Append(sp.ActivationRequest + "|"); logdata.Append(sp.ActivationResp + "|"); logdata.Append(sp.TariffID); logdata.Append(sp.TransactionId); logdata.Append(sp.CusName); logdata.Append(sp.Address); logdata.Append(sp.EmailID); logdata.Append(sp.Mobile); string data = logdata.ToString(); Log1(data, msgg); Log1("", "split"); } catch (Exception ex) { } }
protected void btnSubscriber_Click(object sender, EventArgs e) { try { GetClientIPAddress(); } catch { } int distr = 1; int clnt = 3; string simnumber = txtSIMCARD.Text.Trim(); string transact = ""; DataTable dtTrans = svc.GetTransactionIDService(); int id = Convert.ToInt32(dtTrans.Rows[0]["TRANSACTIONID"]); transact = id.ToString("00000"); transact = ConfigurationManager.AppSettings.Get("TXN_SERIES") + transact; Boolean ValidSim = false; string TariffAmount = ""; string TariffPlan = ""; string Network = "EasyGo"; string erormsg = ""; try { string ss = ""; ss = "Simnumber- " + simnumber + "|" + "Zipcode- " + txtZIPCode.Text + "|" + "Pin- " + txtPIN.Text + "|" + "Account- " + txtACCOUNT.Text + "|" + "Phone to port- " + txtPHONETOPORT.Text + "|" + "Customer name- " + txtCustomerName.Text + "|" + "address- " + txtAddress.Text + "|" + "Email- " + txtEmailAddress.Text; ss = ss + "Current Service Provider Name- " + txtServiceProvider.Text + "|" + "State- " + txtState.Text + "|" + "City- " + txtCity.Text + "|" + "Customer 1st and Last Name- " + txtCustomerName.Text; Log1(ss, "Subscriber EasyGo PORTIN Information"); Log1("", "split"); DataSet ds = svc.CheckSimPortINService(distr, clnt, simnumber); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { erormsg = Convert.ToString(ds.Tables[0].Rows[0][0]); if (erormsg == "Ready to Activation") { //RequestRes = ss; ValidSim = true; hddnTariffTypeID.Value = Convert.ToString(ds.Tables[0].Rows[0]["TariffTypeID"]); hddnTariffType.Value = Convert.ToString(ds.Tables[0].Rows[0]["TariffType"]); hddnTariffCode.Value = Convert.ToString(ds.Tables[0].Rows[0]["TariffCode"]); hddnTariffAmount.Value = Convert.ToString(ds.Tables[0].Rows[0]["Amount"]); TariffAmount = hddnTariffAmount.Value; hddnTariffID.Value = Convert.ToString(ds.Tables[0].Rows[0]["ID"]); TariffPlan = Convert.ToString(ds.Tables[0].Rows[0]["TrariffPlan"]); hddnMonths.Value = Convert.ToString(ds.Tables[0].Rows[0]["Months"]); } else { Log1("Sim Not Ready For EasyGo PortIN", "Reason"); Log1(ss, "Detail"); Log1(simnumber, "Simnumber"); Log1(txtPHONETOPORT.Text, "Phone to port"); Log1(txtZIPCode.Text, ""); Log1("", "split"); } } } } catch (Exception ex) { ValidSim = false; erormsg = ex.Message; } if (ValidSim == false) { ShowPopUpMsg(erormsg); return; } string InvoiceNo = DateTime.Now.ToString().GetHashCode().ToString("X"); // ENK.net.emida.ws.webServicesService ws = new webServicesService(); // string ss1 = ws.LycaPortinPin("01", "3756263", "1234", hddnTariffCode.Value, txtSIMCARD.Text, txtPHONETOPORT.Text, txtACCOUNT.Text, txtPIN.Text, txtZIPCode.Text, "1", txtEmailAddress.Text, "$10", txtAmountPay.Text, InvoiceNo, "1"); try { // SendMail(txtEmailAddress.Text.Trim(), "Sim PortIn", "", txtSIMCARD.Text.Trim(), ""); SendMailH20AndEasyGo(txtEmailAddress.Text.Trim(), "EasyGo Sim PortIn", "", txtSIMCARD.Text.Trim(), "", Network, TariffPlan, TariffAmount); SPayment sp = new SPayment(); sp.ChargedAmount = Convert.ToDecimal(TariffAmount); sp.PaymentType = 5; sp.PayeeID = distr; sp.PaymentFrom = 9; sp.ActivationType = 7; sp.ActivationStatus = 15; sp.ActivationVia = 17; sp.ActivationResp = ""; sp.ActivationRequest = RequestRes; sp.TariffID = Convert.ToInt32(hddnTariffID.Value); sp.ALLOCATED_MSISDN = ""; sp.TransactionId = transact; sp.PaymentMode = "Subscriber EasyGo PortIn"; sp.TransactionStatusId = 24; sp.TransactionStatus = "Success"; int dist = 1; // Convert.ToInt32(Session["DistributorID"]); int loginID = 1; // Convert.ToInt32(Session["LoginID"]); string sim = txtSIMCARD.Text.Trim(); string zip = txtZIPCode.Text.Trim(); string Language = "ENGLISH"; string ChannelID = System.Configuration.ConfigurationManager.AppSettings.Get("TXN_SERIES"); try { int s = svc.UpdateAccountBalanceService(dist, loginID, sim, zip, Language, ChannelID, sp); WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Success when EasyGo sim PortIn Success In Subscriber Case"); } catch (Exception ex) { WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Fail when EasyGo sim PortIn Success In Subscriber Case"); } ShowPopUpMsg("EasyGo PORTIN Request submitted Successfully\n With Sim Number - " + txtSIMCARD.Text); resetControls(1); } catch (Exception ex) { SaveDataCompany(txtSIMCARD.Text, 16, transact, TariffAmount); ShowPopUpMsg("PORTIN Request Fail \n Please Try Again"); //ShowPopUpMsg(ex.Message + "\n" + resp); } //else //{ // SaveDataSubscriber(resp, 16, transact, TariffAmount); // ShowPopUpMsg("PORTIN Request Fail \n Please Try Again"); //} }
public int UpdatePayment(string resp, string ststus, string transactionid, int TranactionStatusId) { int a = 0; try { if (Session["PaymentId"] != null) { if (transactionid == null) { transactionid = ""; } if (Session["LoginID"] != null) { if (TranactionStatusId != 25) { string[] sd = resp.Split('\n'); List <string> sdlist = new List <string>(); SPayment sp = new SPayment(); sp.PaymentId = Convert.ToInt32(Session["PaymentId"]); sp.ChargedAmount = Convert.ToDecimal(Session["Amount"]); sp.TxnId = transactionid; sp.TxnAmount = sd[27].Replace("payment_fee=", ""); sp.TransactionStatus = ststus; sp.TransactionStatusId = TranactionStatusId; sp.ReceiptId = ""; sp.PayerId = sd[4].Replace("payer_id=", ""); sp.TxnDate = DateTime.Now.ToString(); sp.CheckSumm = resp; int dist = Convert.ToInt32(Session["DistributorID"]); int loginID = Convert.ToInt32(Session["LoginID"]); a = svc.UpdatePaypalTopupService(dist, loginID, sp); Session["PaymentId"] = null; Session["Amount"] = null; } else { SPayment sp = new SPayment(); sp.PaymentId = Convert.ToInt32(Session["PaymentId"]); sp.ChargedAmount = Convert.ToDecimal(Session["Amount"]); sp.TxnId = transactionid; sp.TxnAmount = ""; sp.TransactionStatus = ststus; sp.TransactionStatusId = TranactionStatusId; sp.ReceiptId = ""; sp.PayerId = ""; sp.TxnDate = DateTime.Now.ToString(); sp.CheckSumm = resp; int dist = Convert.ToInt32(Session["DistributorID"]); int loginID = Convert.ToInt32(Session["LoginID"]); a = svc.UpdatePaypalTopupService(dist, loginID, sp); Session["PaymentId"] = null; Session["Amount"] = null; } return(a); } else { Log("Session null in database insertion block", "Reason"); Log(resp, ""); Log("", "split"); return(a); } } return(a); } catch (Exception ex) { Log("database insertion catch block" + ex.Message, "Reason"); Log(resp, ""); Log("", "split"); return(a); } }
protected void btnSubscriber_Click(object sender, EventArgs e) { try { GetClientIPAddress(); } catch { } ///-----------------------------------EasyGo------------------ /// ENK.net.emida.ws.webServicesService ws = new webServicesService(); int distr = 1; // Convert.ToInt32(Session["DistributorID"]); int clnt = 3; //Convert.ToInt32(Session["ClientTypeID"]); string simnumber = txtSIMCARD.Text.Trim(); string City = txtCity.Text.Trim(); string transact = ""; string TariffAmount = ""; Boolean ValidSim = false; string erormsg = ""; try { string ss = ""; ss = "Simnumber- " + simnumber + "|" + "Zipcode- " + txtZIPCode.Text + "|" + "Customer name- " + txtCustomerName.Text + "|" + "address- " + txtAddress.Text + "|" + "Alternate Mobile number- " + txtAlternateNumber.Text + "|" + "Email- " + txtEmail.Text + "|" + "City- " + txtCity.Text; Log2(ss, "Subscriber Activate EasyGo SIM Information"); Log2("", "split"); DataSet ds = svc.CheckSimActivationService(distr, clnt, simnumber, "Activate"); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { erormsg = Convert.ToString(ds.Tables[0].Rows[0][0]); if (erormsg == "Ready to Activation") { ValidSim = true; int id = Convert.ToInt32(ds.Tables[1].Rows[0]["TRANSACTIONID"]); transact = id.ToString("00000"); transact = ConfigurationManager.AppSettings.Get("TXN_SERIES") + transact; hddnTariffTypeID.Value = Convert.ToString(ds.Tables[0].Rows[0]["TariffTypeID"]); hddnTariffType.Value = Convert.ToString(ds.Tables[0].Rows[0]["TariffType"]); hddnTariffCode.Value = Convert.ToString(ds.Tables[0].Rows[0]["TariffCode"]); hddnTariffAmount.Value = Convert.ToString(ds.Tables[0].Rows[0]["Amount"]); TariffAmount = hddnTariffAmount.Value; hddnTariffID.Value = Convert.ToString(ds.Tables[0].Rows[0]["ID"]); hddnMonths.Value = Convert.ToString(ds.Tables[0].Rows[0]["Months"]); } else { Log2("Subscriber Activate EasyGo Sim Not Ready For Activation", "Reason"); Log2(ss, "Request"); Log2(simnumber, "Simnumber"); Log2(TariffAmount, "Amount"); Log2(hddnTariffCode.Value, "PLan"); Log2("", "split"); } } } } catch (Exception ex) { erormsg = ex.Message; ValidSim = false; } //ValidSim = true; if (ValidSim == false) { ShowPopUpMsg(erormsg); return; } string InvoiceNo = DateTime.Now.ToString().GetHashCode().ToString("X"); InvoiceNo = "AC" + InvoiceNo; string ss2 = ws.GetPinProductsForActivation("01", "3756263", "1234", hddnTariffCode.Value, InvoiceNo, "1"); string resp = ""; StringReader theReader = new StringReader(Convert.ToString(ss2)); DataSet theDataSet = new DataSet(); theDataSet.ReadXml(theReader); if (theDataSet.Tables.Count > 0) { DataTable dt = new DataTable(); if (theDataSet.Tables.Count > 1) { dt = theDataSet.Tables[1]; } else { SaveDataSubscriber(ss2, 16, transact, TariffAmount); //WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, ss2); ShowPopUpMsg("NO RECORDS FOUND."); return; } if (dt.Rows.Count > 0 && dt.Columns.Contains("PinProductId")) { string PINid = dt.Rows[0]["PinProductId"].ToString(); string ProductDescription = dt.Rows[0]["PinProductDescription"].ToString(); if (PINid != "") { //resp = ws.LocusActivateGSMsim("3756263", PINid, "1234", hddnTariffCode.Value, "1", InvoiceNo, "01", "305", simnumber, City, txtZIPCode.Text); resp = ws.LocusActivateGSMsim("3756263", PINid, "1234", hddnTariffCode.Value, "1", InvoiceNo, "01", "305", simnumber, City, txtZIPCode.Text); //resp = ws.LocusActivateGSMsim("3756263", PINid, "1234", "93000030", "1", InvoiceNo, "01", "305", simnumber, City, zip); StringReader Reader = new StringReader(resp); DataSet ds = new DataSet(); ds.ReadXml(Reader); string Currency = Convert.ToString("$"); // Save Record ProductMaster int NetworkID = 16;// EasyGo svc.SaveProductMaster(Convert.ToInt32(NetworkID), Convert.ToInt32(hddnTariffID.Value), ProductDescription, ProductDescription, Currency, TariffAmount, Convert.ToInt32(1)); if (ds.Tables.Count > 0) { DataTable dtMsg = ds.Tables[0]; if (dtMsg.Rows.Count > 0) { string ResponseCode = dtMsg.Rows[0]["ResponseCode"].ToString(); string ResponseMessage = dtMsg.Rows[0]["ResponseMessage"].ToString(); if (ResponseCode == "00") { string ALLOCATED_MSISDN = dtMsg.Rows[0]["min"].ToString();; SendMail(txtEmail.Text.Trim(), "EasyGo Sim Activation", ALLOCATED_MSISDN, txtSIMCARD.Text.Trim(), ""); SPayment sp = new SPayment(); sp.ChargedAmount = Convert.ToDecimal(TariffAmount); sp.PaymentType = 4; sp.PayeeID = 1; sp.PaymentFrom = 8; sp.ActivationType = 6; sp.ActivationStatus = 15; sp.ActivationVia = 17; sp.ActivationResp = resp; sp.ActivationRequest = RequestRes; sp.TransactionId = transact; sp.TariffID = Convert.ToInt32(hddnTariffID.Value); sp.ALLOCATED_MSISDN = ALLOCATED_MSISDN; sp.PaymentMode = "Subscriber EasyGo Activation"; sp.TransactionStatus = "Success"; sp.TransactionStatusId = 24; sp.CusName = txtCustomerName.Text.Trim(); sp.Address = txtAddress.Text.Trim(); sp.Mobile = txtAlternateNumber.Text.Trim(); sp.EmailID = txtEmail.Text.Trim(); int dist = 1; int loginID = 1; string sim = txtSIMCARD.Text.Trim(); string zip = txtZIPCode.Text.Trim(); string Language = "ENGLISH"; string ChannelID = ConfigurationManager.AppSettings.Get("TXN_SERIES"); svc.SaveTransactionDetails(Convert.ToInt32(NetworkID), Convert.ToInt32(hddnTariffID.Value), "10", PINid, simnumber, InvoiceNo, TariffAmount, Currency, City, txtZIPCode.Text, "305", 1, TariffAmount); try { int s = svc.InsertSubscriberActivationDetailService(dist, loginID, sim, zip, Language, ChannelID, sp); WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Success when EasyGo sim activated In Subscriber Case"); } catch (Exception ex) { WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save fail when EasyGo sim activated In Subscriber Case"); } ShowPopUpMsg("SIM activation done successfully\n with Mobile Number - " + ALLOCATED_MSISDN); resetControls(1); } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } }
public static string InsertGlobalRechargeDetails(string respString) { if (HttpContext.Current != null) { Service1Client svcStatic = new Service1Client(); if (HttpContext.Current.Session["LoginID"] != null) { DataTable dtTrans = svcStatic.GetTransactionIDService(); int id = Convert.ToInt32(dtTrans.Rows[0]["TRANSACTIONID"]); string transact = id.ToString("00000"); transact = ConfigurationManager.AppSettings.Get("TXN_SERIES") + transact; //string res = "0|1000|15.86|null|null|Complete|1|IN_ID_TopUp_1000.00|15.86|USD|910000000000|1234567"; // Demo Response string[] parameters = respString.Split('|'); string TransferRef = parameters[0]; string ReceiveValue = parameters[1]; decimal TxnAmount = Convert.ToDecimal(parameters[2]); //SendValue string StartedUtc = parameters[3]; string TxnDate = parameters[4]; //CompletedUtc string RespMsg = parameters[5]; //ProcessingState string RespCode = parameters[6]; //ResultCode string SkuTariffCode = parameters[7]; string SendCurrencyIso = parameters[9]; string MobileNumber = parameters[10]; //AccountNumber string DistributorRef = parameters[11]; string req = "{SkuCode: " + SkuTariffCode + ", SendValue: " + TxnAmount + ", SendCurrencyIso: USD, AccountNumber: " + MobileNumber + ", DistributorRef: " + transact + ", ValidateOnly: true}"; string resp = "{TransferRef: " + TransferRef + ", SkuCode: " + SkuTariffCode + ", ReceiveValue: " + ReceiveValue + ", SendValue: " + TxnAmount + ", StartedUtc: " + StartedUtc + ", CompletedUtc: " + TxnDate + ", ProcessingState: " + RespMsg + ", AccountNumber: " + MobileNumber + ", ResultCode: " + RespCode + "}"; string TariffDescription = SkuTariffCode + "SendValue" + TxnAmount; string Country = Convert.ToString(HttpContext.Current.Session["Country"]); string Operator = parameters[12]; //Get the discount DataView DvDiscount = new DataView(); DvDiscount.Table = (DataTable)(HttpContext.Current.Session["Discount"]); DvDiscount.RowFilter = "ProviderCode='" + Operator + "'"; DataTable Dis = DvDiscount.ToTable(); decimal Discount = Convert.ToDecimal(Dis.Rows[0]["Discount"]); if (respString.Trim() != null && respString.Trim() != "") { try { SPayment sp = new SPayment(); sp.ChargedAmount = ((Convert.ToDecimal(TxnAmount) / Convert.ToDecimal(100.00)) * (Convert.ToDecimal(100.00) - Convert.ToDecimal(Discount))); sp.PaymentType = 26; sp.PayeeID = Convert.ToInt32(HttpContext.Current.Session["DistributorID"]); sp.PaymentFrom = 9; // Distributor sp.ActivationType = 6; //Recharge sp.ActivationStatus = 15; //Active sp.ActivationVia = 17; //Account balance sp.ActivationResp = resp; sp.ActivationRequest = req; sp.TransactionId = transact; sp.PaymentMode = "Global Recharge"; sp.TransactionStatusId = 24; sp.TransactionStatus = "Success"; int dist = Convert.ToInt32(HttpContext.Current.Session["DistributorID"]); int loginID = Convert.ToInt32(HttpContext.Current.Session["LoginID"]); string Language = "ENGLISH"; string ChannelID = ConfigurationManager.AppSettings.Get("CHANNEL"); try { int s = svcStatic.UpdateAccountDingRecharge(dist, loginID, MobileNumber, ChannelID, Language, sp, SkuTariffCode, TariffDescription, TransferRef, TxnAmount, RespCode, RespMsg, TxnDate, Country, Operator, SendCurrencyIso); WriteLog(dist, loginID, MobileNumber, transact, Language, ChannelID, "Record Save Success when Ding Recharge is processed"); } catch (Exception ex) { WriteLog(dist, loginID, MobileNumber, ex.Message, Language, ChannelID, "Record Save Success when Ding Recharge is processed"); } } catch (Exception ex) { } } if (RespMsg == "Complete") { return("Print.aspx?Tid=" + transact + "&URL=Global Recharge"); } else { return("Recharge Got failed, Please try again"); } } else { return("Session Out"); } } else { return("Session Out"); } }
public void ActivationProcess(string request) { string resp = ActivateSim(request); Session["RequestString"] = null; //DataSet ds = svc.GetTestDataService(); //string resp = ds.Tables[0].Rows[0][0].ToString(); if (resp.Trim() != null && resp.Trim() != "") { try { StringReader theReader = new StringReader(resp); DataSet theDataSet = new DataSet(); theDataSet.ReadXml(theReader); if (theDataSet.Tables.Count > 0) { DataTable dt = theDataSet.Tables[0]; if (dt.Rows.Count > 0) { string errorDesc = dt.Rows[0]["ERROR_DESC"].ToString(); if (dt.Rows[0]["ERROR_CODE"].ToString() == "0") { ActivationResult = true; ALLOCATED_MSISDN = theDataSet.Tables[2].Rows[0]["ALLOCATED_MSISDN"].ToString(); SendMail(email, "Sim Activation", ALLOCATED_MSISDN, SIMCARD, ""); SPayment sp = new SPayment(); sp.ChargedAmount = Convert.ToDecimal(AmountPay); sp.PaymentType = 4; sp.PayeeID = Convert.ToInt32(Session["DistributorID"]); sp.PaymentFrom = 9; sp.ActivationType = 6; sp.ActivationStatus = 15; sp.ActivationVia = 18; sp.ActivationResp = resp; sp.ActivationRequest = request; sp.TariffID = Convert.ToInt32(TariffID); sp.ALLOCATED_MSISDN = ALLOCATED_MSISDN; sp.TransactionId = TransactionID; sp.PaymentId = Convert.ToInt32(Session["PaymentId"]); sp.TransactionStatusId = 24; int dist = Convert.ToInt32(Session["DistributorID"]); int loginID = Convert.ToInt32(Session["LoginID"]); string sim = SIMCARD; string zip = ZIPCode; string Language = "ENGLISH"; string ChannelID = ConfigurationManager.AppSettings.Get("TXN_SERIES");; try { int s = svc.UpdatePaypalAccountBalanceService(dist, loginID, sim, zip, Language, ChannelID, sp); WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Success when sim activated In Distributor Case"); } catch (Exception ex) { WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Fail when sim activated In Distributor Case"); } // ShowPopUpMsg("SIM activation done successfully\n with Mobile Number - " + ALLOCATED_MSISDN); } else { SaveData(resp, 16, TransactionID); //ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } } else { SaveData(resp, 16, TransactionID); // ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } } else { SaveData(resp, 16, TransactionID); //ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } } catch (Exception ex) { SaveData(resp, 16, TransactionID); //ShowPopUpMsg(ex.Message + "\n" + resp); } } else { SaveData(resp, 16, TransactionID); //ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } }
protected void btnSubscriber_Click(object sender, EventArgs e) { try { GetClientIPAddress(); } catch { } int Regulatery = 0; int distr = 1; int clnt = 3; string simnumber = txtSIMCARD.Text.Trim(); string transact = ""; DataTable dtTrans = svc.GetTransactionIDService(); int id = Convert.ToInt32(dtTrans.Rows[0]["TRANSACTIONID"]); transact = id.ToString("00000"); transact = ConfigurationManager.AppSettings.Get("TXN_SERIES") + transact; Boolean ValidSim = false; string TariffAmount = ""; string erormsg = ""; try { string ss = ""; ss = "Simnumber- " + simnumber + "|" + "Zipcode- " + txtZIPCode.Text + "|" + "Pin- " + txtPIN.Text + "|" + "Account- " + txtACCOUNT.Text + "|" + "Phone to port- " + txtPHONETOPORT.Text + "|" + "Customer name- " + txtCustomerName.Text + "|" + "address- " + txtAddress.Text + "|" + "Alternate Mobile number- " + txtAlternateNumber.Text + "|" + "Email- " + txtEmailAddress.Text; Log1(ss, "Subscriber Lyca PORTIN Information"); Log1("", "split"); DataSet ds = svc.CheckSimPortINService(distr, clnt, simnumber); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { erormsg = Convert.ToString(ds.Tables[0].Rows[0][0]); if (erormsg == "Ready to Activation") { ValidSim = true; hddnTariffTypeID.Value = Convert.ToString(ds.Tables[0].Rows[0]["TariffTypeID"]); hddnTariffType.Value = Convert.ToString(ds.Tables[0].Rows[0]["TariffType"]); hddnTariffCode.Value = Convert.ToString(ds.Tables[0].Rows[0]["TariffCode"]); hddnTariffAmount.Value = Convert.ToString(ds.Tables[0].Rows[0]["Amount"]); TariffAmount = hddnTariffAmount.Value; hddnTariffID.Value = Convert.ToString(ds.Tables[0].Rows[0]["ID"]); hddnMonths.Value = Convert.ToString(ds.Tables[0].Rows[0]["Months"]); // Add Rerulatry 1 $ from 1 jully 2017 DateTime today = DateTime.Today; // DateTime date = new DateTime(2017, 07, 20); DataSet dsReg = svc.GetRegulatery(); DateTime date = Convert.ToDateTime(dsReg.Tables[0].Rows[0]["StartDate"]); if (date <= today) { double Amt = 0.0; Amt = Convert.ToDouble(hddnTariffAmount.Value) + 1; TariffAmount = Convert.ToString(Amt); Regulatery = 1; } else { TariffAmount = hddnTariffAmount.Value; Regulatery = 0; } } else { Log1("Sim Not Ready For PortIN", "Reason"); Log1(ss, "Detail"); Log1(simnumber, "Simnumber"); Log1(txtPHONETOPORT.Text, "Phone to port"); Log1(txtZIPCode.Text, ""); Log1("", "split"); } } } } catch (Exception ex) { ValidSim = false; erormsg = ex.Message; } if (ValidSim == false) { ShowPopUpMsg(erormsg); return; } string resp = ActivateSim(hddnTariffTypeID.Value, hddnTariffType.Value, hddnTariffCode.Value, txtEmailAddress.Text.Trim(), transact, TariffAmount); if (resp.Trim() != null && resp.Trim() != "") { try { StringReader theReader = new StringReader(resp); DataSet theDataSet = new DataSet(); theDataSet.ReadXml(theReader); if (theDataSet.Tables.Count > 0) { DataTable dt = theDataSet.Tables[0]; if (dt.Rows.Count > 0) { string errorDesc = dt.Rows[0]["ERROR_DESC"].ToString(); if (dt.Rows[0]["ERROR_CODE"].ToString() == "0") { string ALLOCATED_MSISDN = theDataSet.Tables[2].Rows[0]["ALLOCATED_MSISDN"].ToString(); SendMail(txtEmailAddress.Text.Trim(), "Lycamobile Sim PortIn", ALLOCATED_MSISDN, txtSIMCARD.Text.Trim(), ""); SPayment sp = new SPayment(); sp.ChargedAmount = Convert.ToDecimal(TariffAmount); sp.PaymentType = 5; sp.PayeeID = 1; sp.PaymentFrom = 8; sp.ActivationType = 7; sp.ActivationStatus = 15; sp.ActivationVia = 17; sp.ActivationResp = resp; sp.ActivationRequest = RequestRes; sp.TariffID = Convert.ToInt32(hddnTariffID.Value); sp.ALLOCATED_MSISDN = ALLOCATED_MSISDN; sp.TransactionId = transact; sp.PaymentId = 0; sp.PaymentMode = "Subscriber PortIn"; sp.TransactionStatus = "Success"; sp.TransactionStatusId = 24; sp.CusName = txtCustomerName.Text.Trim(); sp.Address = txtAddress.Text.Trim(); sp.Mobile = txtAlternateNumber.Text.Trim(); sp.EmailID = txtEmailAddress.Text.Trim(); sp.Regulatery = Regulatery; int dist = 1; int loginID = 1; string sim = txtSIMCARD.Text.Trim(); string zip = txtZIPCode.Text.Trim(); string Language = "ENGLISH"; string ChannelID = ConfigurationManager.AppSettings.Get("TXN_SERIES"); try { int s = svc.InsertSubscriberActivationDetailService(dist, loginID, sim, zip, Language, ChannelID, sp); WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Success when sim PortIn Success In Subscriber Case"); } catch (Exception ex) { WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Fail when sim PortIn Success In Subscriber Case"); } ShowPopUpMsg("Lycamobile PortIN Request submitted successfully\n with Mobile Number - " + ALLOCATED_MSISDN); resetControls(1); } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("PORTIN Request Fail \n Please Try Again"); } } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("PORTIN Request Fail \n Please Try Again"); } } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("PORTIN Request Fail \n Please Try Again"); } } catch (Exception ex) { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("PORTIN Request Fail \n Please Try Again"); //ShowPopUpMsg(ex.Message + "\n" + resp); } } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("PORTIN Request Fail \n Please Try Again"); } }
protected void btnSubscriber_Click(object sender, EventArgs e) { try { GetClientIPAddress(); } catch {} int Regulatery = 0; int distr = 1; // Convert.ToInt32(Session["DistributorID"]); int clnt = 3; //Convert.ToInt32(Session["ClientTypeID"]); string simnumber = txtSIMCARD.Text.Trim(); string transact = ""; string TariffAmount = ""; Boolean ValidSim = false; string erormsg = ""; try { string ss = ""; ss = "Simnumber- " + simnumber + "|" + "Zipcode- " + txtZIPCode.Text + "|" + "Customer name- " + txtCustomerName.Text + "|" + "address- " + txtAddress.Text + "|" + "Alternate Mobile number- " + txtAlternateNumber.Text + "|" + "Email- " + txtEmail.Text; Log2(ss, "Subscriber Activate SIM Information"); Log2("", "split"); DataSet ds = svc.CheckSimActivationService(distr, clnt, simnumber, "Activate"); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { erormsg = Convert.ToString(ds.Tables[0].Rows[0][0]); if (erormsg == "Ready to Activation") { ValidSim = true; int id = Convert.ToInt32(ds.Tables[1].Rows[0]["TRANSACTIONID"]); transact = id.ToString("00000"); transact = ConfigurationManager.AppSettings.Get("TXN_SERIES") + transact; hddnTariffTypeID.Value = Convert.ToString(ds.Tables[0].Rows[0]["TariffTypeID"]); hddnTariffType.Value = Convert.ToString(ds.Tables[0].Rows[0]["TariffType"]); hddnTariffCode.Value = Convert.ToString(ds.Tables[0].Rows[0]["TariffCode"]); hddnTariffAmount.Value = Convert.ToString(ds.Tables[0].Rows[0]["Amount"]); TariffAmount = hddnTariffAmount.Value; hddnTariffID.Value = Convert.ToString(ds.Tables[0].Rows[0]["ID"]); hddnMonths.Value = Convert.ToString(ds.Tables[0].Rows[0]["Months"]); // Add Rerulatry 1 $ from 1 jully 2017 DateTime today = DateTime.Today; // DateTime date = new DateTime(2017, 07, 20); DataSet dsReg = svc.GetRegulatery(); DateTime date = Convert.ToDateTime(dsReg.Tables[0].Rows[0]["StartDate"]); if (date <= today) { double Amt = 0.0; if (hddnMonths.Value == "1") { Regulatery = 1; txtRegulatry.Text = "1"; Amt = Convert.ToDouble(hddnTariffAmount.Value) + 1; } else if (hddnMonths.Value == "2") { Regulatery = 2; txtRegulatry.Text = "2"; Amt = Convert.ToDouble(hddnTariffAmount.Value) + 2; } else if (hddnMonths.Value == "3") { Regulatery = 3; txtRegulatry.Text = "3"; Amt = Convert.ToDouble(hddnTariffAmount.Value) + 3; } TariffAmount = Convert.ToString(Amt);; } else { Regulatery = 0; TariffAmount = hddnTariffAmount.Value; } } else { Log2("Subscriber Activate Sim Not Ready For Activation", "Reason"); Log2(ss, "Request"); Log2(simnumber, "Simnumber"); Log2(TariffAmount, "Amount"); Log2(hddnTariffCode.Value, "PLan"); Log2("", "split"); } } } } catch (Exception ex) { erormsg = ex.Message; ValidSim = false; } //ValidSim = true; if (ValidSim == false) { ShowPopUpMsg(erormsg); return; } string resp = ActivateSim(hddnTariffTypeID.Value, hddnTariffType.Value, hddnTariffCode.Value, txtEmail.Text.Trim(), transact, TariffAmount); //resp = "<ENVELOPE><HEADER><ERROR_CODE>0</ERROR_CODE><ERROR_DESC>Success</ERROR_DESC></HEADER><BODY><ACTIVATE_USIM_PORTIN_BUNDLE_RESPONSE><ALLOCATED_MSISDN>19736871250</ALLOCATED_MSISDN><PORTIN_REFERENCE_NUMBER/></ACTIVATE_USIM_PORTIN_BUNDLE_RESPONSE></BODY></ENVELOPE>"; if (resp.Trim() != null && resp.Trim() != "") { try { StringReader theReader = new StringReader(resp); DataSet theDataSet = new DataSet(); theDataSet.ReadXml(theReader); if (theDataSet.Tables.Count > 0) { DataTable dt = theDataSet.Tables[0]; if (dt.Rows.Count > 0) { string errorDesc = dt.Rows[0]["ERROR_DESC"].ToString(); if (dt.Rows[0]["ERROR_CODE"].ToString() == "0") { string ALLOCATED_MSISDN = theDataSet.Tables[2].Rows[0]["ALLOCATED_MSISDN"].ToString(); SendMail(txtEmail.Text.Trim(), "Lycamobile Sim Activation", ALLOCATED_MSISDN, txtSIMCARD.Text.Trim(), ""); SPayment sp = new SPayment(); sp.ChargedAmount = Convert.ToDecimal(TariffAmount); sp.PaymentType = 4; sp.PayeeID = 1; sp.PaymentFrom = 8; sp.ActivationType = 6; sp.ActivationStatus = 15; sp.ActivationVia = 17; sp.ActivationResp = resp; sp.ActivationRequest = RequestRes; sp.TransactionId = transact; sp.TariffID = Convert.ToInt32(hddnTariffID.Value); sp.ALLOCATED_MSISDN = ALLOCATED_MSISDN; sp.PaymentMode = "Subscriber Activation"; sp.TransactionStatus = "Success"; sp.TransactionStatusId = 24; sp.CusName = txtCustomerName.Text.Trim(); sp.Address = txtAddress.Text.Trim(); sp.Mobile = txtAlternateNumber.Text.Trim(); sp.EmailID = txtEmail.Text.Trim(); sp.Regulatery = Regulatery; int dist = 1; int loginID = 1; string sim = txtSIMCARD.Text.Trim(); string zip = txtZIPCode.Text.Trim(); string Language = "ENGLISH"; string ChannelID = ConfigurationManager.AppSettings.Get("TXN_SERIES"); try { int s = svc.InsertSubscriberActivationDetailService(dist, loginID, sim, zip, Language, ChannelID, sp); WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save Success when sim activated In Subscriber Case"); } catch (Exception ex) { WriteLog(dist, loginID, sim, zip, Language, ChannelID, sp, "Record Save fail when sim activated In Subscriber Case"); } ShowPopUpMsg("SIM activation done successfully\n with Mobile Number - " + ALLOCATED_MSISDN); resetControls(1); } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } } catch (Exception ex) { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("SIM activation Fail \n Please Try Again"); //ShowPopUpMsg(ex.Message + "\n" + resp); } } else { SaveDataSubscriber(resp, 16, transact, TariffAmount); ShowPopUpMsg("SIM activation Fail \n Please Try Again"); } }