Esempio n. 1
0
        public CommonModel GenerateCommonModel()
        {
            try
            {

                CommonModel model = new CommonModel();
                ContactDataService cds = new ContactDataService();

                model.FaceBook = cds.GenerateSocialMediaModelById(1).SocialMediaUrl;
                model.Twitter = cds.GenerateSocialMediaModelById(2).SocialMediaUrl;
                model.Youtube = cds.GenerateSocialMediaModelById(3).SocialMediaUrl;
                model.Instagram = cds.GenerateSocialMediaModelById(4).SocialMediaUrl;
                model.PhoneNumber = cds.GenerateContactNumbersModelById(1).ContactNumber;
                model.Email = cds.GenerateEmailAddressModelById(1).EmailAddress;
                model.ShoppingHours = cds.GenerateShoppingHoursModelById(1).ShoppingHours;

                return model;

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Esempio n. 2
0
        public ActionResult Edit()
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ContactDataService dataService = new ContactDataService();
            ContactViewModel viewModel = new ContactViewModel();
            try
            {
                viewModel.ContactModel = dataService.GenerateContactModel();
                viewModel.AddressModel = dataService.GenerateAddressModel();
                viewModel.ContactNumbersModel1 = dataService.GenerateContactNumbersModelById(1);
                viewModel.ContactNumbersModel2 = dataService.GenerateContactNumbersModelById(2);
                viewModel.ContactNumbersModel3 = dataService.GenerateContactNumbersModelById(3);
                viewModel.ContactNumbersModel4 = dataService.GenerateContactNumbersModelById(4);
                viewModel.ContactNumbersModel5 = dataService.GenerateContactNumbersModelById(5);
                viewModel.EmailAddressModel = dataService.GenerateEmailAddressModelById(1);
                viewModel.ShoppingHoursModel = dataService.GenerateShoppingHoursModelById(1);
                viewModel.ContactAdditionalModel = dataService.GenerateContactAdditionalModelById(1);

                viewModel.SocialMediaModelFacebook = dataService.GenerateSocialMediaModelById(1);
                viewModel.SocialMediaModelTwitter = dataService.GenerateSocialMediaModelById(2);
                viewModel.SocialMediaModelYoutube = dataService.GenerateSocialMediaModelById(3);
                viewModel.SocialMediaModelInstagram = dataService.GenerateSocialMediaModelById(4);
                return View(viewModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dataService = null;
                viewModel = null;
            }
        }
Esempio n. 3
0
        public CommonModel GenerateCommonModel()
        {
            try
            {
                CommonModel        model = new CommonModel();
                ContactDataService cds   = new ContactDataService();

                model.FaceBook      = cds.GenerateSocialMediaModelById(1).SocialMediaUrl;
                model.Twitter       = cds.GenerateSocialMediaModelById(2).SocialMediaUrl;
                model.Youtube       = cds.GenerateSocialMediaModelById(3).SocialMediaUrl;
                model.Instagram     = cds.GenerateSocialMediaModelById(4).SocialMediaUrl;
                model.PhoneNumber   = cds.GenerateContactNumbersModelById(1).ContactNumber;
                model.Email         = cds.GenerateEmailAddressModelById(1).EmailAddress;
                model.ShoppingHours = cds.GenerateShoppingHoursModelById(1).ShoppingHours;

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        public ActionResult EditCompanyAddress()
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ContactDataService dataService = new ContactDataService();
            try
            {
                string addressId = (string)Request.Form["addressId"];
                string addressLine1 = (string)Request.Form["addressLine1"];
                string addressLine2 = (string)Request.Form["addressLine2"];
                string country = (string)Request.Form["country"];
                string postCode = (string)Request.Form["postCode"];

                return RedirectToAction("Edit", "Contact");
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                dataService = null;

            }
        }
Esempio n. 5
0
        public ActionResult Index()
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ContactDataService dataService = new ContactDataService();
            try
            {
                string body = "<p>Email From: {0} ({1})</p><p>Message:</p><p>{2}</p> <br/><p>{3}</p><p>{4}</p>";

                string name = (string)Request.Form["contact_name"];
                string email = (string)Request.Form["contact_email"];
                string company = (string)Request.Form["contact_company"];
                string phone = (string)Request.Form["contact_phone"];
                string subject = (string)Request.Form["contact_subject"];
                string message = (string)Request.Form["contact_message"];
                // Create the email object first, then add the properties.
                SendGridMessage myMessage = new SendGridMessage();
                myMessage.AddTo(dataService.GenerateEmailAddressModelById(1).EmailAddress);
                myMessage.From = new MailAddress(email, name);
                myMessage.Subject = subject;
                myMessage.Html = string.Format(body, name, email, message, company, phone);

                // Create credentials, specifying your user name and password.
                var credentials = new NetworkCredential("*****@*****.**", "Passw0rd123##");

                // Create an Web transport for sending email.
                var transportWeb = new Web(credentials);

                // Send the email, which returns an awaitable task.
                transportWeb.DeliverAsync(myMessage);

                return RedirectToAction("Sent");
            }
            catch (System.Exception ex)
            {

                throw ex;
            }
        }
Esempio n. 6
0
        public ActionResult EditSocial(SocialMediaModel model)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ContactDataService dataService = new ContactDataService();
            try
            {
                string id = (string)Request.Form["id"];

                if (ModelState.IsValid)
                {
                    dataService.UpdateSocialMedia(int.Parse(id), model.SocialMediaUrl);

                    return RedirectToAction("Edit", "Contact");
                }
                else
                {

                    model = new SocialMediaModel();
                    model.SocialMediaId = int.Parse(id);
                    model.SocialMediaUrl = model.SocialMediaUrl;
                    return View(model);
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                dataService = null;

            }
        }
Esempio n. 7
0
        public ActionResult EditSocial(int socialMediaId)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            try
            {
                ContactDataService dataService = new ContactDataService();
                SocialMediaModel model = new SocialMediaModel();

                model = dataService.GenerateSocialMediaModelById(socialMediaId);
                return View(model);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Esempio n. 8
0
        public ActionResult EditShoppingHours()
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ContactDataService dataService = new ContactDataService();
            try
            {
                string description = (string)Request.Form["description"];
                string id = (string)Request.Form["id"];
                dataService.UpdateShoppingHours(int.Parse(id), description);

                return RedirectToAction("Edit", "Contact");
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                dataService = null;

            }
        }
Esempio n. 9
0
        public ActionResult EditContactAdditional(int contactAdditionalId)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ContactDataService dataService = new ContactDataService();
            try
            {
                ContactAdditionalModel model = new ContactAdditionalModel();
                model = dataService.GenerateContactAdditionalModelById(1);
                return View(model);

                //string id = (string)Request.Form["id"];

                //if (ModelState.IsValid)
                //{
                //    dataService.UpdateContactAdditional(int.Parse(id), "", model.ContactAdditionalModel.ContactDescription);

                //    return RedirectToAction("Edit", "Contact");
                //}
                //else
                //{

                //    model = new ContactViewModel();
                //    model.ContactAdditionalModel = new Models.ContactAdditionalModel();
                //    model.ContactAdditionalModel.ContactAdditionalId = int.Parse(id);
                //    model.ContactAdditionalModel.ContactDescription = model.ContactAdditionalModel.ContactDescription;
                //    return View(model.ContactAdditionalModel);
                //}
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                dataService = null;

            }
        }