//
        // GET: /CrmInterfacing/
        public ActionResult CRM_Customer_Booking(
            string customer_code,
            string tel,
            string contact,
            string email,
            string remark,
            string bookings
            )
        {
            if (!string.IsNullOrWhiteSpace(customer_code))
            {
                db _db = new db();
                var customer = (from c in _db.recsys_customers
                                where c.status == 1 && c.customer_code.Contains(customer_code)
                                select c).FirstOrDefault();
                if (customer != null)
                {
                    recsys_relate_customers customer_data = new recsys_relate_customers()
                    {
                        customer_id = customer.id,
                        name = customer.name,
                        customer_code = customer.customer_code,
                        prefix = customer.prefix,
                        code = customer.code,
                        manual_input_code = customer.manual_input_code,
                        contact = contact,
                        relate_type = (int)CustomerDataRelateType.Enquery,
                        tel2 = tel,
                        email = email
                    };

                    _db.recsys_relate_customers.AddObject(customer_data);

                    _db.SaveChanges();

                    _db.Refresh(System.Data.Objects.RefreshMode.StoreWins, customer_data);

                    if (customer_data.id != 0)
                    {
                        recsys_enquery enquery = new recsys_enquery()
                        {
                            create_date = DateTime.Now,
                            customer_id = customer_data.id,
                            last_update = DateTime.Now,
                            remark = remark,
                            sBookingInformation = bookings,
                            status = (int) RecordStatus.Active
                        };

                        _db.recsys_enquery.AddObject(enquery);

                        _db.SaveChanges();

                        return Content("true");
                    }
                }
            }
            return Content("false");
        }
        public ActionResult CRM_Customer_Enquery(
            string tel,
            string contact,
            string email,
            string remark,
            string address,
            string company_name
            )
        {
            db _db = new db();
            recsys_relate_customers customer_data = new recsys_relate_customers()
            {
                customer_id = -1,
                contact = contact,
                relate_type = (int)CustomerDataRelateType.Enquery,
                tel2 = tel,
                email = email,
                address2 = address
            };

            _db.recsys_relate_customers.AddObject(customer_data);

            _db.SaveChanges();

            _db.Refresh(System.Data.Objects.RefreshMode.StoreWins, customer_data);

            if (customer_data.id != 0)
            {
                recsys_enquery enquery = new recsys_enquery()
                {
                    create_date = DateTime.Now,
                    customer_id = customer_data.id,
                    last_update = DateTime.Now,
                    remark = (string.IsNullOrEmpty(company_name) ? string.Empty : "[公司名稱] " + company_name + "\r\n") + remark,
                    status = (int)RecordStatus.Active
                };

                _db.recsys_enquery.AddObject(enquery);

                _db.SaveChanges();

                return Content("true");
            }
            return Content("false");
        }