示例#1
0
        public ShowtimeEditorWindowViewModel(ShowtimeEditorWindow view, Showtime showtime,
                                             MovieRepository movieRepository, ShowtimeRepository showtimeRepository)
        {
            if (showtime == null)
            {
                CreateMode = true;
                showtime   = new Showtime();
            }

            this.view               = view;
            this.movieRepository    = movieRepository;
            this.showtimeRepository = showtimeRepository;
            Showtime = showtime;

            Movies      = movieRepository.GetMovies().ToList();
            Auditoriums = showtimeRepository.GetAuditoriums().ToList();

            if (CreateMode)
            {
                return;
            }

            var movie = Movies.FirstOrDefault(_ => _.Id == showtime.Movie.Id);

            view.SelectedMovieIndex = Movies.IndexOf(movie);

            var auditorium = Auditoriums.FirstOrDefault(_ => _.Id == showtime.Auditorium.Id);

            view.SelectedAuditoriumIndex = Auditoriums.IndexOf(auditorium);

            view.Time = showtime.Time;
        }
示例#2
0
        public IHttpActionResult PutAuditoriums(int id, Auditoriums auditoriums)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != auditoriums.AuditoriumId)
            {
                return(BadRequest());
            }

            db.Entry(auditoriums).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AuditoriumsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult DeleteConfirmed(long id)
        {
            Auditoriums auditoriums = db.Auditoriums.Find(id);

            db.Auditoriums.Remove(auditoriums);
            db.SaveChanges();
            return(RedirectToAction("Index", "MyAccount"));
        }
示例#4
0
        public string GetAuditoriums(int id)
        {
            Auditoriums auditoriums = db.Auditoriums.Find(id);

            //if (auditoriums == null)
            //{
            //    return NotFound();
            //}

            return(auditoriums.AuditoriumName);
        }
示例#5
0
        public IHttpActionResult PostAuditoriums(Auditoriums auditoriums)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Auditoriums.Add(auditoriums);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = auditoriums.AuditoriumId }, auditoriums));
        }
示例#6
0
        public IHttpActionResult DeleteAuditoriums(int id)
        {
            Auditoriums auditoriums = db.Auditoriums.Find(id);

            if (auditoriums == null)
            {
                return(NotFound());
            }

            db.Auditoriums.Remove(auditoriums);
            db.SaveChanges();

            return(Ok(auditoriums));
        }
        // GET: Auditoriums/Edit/5
        public ActionResult Edit(long?id)
        {
            ViewBag.AuditoriumCategory = db.AuditoriumCategory.ToList();
            ViewBag.AuditoriumType     = db.AuditoriumType.ToList();
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Auditoriums auditoriums = db.Auditoriums.Find(id);

            if (auditoriums == null)
            {
                return(HttpNotFound());
            }
            return(View(auditoriums));
        }
        // GET: Auditoriums/Details/5
        public ActionResult Details(string id)
        {
            id = id == null ? "" : id;
            SqlParameter[] Parameters =
            {
                new SqlParameter("@AuditoriumId", id.ToString())
            };
            ViewBag.data = db.Database.SqlQuery <AuditoriumModel>("[dbo].[spGetListingData_Auditorium_details] @AuditoriumId", Parameters).ToList();
            long        ids     = Convert.ToInt64(id);
            Auditoriums forsale = db.Auditoriums.Find(ids);

            forsale.Views           = forsale.Views + 1;
            db.Entry(forsale).State = EntityState.Modified;
            db.SaveChanges();

            return(View());
        }
        public ActionResult Pay(long?prime, long?vid, long?id, string userid, string amnt)
        {
            Auditoriums forsale = db.Auditoriums.Find(id);
            DateTime    _date   = Convert.ToDateTime(DateTime.Now);

            _date = _date.AddDays(365);


            forsale.UserId = User.Identity.GetUserId();

            forsale.Status    = true;
            forsale.Date      = DateTime.Now;
            forsale.EndDate   = _date;
            forsale.StratDate = DateTime.Now;

            db.Entry(forsale).State = EntityState.Modified;
            db.SaveChanges();
            var            ids    = DateTime.Now.ToString("mmddyyyy");
            RazorpayClient client = new RazorpayClient(RazorPayConst.Api_Key, RazorPayConst.Key_Secret);
            Dictionary <string, object> options = new Dictionary <string, object>();

            options.Add("amount", amnt); // amount in the smallest currency unit
            options.Add("receipt", "order_id" + ids);
            options.Add("currency", "INR");
            options.Add("payment_capture", "1");
            Order order = client.Order.Create(options);

            List <Order> payments = client.Order.All();
            string       datas    = payments[0]["id"];

            ViewBag.receipt = datas;

            RazorPayPaymentDetails clients = new RazorPayPaymentDetails();

            clients.Amount          = Convert.ToDouble(amnt);
            clients.Currency        = "INR";
            clients.Captured        = "Paid";
            clients.RazorpayOrderId = ids;
            clients.MerchantOrderId = "vooq.com";
            clients.PaymentId       = User.Identity.GetUserId();
            clients.PaymentDate     = DateTime.Now;
            db.RazorPayPaymentDetails.Add(clients);
            db.SaveChanges();

            return(View());
        }
        private void FilterAudit_TextChanged(object sender, EventArgs e)
        {
            if (Location.SelectedItem == null)
            {
                return;
            }
            var temp = Model.GetAuditoriumIDPartial(FilterAudit.Text, (LocationInfo)Location.SelectedItem);

            if (temp != null)
            {
                Auditoriums.SelectTab(temp);
            }
            else
            {
                MessageBox.Show("Такой аудитории не существует");
            }
            FilterAudit.Focus();
        }
