public override void OnException(HttpActionExecutedContext context) { if (context.Exception is EntityErrorsException) { var e = (EntityErrorsException)context.Exception; var error = new SaveError(e.Message, e.EntityErrors); var resp = new HttpResponseMessage(e.StatusCode) { Content = new ObjectContent(typeof(SaveError), error, JsonFormatter.Create()), }; context.Response = resp; } }
private void VeolStrip_File_Open_Click(object sender, EventArgs e) { if (VeolDialogOpen.ShowDialog() == DialogResult.Cancel) { Form Dialog = new SaveError(); Dialog.ShowDialog(); } else { string Path = VeolDialogOpen.FileName; string Text = System.IO.File.ReadAllText(Path); VeolTextEditor.Text = Text; } }
public override void OnException(HttpActionExecutedContext context) { if (context.Exception is EntityErrorsException) { var formatter = ((JsonFormatter)context.ActionContext.ControllerContext.Configuration.DependencyResolver.GetService(typeof(JsonFormatter))).Create(); var e = (EntityErrorsException)context.Exception; var error = new SaveError(e.Message, e.EntityErrors); var resp = new HttpResponseMessage(e.StatusCode) { Content = new ObjectContent(typeof(SaveError), error, formatter), }; context.Response = resp; } }
public ActionResult Confirmation(AccessModel model) { if (model.UserID < 1) { UserType user = UserCache.GetFromCache(0, ViewBag.IPAddress.StringSafe()); model.UserID = user.UserID; } bool bRet = model.Confirm(); if (bRet) { UserCache.Update(model.UserID, "index", true); return(RedirectToAction("index", "home")); } else if (model.UserToken.Length > 0) { model.ErrorMessage = "Confirmation Code Failed!"; SaveError error = new SaveError(); ErrorType err = new ErrorType { Err_Message = "Confirmation Error", LiteralDesc = model.UserToken, SQL = model.GetToken(model.UserID), Page = "Confirmation", Process = "Confirmation", Err_Subject = "User could not confirm", UserID = model.UserID }; error.ReportError(err); } else { model.ErrorMessage = "Click Resend to receive a new confirmation message"; } return(View(model)); }
public void OnSaveError(object sender, ExcelSaveErrorEventArgs e) { SaveError?.Invoke(sender, e); }
private void onSaveError(string message) { SaveError?.Invoke(message); }
public ActionResult PaymentWithPaypal(string guid, string paymentId, string token, string PayerID) { //getting the apiContext APIContext apiContext = PaypalConfiguration.GetAPIContext(); try { //A resource representing a Payer that funds a payment Payment Method as paypal //Payer Id will be returned when payment proceeds or click to pay string payerId = PayerID.StringSafe(); if (string.IsNullOrEmpty(payerId)) { //this section will be executed first because PayerID doesn't exist //it is returned by the create function call of the payment class // Creating a payment // baseURL is the url on which paypal sendsback the data. string baseURI = Request.Url.Scheme + "://" + Request.Url.Authority + "/Home/PaymentWithPayPal?"; //here we are generating guid for storing the paymentID received in session //which will be used in the payment execution var _guid = Convert.ToString((new Random()).Next(100000)); //CreatePayment function gives us the payment approval url //on which payer is redirected for paypal account payment var createdPayment = this.CreatePayment(apiContext, baseURI + "guid=" + _guid); //get links returned from paypal in response to Create function call var links = createdPayment.links.GetEnumerator(); string paypalRedirectUrl = null; while (links.MoveNext()) { Links lnk = links.Current; if (lnk.rel.ToLower().Trim().Equals("approval_url")) { //saving the payapalredirect URL to which user will be redirected for payment paypalRedirectUrl = lnk.href; } } // saving the paymentID in the key guid Session.Add(guid, createdPayment.id); return(Redirect(paypalRedirectUrl)); } else { // This function exectues after receving all parameters for the payment var executedPayment = ExecutePayment(apiContext, PayerID, paymentId); //If executed payment failed then we will show payment failure message to user if (executedPayment.state.ToLower() != "approved") { return(View("FailureView")); } } } catch (Exception ex) { SaveError error = new SaveError(); UserType user = UserCache.GetFromCache(0, ViewBag.IPAddress.StringSafe()); ErrorType err = new ErrorType { Err_Message = ex.Message, Err_Subject = "Attempt to charge to pay pal failed", LiteralDesc = ex.StackTrace, Page = "PaymentWithPayPal", Process = "PaymentWithPaypal", UserID = user.UserID, SQL = "", Time_Of_Error = DateTime.Now }; error.ReportError(err); return(View("FailureView")); } //on successful payment, show success page to user. return(View("SuccessView")); }