예제 #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));
            }
        }
예제 #2
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));
            }
        }