示例#11
0
 private void showAuds_Click(object sender, EventArgs e)
 {
     var audsForm = new Auditoriums(_repo);
     audsForm.Show();
 }
        public ActionResult Edit([Bind(Include = "UserId,EndDate,status,StratDate,AuditoriumId,VId,UserId,PropertyName,AuditoriumCategoryId,Location,Price,SeatingCapacity,DiningCapacity,ParkingCapacity,AuditoriumTypeId,MobileNumber,LandPhone,Address,Email,Website,About,Image1,Image2,Image3,Date,Views,Status")] Auditoriums auditoriums, HttpPostedFileBase file1, HttpPostedFileBase file2, HttpPostedFileBase file3)
        {
            ViewBag.AuditoriumCategory = db.AuditoriumCategory.ToList();
            ViewBag.AuditoriumType     = db.AuditoriumType.ToList();
            if (ModelState.IsValid)
            {
                if (file1 != null)
                {
                    //file1.SaveAs(HttpContext.Server.MapPath("~/Images/")+ file1.FileName);
                    //realEstate.Image1 = "/Images/"+file1.FileName;
                    string watermarkText = "© Vooqq.Com";

                    //Get the file name.
                    string fileName = Path.GetFileNameWithoutExtension(file1.FileName);

                    //Read the File into a Bitmap.
                    using (Bitmap bmp = new Bitmap(file1.InputStream, false))
                    {
                        using (Graphics grp = Graphics.FromImage(bmp))
                        {
                            //Set the Color of the Watermark text.
                            Brush brush = new SolidBrush(Color.DimGray);

                            //Set the Font and its size.
                            Font font = new System.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);

                            //Determine the size of the Watermark text.
                            SizeF textSize = new SizeF();
                            textSize = grp.MeasureString(watermarkText, font);

                            //Position the text and draw it on the image.
                            Point position = new Point((bmp.Width - ((int)textSize.Width + 10)), (bmp.Height - ((int)textSize.Height + 10)));
                            grp.DrawString(watermarkText, font, brush, position);

                            using (MemoryStream memoryStream = new MemoryStream())
                            {
                                //Save the Watermarked image to the MemoryStream.
                                bmp.Save(HttpContext.Server.MapPath("~/Images/") + file1.FileName);
                                auditoriums.Image1 = "/Images/" + file1.FileName;
                            }
                        }
                    }
                }
                else
                {
                    auditoriums.Image1 = "/Images/nullimage.jpg";
                }
                if (file2 != null)
                {
                    string watermarkText = "© Vooqq.Com";

                    //Get the file name.
                    string fileName = Path.GetFileNameWithoutExtension(file2.FileName);

                    //Read the File into a Bitmap.
                    using (Bitmap bmp = new Bitmap(file2.InputStream, false))
                    {
                        using (Graphics grp = Graphics.FromImage(bmp))
                        {
                            //Set the Color of the Watermark text.
                            Brush brush = new SolidBrush(Color.DimGray);

                            //Set the Font and its size.
                            Font font = new System.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);

                            //Determine the size of the Watermark text.
                            SizeF textSize = new SizeF();
                            textSize = grp.MeasureString(watermarkText, font);

                            //Position the text and draw it on the image.
                            Point position = new Point((bmp.Width - ((int)textSize.Width + 10)), (bmp.Height - ((int)textSize.Height + 10)));
                            grp.DrawString(watermarkText, font, brush, position);

                            using (MemoryStream memoryStream = new MemoryStream())
                            {
                                //Save the Watermarked image to the MemoryStream.
                                bmp.Save(HttpContext.Server.MapPath("~/Images/") + file2.FileName);
                                auditoriums.Image2 = "/Images/" + file2.FileName;
                            }
                        }
                    }
                }
                else
                {
                    auditoriums.Image2 = "/Images/nullimage.jpg";
                }
                if (file3 != null)
                {
                    string watermarkText = "© Vooqq.Com";

                    //Get the file name.
                    string fileName = Path.GetFileNameWithoutExtension(file3.FileName);

                    //Read the File into a Bitmap.
                    using (Bitmap bmp = new Bitmap(file3.InputStream, false))
                    {
                        using (Graphics grp = Graphics.FromImage(bmp))
                        {
                            //Set the Color of the Watermark text.
                            Brush brush = new SolidBrush(Color.DimGray);

                            //Set the Font and its size.
                            Font font = new System.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);

                            //Determine the size of the Watermark text.
                            SizeF textSize = new SizeF();
                            textSize = grp.MeasureString(watermarkText, font);

                            //Position the text and draw it on the image.
                            Point position = new Point((bmp.Width - ((int)textSize.Width + 10)), (bmp.Height - ((int)textSize.Height + 10)));
                            grp.DrawString(watermarkText, font, brush, position);

                            using (MemoryStream memoryStream = new MemoryStream())
                            {
                                //Save the Watermarked image to the MemoryStream.
                                bmp.Save(HttpContext.Server.MapPath("~/Images/") + file3.FileName);
                                auditoriums.Image3 = "/Images/" + file3.FileName;
                            }
                        }
                    }
                }
                else
                {
                    auditoriums.Image3 = "/Images/nullimage.jpg";
                }
                auditoriums.Date            = DateTime.Now;
                db.Entry(auditoriums).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "MyAccount"));
            }
            return(RedirectToAction("Index", "MyAccount"));
        }