public ActionResult AddToCart(string movieName, string sDate, string sHour, string hall, string numOfRow, string numOfSeat) { var cartDb = new CinemaDal(); Cart addTtoCart = new Cart(); var isInCart = (from x in cartDb.cart where x.sDate.ToString().Contains(sDate) && x.sHour.ToString().Equals(sHour) && x.hall.ToString().Equals(hall) && x.numOfRow.ToString().Equals(numOfRow) && x.numOfSeat.ToString().Equals(numOfSeat) select x).ToList <Cart>(); if (isInCart.Where(y => y.sDate == sDate && y.sHour == sHour && y.numOfRow == numOfRow && y.numOfSeat == numOfSeat).Any()) { string text = "This seat is already in your cart, please try another one"; MessageBox.Show(text); } else { Screenings s = (from x in cartDb.screenings where x.sDate.ToString().Contains(sDate) && x.sHour.ToString().Equals(sHour) && x.hall.ToString().Equals(hall) select x).ToList <Screenings>()[0]; Movies m = (from tmp in cartDb.movies where s.movieName.Equals(tmp.movieName) select tmp).ToList <Movies>()[0]; //var t = (from x in cartDb.tickets where x.sDate.ToString().Contains(sDate) && x.sHour.ToString().Equals(sHour) && x.hall.ToString().Equals(hall) select x).ToList<Tickets>(); addTtoCart.hall = hall; addTtoCart.sDate = sDate; addTtoCart.sHour = sHour; addTtoCart.numOfRow = numOfRow; addTtoCart.numOfSeat = numOfSeat; addTtoCart.movieName = s.movieName; addTtoCart.price = m.currentPrice; cartDb.cart.Add(addTtoCart); cartDb.SaveChanges(); string text = "Your ticket has been successfully added to the cart"; MessageBox.Show(text); } return(Buy(movieName, sDate, sHour, hall)); }
public ActionResult UpdateScreening(Screenings s) { BL_AddScreening b = new BL_AddScreening(); int result = b.Screening(Session["patient"].ToString(), s.immunization, s.SDate, s.Year, s.Text); return(View()); }
public ActionResult EditHalls1(string sDate, string sHour, string hall) { string newHall = Request.Form["EditHalls"]; //string newHall = int.Parse(price_string); var moviesMandageObj = new CinemaDal(); Screenings s = (from x in moviesMandageObj.screenings where x.sDate.ToString().Equals(sDate.ToString()) && x.sHour.ToString().Equals(sHour.ToString()) && x.hall.ToString().Equals(hall.ToString()) select x).ToList <Screenings>()[0]; var screeen = (from x in moviesMandageObj.screenings where x.sDate.ToString().Equals(sDate.ToString()) && x.sHour.ToString().Equals(sHour.ToString()) select x).ToList <Screenings>(); Screenings newS = new Screenings(); if (screeen.Where(y => y.sDate == sDate && y.sHour == sHour && y.hall == newHall).Any()) { string text = "There is another screening at the same date and hour in this hall, try to change to another hall"; MessageBox.Show(text); } else if (!(moviesMandageObj.hall.Where(y => y.hall == newHall).Any())) { string text = "You are trying to change this screening to hall that does not exist in the cinema"; MessageBox.Show(text); } else { newS.movieName = s.movieName; newS.sDate = s.sDate; newS.sHour = s.sHour; newS.hall = newHall; moviesMandageObj.screenings.Remove(s); moviesMandageObj.SaveChanges(); moviesMandageObj.screenings.Add(newS); moviesMandageObj.SaveChanges(); } return(EditHalls()); }
private async void SaveScreeningCreate() { try { if (!CreateableScreening.IsValid()) { OnMessageApplication("Minden mezőt ki kell tölteni."); return; } var newScreening = new ScreeningViewModel(); newScreening.CopyFrom(CreateableScreening); var screeningDto = (ScreeningDto)newScreening; await _service.CreateScreeningAsync(screeningDto); newScreening.Id = screeningDto.Id; Screenings.Add(newScreening); SelectedScreening = newScreening; } catch (Exception ex) when(ex is NetworkException || ex is HttpRequestException) { OnMessageApplication($"Unexpected error occured! ({ex.Message})"); } catch (Exception) { OnMessageApplication("A megadott időpontban nem lehet új előadást a megadott teremben létrhozni!"); return; } FinishingScreeningCreate?.Invoke(this, EventArgs.Empty); }
public IHttpActionResult PutScreenings(int id, Screenings screenings) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != screenings.ScreeningId) { return(BadRequest()); } db.Entry(screenings).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ScreeningsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { Screenings screenings = db.Screenings.Find(id); db.Screenings.Remove(screenings); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult AddImmusations(Screenings s) { //check UserName and UserPassword, if right, go to Home page. BL_AddImmunization b = new BL_AddImmunization(); int result = b.Add_Immunization(Session["patient"].ToString(), s.immunization, s.SDate, s.Year, s.Text); return(View()); }
public ActionResult Edit([Bind(Include = "ScreeningId,ScreeningStart,FkMovieId,FkTheaterId")] Screenings screenings) { if (ModelState.IsValid) { db.Entry(screenings).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(screenings)); }
public static DalScreening ToDalScreening(this Screenings screening) { return(new DalScreening { ID = screening.ScreeningID, BookID = screening.BookID, Link = screening.Link, Name = screening.Film_Name, Year = screening.Year }); }
public IHttpActionResult GetScreenings(int id) { Screenings screenings = db.Screenings.Find(id); if (screenings == null) { return(NotFound()); } return(Ok(screenings)); }
public ActionResult Create([Bind(Include = "ScreeningId,ScreeningStart,FkMovieId,FkTheaterId")] Screenings screenings) { if (ModelState.IsValid) { db.Screenings.Add(screenings); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(screenings)); }
public IHttpActionResult PostScreenings(Screenings screenings) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Screenings.Add(screenings); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = screenings.ScreeningId }, screenings)); }
public ActionResult addScreening(Screenings s) { BL_AddScreening b = new BL_AddScreening(); try { int result = b.Screening(Session["patient"].ToString(), s.Screening, s.SDate, s.Year, s.Text); } catch (Exception e) { } return(View()); }
//Delete private async void DeleteScreening(ScreeningViewModel screening) { try { await _service.DeleteScreeningAsync(screening.Id); Screenings.Remove(SelectedScreening); SelectedScreening = null; } catch (Exception ex) when(ex is NetworkException || ex is HttpRequestException) { OnMessageApplication($"Unexpected error occured! ({ex.Message})"); } }
public IHttpActionResult DeleteScreenings(int id) { Screenings screenings = db.Screenings.Find(id); if (screenings == null) { return(NotFound()); } db.Screenings.Remove(screenings); db.SaveChanges(); return(Ok(screenings)); }
// GET: Screenings/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Screenings screenings = db.Screenings.Find(id); if (screenings == null) { return(HttpNotFound()); } return(View(screenings)); }
public ActionResult Delete(string movieName) { var moviesManageObj = new CinemaDal(); Movies m = (from x in moviesManageObj.movies where x.movieName.ToString().Contains(movieName.ToString()) select x).ToList <Movies>()[0]; moviesManageObj.movies.Remove(m); moviesManageObj.SaveChanges(); foreach (var item in moviesManageObj.screenings.ToList <Screenings>()) { if (item.movieName == movieName) { Screenings s = (from x in moviesManageObj.screenings where x.movieName.ToString().Contains(movieName.ToString()) select x).ToList <Screenings>()[0]; moviesManageObj.screenings.Remove(s); moviesManageObj.SaveChanges(); } } return(RedirectToAction("Movies")); }
public ActionResult ViewScreenings(string movieName, string filterValue = "def") { var moviesViewScreeningsObj = new CinemaDal(); var screeningsList = new List <Screenings>(); int i = 0; //var galleryList = moviesViewScreeningsObj.screenings.ToList(); foreach (var item in moviesViewScreeningsObj.screenings.ToList <Screenings>()) { if (item.movieName == movieName) { Screenings s = (from x in moviesViewScreeningsObj.screenings where x.movieName.ToString().Equals(movieName.ToString()) select x).ToList <Screenings>()[i]; string[] dateSplit = s.sDate.Split('-'); DateTime now = new DateTime(Int32.Parse(dateSplit[0]), Int32.Parse(dateSplit[1]), Int32.Parse(dateSplit[2])); if (now > DateTime.Now) { screeningsList.Add(s); } i++; } } if (filterValue == "lastDate") { if (screeningsList.Count > 1) { var tempScreenList = new List <Screenings>(); Screenings maxScreening = new Screenings(); Screenings minScreening = new Screenings(); maxScreening = screeningsList[0]; string[] maxSplit = maxScreening.sDate.Split('-'); string[] minSplit; string[] maxSplitHour = maxScreening.sHour.Split(':'); string[] minSplitHour; for (i = 1; i < screeningsList.Count; i++) { minScreening = screeningsList[i]; minSplit = minScreening.sDate.Split('-'); if (Int32.Parse(minSplit[0]) > Int32.Parse(maxSplit[0])) { maxScreening = minScreening; maxSplit = maxScreening.sDate.Split('-'); } else if ((Int32.Parse(minSplit[0]) == Int32.Parse(maxSplit[0])) && (Int32.Parse(minSplit[1]) > Int32.Parse(maxSplit[1]))) { maxScreening = minScreening; maxSplit = maxScreening.sDate.Split('-'); } else if ((Int32.Parse(minSplit[0]) == Int32.Parse(maxSplit[0])) && (Int32.Parse(minSplit[1]) == Int32.Parse(maxSplit[1])) && (Int32.Parse(minSplit[2]) > Int32.Parse(maxSplit[2]))) { maxScreening = minScreening; maxSplit = maxScreening.sDate.Split('-'); } else if ((Int32.Parse(minSplit[2]) == Int32.Parse(maxSplit[2])) && (Int32.Parse(minSplit[1]) == Int32.Parse(maxSplit[1])) && (Int32.Parse(minSplit[0]) == Int32.Parse(maxSplit[0]))) { minSplitHour = minScreening.sHour.Split(':'); if (Int32.Parse(minSplitHour[0]) > Int32.Parse(maxSplitHour[0])) { maxScreening = minScreening; maxSplitHour = maxScreening.sHour.Split(':'); maxSplit = maxScreening.sDate.Split('-'); } else if ((Int32.Parse(minSplitHour[0]) == Int32.Parse(maxSplitHour[0])) && Int32.Parse(minSplitHour[1]) > Int32.Parse(maxSplitHour[1])) { maxScreening = minScreening; maxSplitHour = maxScreening.sHour.Split(':'); maxSplit = maxScreening.sDate.Split('-'); } } } tempScreenList.Add(maxScreening); return(View(tempScreenList)); } } return(View(screeningsList)); }
public override void Execute(Action onSuccess, Action <Exception> onFailure) { try { StorageCredentials storageCredentials = new StorageCredentials(System.Environment.GetEnvironmentVariable("StorageAccountName", EnvironmentVariableTarget.Process), System.Environment.GetEnvironmentVariable("StorageKeyVault", EnvironmentVariableTarget.Process)); CloudStorageAccount account = new CloudStorageAccount(storageCredentials, useHttps: true); CloudBlobClient storageClient = account.CreateCloudBlobClient(); CloudBlobContainer storageSupportContainer = storageClient.GetContainerReference("support"); CloudBlockBlob blob = storageSupportContainer.GetBlockBlobReference("Aspose.Total.lic"); blob.FetchAttributes(); long fileByteLength = blob.Properties.Length; Byte[] b = new Byte[fileByteLength]; blob.DownloadToByteArray(b, 0); SharedFilesConfiguration.Current.AsposeLicense = b; blob = storageSupportContainer.GetBlockBlobReference("ETA_Form_9061_English_FINAL_11_(expires_January_31,2020).pdf"); blob.FetchAttributes(); fileByteLength = blob.Properties.Length; b = new Byte[fileByteLength]; blob.DownloadToByteArray(b, 0); SharedFilesConfiguration.Current.Form9061 = b; blob = storageSupportContainer.GetBlockBlobReference("8850-page2.docx"); blob.FetchAttributes(); fileByteLength = blob.Properties.Length; b = new Byte[fileByteLength]; blob.DownloadToByteArray(b, 0); SharedFilesConfiguration.Current.Form8850Page2 = b; blob = storageSupportContainer.GetBlockBlobReference("WOTCCover.docx"); blob.FetchAttributes(); fileByteLength = blob.Properties.Length; b = new Byte[fileByteLength]; blob.DownloadToByteArray(b, 0); SharedFilesConfiguration.Current.CoverLetter = b; Aspose.Words.License wordsLicense = new Aspose.Words.License(); wordsLicense.SetLicense(new MemoryStream(SharedFilesConfiguration.Current.AsposeLicense)); Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License(); pdfLicense.SetLicense(new MemoryStream(SharedFilesConfiguration.Current.AsposeLicense)); string filename = string.Format("{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}.pdf", State, StartDate.Month, StartDate.Day, StartDate.Year, EndDate.Month, EndDate.Day, EndDate.Year, DateTime.Now.Ticks); MongoClient client = new MongoClient(System.Environment.GetEnvironmentVariable("ScreeningCosmosDb", EnvironmentVariableTarget.Process)); IMongoDatabase database = client.GetDatabase("Screening"); IMongoCollection <BsonDocument> collection = database.GetCollection <BsonDocument>("Screening"); if (Screenings != null) { Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(); foreach (var screening in Screenings.OrderBy(s => s.Applicant.LastName + "_" + s.Applicant.FirstName)) { Aspose.Pdf.Document form8850Pdf = new Aspose.Pdf.Document(RenderIRSForm8850Page2(screening)); pdfDocument.Pages.Add(form8850Pdf.Pages); Aspose.Pdf.Document form9061Pdf = new Aspose.Pdf.Document(RenderIRSForm9061(screening)); pdfDocument.Pages.Add(form9061Pdf.Pages); var jsonObject = JObject.FromObject(screening); jsonObject.Add("Type", "StateSubmissionRecord"); jsonObject.Add("State", State); jsonObject.Add("DatePrepared", DateTime.Now.ToString()); jsonObject.Add("FileProduced", string.Empty); jsonObject.Add("DateSent", string.Empty); jsonObject.Add("DateValidated", string.Empty); jsonObject.Add("OutputFile", filename); collection.InsertOne( MongoDB.Bson.Serialization.BsonSerializer.Deserialize <BsonDocument>(jsonObject.ToString())); } Aspose.Pdf.Document wotcCoverPdf = new Aspose.Pdf.Document(RenderCoverLetter("Address Goes Here", "Salutation Goes Here", Screenings)); pdfDocument.Pages.Add(wotcCoverPdf.Pages); MemoryStream stream = new MemoryStream(); pdfDocument.Save(stream); CloudBlobContainer storagePackageContainer = storageClient.GetContainerReference("statepackages"); storagePackageContainer.CreateIfNotExists(BlobContainerPublicAccessType.Off); blob = storagePackageContainer.GetBlockBlobReference(filename); if (stream.Length == 0) { return; } blob.UploadFromStream(stream, stream.Length, null, null, null); } string filter = string.Format("{{ Type: 'StateSubmissionRecord', OutputFile : '{0}'}}", filename); var update = Builders <BsonDocument> .Update.Set("FileProduced", DateTime.Now.ToString()); collection.UpdateMany(filter, update); } catch (Exception e) { onFailure(e); } onSuccess(); }