public ActionResult DeleteProducts(int productId) { 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; ProductsDataService dataService = new ProductsDataService(); try { dataService.DeleteProducts(productId); return RedirectToAction("Edit", "Products"); } catch (Exception ex) { throw ex; } finally { dataService = null; } }
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; PromoDataService dataService = new PromoDataService(); PromoViewModel viewModel = new PromoViewModel(); try { viewModel.PromoModel = dataService.GeneratePromoModel(); return View(viewModel); } catch (Exception ex) { throw ex; } finally { dataService = null; viewModel = null; } }
public ActionResult EditService(int id) { 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; ServicesModel model = new ServicesModel(); ServicesDataService dataservice = new ServicesDataService(); try { model = dataservice.GetServicesModelByServiceId(id); return View(model); } catch (Exception ex) { throw ex; } finally { model = null; dataservice = null; } }
public ActionResult Add() { 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; return View(); }
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; } }
public ActionResult Add(ProductsListModel plm) { 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; ProductsDataService dataService = new ProductsDataService(); try { if (ModelState.IsValid) { dataService.InsertProductList(plm); return RedirectToAction("Edit", "Products"); } else { return View(plm); } } catch (Exception ex) { throw ex; } finally { dataService = null; } }
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; } }
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; ServicesViewModel viewModel = new ServicesViewModel(); ServicesDataService dataservice = new ServicesDataService(); try { int[] row1 = new int[] { 1, 2, 3 }; int[] row2 = new int[] { 6, 4, 5 }; viewModel.ServicesModelRow1 = dataservice.GenerateServiceModelByServicesIds(row1); viewModel.ServicesModelRow2 = dataservice.GenerateServiceModelByServicesIds(row2); return View(viewModel); } catch (Exception ex) { throw ex; } finally { viewModel = null; dataservice = null; } }
public ActionResult EditService(ServicesModel 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; ServicesDataService dataservice = new ServicesDataService(); string serviceId = (string)Request.Form["edit_ServicesId"]; string imageString = (string)Request.Form["edit_ImageString"]; string serviceName = (string)Request.Form["edit_ServiceName"]; try { if (ModelState.IsValid) { WebImage photo = null; var newFileName = ""; var imagePath = ""; photo = WebImage.GetImageFromRequest(); if (photo != null) { newFileName = Guid.NewGuid().ToString() + "_" + Path.GetFileName(photo.FileName); imagePath = @"Contents\Images\Services\" + newFileName; photo.Save(@"~\" + imagePath); model.ServicesId = int.Parse(serviceId); model.ImageString = imagePath; } else { model.ServicesId = int.Parse(serviceId); model.ImageString = imageString; } dataservice.UpdateService(model); return RedirectToAction("Edit", "Services"); } else { model.ServicesId = int.Parse(serviceId); model.ImageString = imageString; return View(model); } } catch (Exception ex) { throw ex; } finally { model = null; dataservice = null; } }
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; } }
public void GetPhotoThumbnail(string imageString) { 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; // Loading a default photo for realties that don't have a Photo new WebImage(HostingEnvironment.MapPath(@"~/" + imageString)).Write(); }
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; } }
// GET: Products 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; ProductsPageViewMainModel ppvMM = new ProductsPageViewMainModel(); ProductsDataService pDS = new ProductsDataService(); try { ppvMM.ProductsMainModel = pDS.GenerateProductsMainModel(); ppvMM.ProductsListModel = pDS.GenerateProductsListModel(); return View(ppvMM); } catch (Exception ex) { throw ex; } finally { ppvMM = null; pDS = null; } }
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; } }
public ActionResult EditProductsMain(ProductsMainModel aum) { 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; ProductsDataService auDS = new ProductsDataService(); string id = (string)Request.Form["edit_ProductsMainId"]; try { if (ModelState.IsValid) { aum.ProductsMainId = int.Parse(id); auDS.UpdateProductsMain(aum); return RedirectToAction("Edit", "Products"); } else { aum = new ProductsMainModel(); aum.ProductsMainId = int.Parse(id); return View(aum); } } catch (Exception ex) { throw ex; } finally { auDS = null; } }
// GET: Gallery 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; GalleryDataService dataService = new GalleryDataService(); GalleryViewModel viewModel = new GalleryViewModel(); try { viewModel.GalleryModelRow1 = dataService.GenerateGalleryByRow(1); viewModel.GalleryModelRow2 = dataService.GenerateGalleryByRow(2); viewModel.GalleryModelRow3 = dataService.GenerateGalleryByRow(3); viewModel.GalleryModelRow4 = dataService.GenerateGalleryByRow(4); viewModel.GalleryModelRow5 = dataService.GenerateGalleryByRow(5); viewModel.GalleryModelRow6 = dataService.GenerateGalleryByRow(6); viewModel.GalleryModelRow7 = dataService.GenerateGalleryByRow(7); viewModel.GalleryModelRow8 = dataService.GenerateGalleryByRow(8); viewModel.GalleryModelRow9 = dataService.GenerateGalleryByRow(9); viewModel.GalleryModelRow10 = dataService.GenerateGalleryByRow(10); viewModel.GalleryModelRow11 = dataService.GenerateGalleryByRow(11); viewModel.GalleryModelRow12 = dataService.GenerateGalleryByRow(12); viewModel.GalleryModelRow13 = dataService.GenerateGalleryByRow(13); viewModel.GalleryModelRow14 = dataService.GenerateGalleryByRow(14); viewModel.GalleryModelRow15 = dataService.GenerateGalleryByRow(15); viewModel.GalleryModelRow16 = dataService.GenerateGalleryByRow(16); viewModel.GalleryModelRow17 = dataService.GenerateGalleryByRow(17); viewModel.GalleryModelRow18 = dataService.GenerateGalleryByRow(18); viewModel.GalleryModelRow19 = dataService.GenerateGalleryByRow(19); viewModel.GalleryModelRow20 = dataService.GenerateGalleryByRow(20); viewModel.GalleryModelRow21 = dataService.GenerateGalleryByRow(21); viewModel.GalleryModelRow22 = dataService.GenerateGalleryByRow(22); viewModel.GalleryModelRow23 = dataService.GenerateGalleryByRow(23); viewModel.GalleryModelRow24 = dataService.GenerateGalleryByRow(24); viewModel.GalleryModelRow25 = dataService.GenerateGalleryByRow(25); viewModel.GalleryModelRow26 = dataService.GenerateGalleryByRow(26); viewModel.GalleryModelRow27 = dataService.GenerateGalleryByRow(27); viewModel.GalleryModelRow28 = dataService.GenerateGalleryByRow(28); viewModel.GalleryModelRow29 = dataService.GenerateGalleryByRow(29); viewModel.GalleryModelRow30 = dataService.GenerateGalleryByRow(30); return View(viewModel); } catch (Exception ex) { throw ex; } }
public ActionResult AddHeader(string tableHeader, int productCategoryId) { 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; PriceDataService dataService = new PriceDataService(); ProductHeaderModel model = new ProductHeaderModel(); try { model.ProductCategoryId = productCategoryId; model.ProductTableTitleDescription = tableHeader; dataService.InsertProductHeader(model); return RedirectToAction("Edit", "Price"); } catch (Exception ex) { throw ex; } finally { dataService = null; } }
public ActionResult EditPrice(PriceListModel plm) { 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; PriceDataService dataService = new PriceDataService(); PriceListModel model = new PriceListModel(); try { if (ModelState.IsValid) { model.PriceListId = plm.PriceListId; model.ProductName = plm.ProductName; model.ProductDescription = plm.ProductDescription; model.Price = plm.Price; dataService.UpdatePriceList(model); return RedirectToAction("Edit", "Price"); } else { return View(plm); } } catch (Exception ex) { throw ex; } finally { dataService = null; } }
public ActionResult EditHeader(int headerId) { 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; PriceDataService dataService = new PriceDataService(); ProductHeaderModel model = new ProductHeaderModel(); try { model = dataService.GetProductHeaderByHeaderId(headerId); return View(model); } catch (Exception ex) { throw ex; } finally { dataService = null; } }
public ActionResult EditProductsMainImage() { 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; ProductsDataService auDS = new ProductsDataService(); try { WebImage photo = null; var newFileName = ""; var imagePath = ""; string id = (string)Request.Form["edit_ProductsMainId"]; photo = WebImage.GetImageFromRequest(); if (photo != null) { newFileName = Guid.NewGuid().ToString() + "_" + Path.GetFileName(photo.FileName); imagePath = @"Contents\Images\Products\" + newFileName; photo.Save(@"~\" + imagePath); auDS.UpdateProductsMainImage(int.Parse(id), imagePath); } return RedirectToAction("Edit", "Products"); } catch (Exception ex) { throw ex; } finally { auDS = null; } }
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; } }
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; } }