Example #1
0
        public HttpResponseMessage GetCheckShipmentsByMembership(int customerId)
        {
            try {
                BOShipments shipment = new BOShipments();

                string result = shipment.checkShipmentsByMembership(customerId);


                Result json = JsonConvert.DeserializeObject <Result>(result);
                if (json.sendMail == "Yes")
                {
                    BOContacts contact      = new BOContacts();
                    var        listContacts = new List <customer_contacts>();
                    listContacts = contact.GetContact(customerId);
                    //List<Order> SortedList = objListOrder.OrderBy(o=>o.OrderDate).ToList();
                    var emailhandler = new TransShip.EMailHandler.EMailHandler();

                    emailhandler.SendMembershipEmail(json.message, listContacts[0].email);
                }
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            } catch (Exception e) {
                ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to get shipments - " + e.GetBaseException().Message, e.ToString());
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje));
            }
        }
Example #2
0
        public HttpResponseMessage Put(customer_contacts model)
        {
            try {
                BOContacts        contact = new BOContacts();
                customer_contacts cont;

                cont = contact.UpdateContact(model);
                return(Request.CreateResponse(HttpStatusCode.OK, cont));
            } catch (Exception e) {
                ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to update contacts - " + e.GetBaseException().Message, e.ToString());
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje));
            }
        }
Example #3
0
        public HttpResponseMessage Delete(int idContact)
        {
            try {
                BOContacts contact = new BOContacts();

                var delete = contact.DeleteContact(idContact);

                return(Request.CreateResponse(HttpStatusCode.OK, delete));
            } catch (Exception e) {
                ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to update contact - " + e.GetBaseException().Message, e.ToString());
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje));
            }
        }
Example #4
0
        public HttpResponseMessage Get(int idCustomer)
        {
            try {
                BOContacts contact = new BOContacts();

                var listContacts = new List <customer_contacts>();
                listContacts = contact.GetContact(idCustomer);
                return(Request.CreateResponse(HttpStatusCode.OK, listContacts));
            } catch (Exception e) {
                ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to get contacts - " + e.GetBaseException().Message, e.ToString());
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje));
            }
        }