public ActionResult Add(string textPhone, string category, string headerId) { if (!string.IsNullOrEmpty(textPhone)) { if (textPhone.StartsWith("0")) { textPhone = "234" + textPhone.TrimStart('0'); } var msisdn = new MSISDN(); msisdn = (MSISDN)Session["XMSISDN"]; //if (msisdn == null) // msisdn = FillMSISDN(); //13/02/2017 if ((MSISDN)Session["XMSISDN"] != null) { msisdn = (MSISDN)Session["XMSISDN"]; } else { msisdn = FillMSISDN(); } var ipthis = msisdn.Lines.FirstOrDefault().IpAddress; msisdn.Clear(); msisdn.AddItem(textPhone, ipthis, false); var newmsisdn = (MSISDN)Session["XMSISDN"]; HttpContext.Session["XMSISDN"] = msisdn; try { if (msisdn != null && msisdn.Lines.Count() > 0 && msisdn.Lines.FirstOrDefault().Phone != "XXX-XXXXXXXX") { repository.Subscribe(Convert.ToInt32(headerId), msisdn.Lines.FirstOrDefault().IpAddress, msisdn.Lines.FirstOrDefault().Phone, msisdn.Lines.FirstOrDefault().IsHeader); } //to return manual numbers here else { return(Redirect(Url.Action("Fill", new { category = category, headerId = headerId }))); } var newmsisdn1 = (MSISDN)Session["XMSISDN"]; } catch (Exception ex) { AppUtil.LogFileWrite(ex.ToString()); } if (string.IsNullOrEmpty(category)) { category = "Home"; } return(Redirect(Url.Action("Index", new { controller = category, action = "Index" }))); } return(Redirect(Request.Url.PathAndQuery)); }
public ActionResult Pay(MSISDN msisdn, string category, string headerId) { //msisdn = (MSISDN)Session["XMSISDN"]; if ((MSISDN)Session["XMSISDN"] != null) { msisdn = (MSISDN)Session["XMSISDN"]; } else { msisdn = FillMSISDN(); } try { //msisdn.Lines.FirstOrDefault().IsHeader) if (msisdn != null && msisdn.Lines.Count() > 0 && msisdn.Lines.FirstOrDefault().Phone != "XXX-XXXXXXXX") { repository.Subscribe(Convert.ToInt32(headerId), msisdn.Lines.FirstOrDefault().IpAddress, msisdn.Lines.FirstOrDefault().Phone, msisdn.Lines.FirstOrDefault().IsHeader); } else { return(Redirect(Url.Action("Fill", new { category = category, headerId = headerId }))); } //if (msisdn == null || msisdn.Lines.Count() < 1 || msisdn.Lines.FirstOrDefault().Phone == "XXX-XXXXXXXX") //{ // return Redirect(Url.Action("Fill", new { category = category, headerId = headerId })); //} //else //{ // repository.Subscribe(Convert.ToInt32(headerId), msisdn.Lines.FirstOrDefault().IpAddress, msisdn.Lines.FirstOrDefault().Phone, msisdn.Lines.FirstOrDefault().IsHeader); //} } catch (Exception ex) { AppUtil.LogFileWrite(ex.ToString()); } if (string.IsNullOrEmpty(category)) { category = "Home"; } return(Redirect(Url.Action("Index", new { controller = category, action = "Index" }))); }
private void m_NewRequest(IAsyncResult result) { Exception exception; try { HttpListener asyncState = (HttpListener)result.AsyncState; HttpListenerContext httpListenerContext = this.m_httpListener.EndGetContext(result); this.m_nlog.Info("New HTTP Message from {0} type {1}", httpListenerContext.Request.RemoteEndPoint, base.GetType()); try { try { this.m_nlog.Info("HTTP GET IN: {0}", httpListenerContext.Request.RawUrl); this.m_httpListener.BeginGetContext(new AsyncCallback(this.m_NewRequest), this.m_httpListener); DateTime utcNow = DateTime.UtcNow; string item = httpListenerContext.Request.QueryString["message"]; string str = string.Concat("+", httpListenerContext.Request.QueryString["sender"]); SmsMessage smsMessage = new SmsMessage(item, MSISDN.Parse(str), utcNow); this.OnMessageReceived(smsMessage); } catch (Exception exception1) { exception = exception1; this.m_nlog.Error("Could not process: {0}", httpListenerContext.Request.Url.Query); this.m_nlog.ErrorException(exception.GetType().ToString(), exception); httpListenerContext.Response.StatusCode = 500; } } finally { httpListenerContext.Response.Close(); } } catch (Exception exception2) { exception = exception2; if (base.IsStarted) { this.m_nlog.ErrorException(exception.GetType().ToString(), exception); } } }
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { MSISDN xmsisdn = null; if (controllerContext.HttpContext.Session != null) { xmsisdn = (MSISDN)controllerContext.HttpContext.Session[sessionKey]; } if (xmsisdn == null || (xmsisdn.Lines.Count() > 0 && xmsisdn.Lines.FirstOrDefault().IsHeader == false)) { xmsisdn = FillMSISDN(); if (controllerContext.HttpContext.Session != null) { controllerContext.HttpContext.Session[sessionKey] = xmsisdn; } } return(xmsisdn); }
MSISDN FillMSISDN() { //HTTPService.HeaderIndexSoapClient d = new HTTPService.HeaderIndexSoapClient(); MSISDN msisdntory = new MSISDN(); msisdntory.Clear(); AppUtil app = new AppUtil(); string msisdn = app.MSISDN_HEADER(); if (msisdn == "XXX-XXXXXXXX") { msisdntory.AddItem(msisdn, AppUtil.GetIPAddress(), false); } else { msisdntory.AddItem(msisdn, AppUtil.GetIPAddress()); } return(msisdntory); }
public override string ToString() { return("MSISDN: " + MSISDN.ToString() + ", Network prefix: " + NetworkPrefix.ToString() + ", " + Network.ToString() + "," + Country.ToString()); }
/// <summary> /// Create incoming SMS connection for GLP. /// </summary> /// <param name="numPhone"></param> public GLPSmsConnection(MSISDN numPhone) : base(numPhone) { }
public bool Equals(MSISDN other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Id, Id); }