Пример #1
0
        public IHttpActionResult ERPNotify(ERPModel ERPEvent)
        {
            if (!ModelState.IsValid || ERPEvent == null)
            {
                return(Content(HttpStatusCode.BadRequest, new { error = "Invalid Input Data" }));
            }
            RTMessageNotification rtMessage = new RTMessageNotification();

            try
            {
                string messageString = new JavaScriptSerializer().Serialize(ERPEvent);
                rtMessage.InformReceivedMessage(messageString);
                rtMessage.InformSendERPResult("Completed", ERPEvent);
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.InternalServerError, ex));
            }
            return(Json(new { result = "OK" }));
        }
Пример #2
0
        public IHttpActionResult PostSMS(SMSModel sms)
        {
            if (!ModelState.IsValid || sms == null)
            {
                return(Content(HttpStatusCode.BadRequest, new { error = "Invalid Input Data" }));
            }
            RTMessageNotification rtMessage = new RTMessageNotification();

            try
            {
                string messageString = new JavaScriptSerializer().Serialize(sms);
                rtMessage.InformReceivedMessage(messageString);
                sms.Send();
                rtMessage.InformSendSMSResult("Completed", sms);
            }
            catch (Exception ex)
            {
                rtMessage.InformSendSMSResult("Fail", sms);
                return(Content(HttpStatusCode.InternalServerError, ex.Message));
            }
            return(Json(new { result = "OK" }));
        }
Пример #3
0
        public async Task <IHttpActionResult> PostEmail(EmailModel email)
        {
            if (!ModelState.IsValid || email == null)
            {
                return(Content(HttpStatusCode.BadRequest, new { error = "Invalid Input Data" }));
            }
            RTMessageNotification rtMessage = new RTMessageNotification();

            try
            {
                string messageString = new JavaScriptSerializer().Serialize(email);
                rtMessage.InformReceivedMessage(messageString);
                await email.Send();

                rtMessage.InformSendEmailResult("Completed", email);
            }
            catch (Exception ex)
            {
                rtMessage.InformSendEmailResult("Fail", email);
                return(Content(HttpStatusCode.InternalServerError, ex));
            }
            return(Json(new { result = "OK" }));
        }