예제 #1
0
 public void InsertDropdownSelectedData(HallInfo hall)
 {
     if (hall.HallTypeSelectedIDs != null)
     {
         foreach (var item in hall.HallTypeSelectedIDs)
         {
             hall.HallTypes.Add(context.HallTypes.Find(item));
         }
     }
     if (hall.HallEventTypeSelectedIDs != null)
     {
         foreach (var item in hall.HallEventTypeSelectedIDs)
         {
             hall.EventTypes.Add(context.EventTypes.Find(item));
         }
     }
     if (hall.HallActivitiesSelectedIDs != null)
     {
         foreach (var item in hall.HallActivitiesSelectedIDs)
         {
             hall.HallActivities.Add(context.HallActivities.Find(item));
         }
     }
     if (hall.HallFacilitySelectedIDs != null)
     {
         foreach (var item in hall.HallFacilitySelectedIDs)
         {
             hall.HallFacilities.Add(context.HallFacilities.Find(item));
         }
     }
 }
예제 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo()
            {
                HTitle = txtTitle.Text
            };

            if (txtId.Text == "添加时无编号")
            {
                //添加
                if (hiBll.Add(hi))
                {
                    LoadList();
                }
            }
            else
            {
                //修改
                hi.Id = int.Parse(txtId.Text);
                if (hiBll.Edit(hi))
                {
                    LoadList();
                }
            }

            txtId.Text    = "添加时无编号";
            txtTitle.Text = "";
            btnSave.Text  = "添加";

            MyUpdateForm();
        }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo()
            {
                HTitle = txtTitle.Text
            };

            if (txtId.Text == "No number")
            {
                if (hiBll.Add(hi))
                {
                    LoadList();
                }
            }
            else
            {
                hi.HId = int.Parse(txtId.Text);
                if (hiBll.Edit(hi))
                {
                    LoadList();
                }
            }

            txtId.Text    = "No number";
            txtTitle.Text = "";
            btnSave.Text  = "Add";

            //MyUpdateForm();
        }
예제 #4
0
        public int Insert(HallInfo hi)
        {
            string       sql = "insert into hallinfo(htitle,isDelete) values(@title,0)";
            SqlParameter p   = new SqlParameter("@title", hi.HTitle);

            return(SQLHelper.ExecuteNonQuery(sql, p));
        }
예제 #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo();

            hi.HTitle = txtTitle.Text;
            if (txtId.Text == "添加时无编号") //增加
            {
                if (hiBll.Add(hi))
                {
                    LoadList();
                    ClearText();
                }
                else
                {
                    MessageBox.Show("添加失败,请稍后再试!");
                }
            }
            else
            {
                hi.HId = Convert.ToInt32(txtId.Text);
                if (hiBll.Edit(hi))
                {
                    LoadList();
                    ClearText();
                }
                else
                {
                    MessageBox.Show("修改失败,请稍后再试!");
                }
            }
        }
예제 #6
0
        /// <summary>
        /// 添加操作
        /// </summary>
        /// <param name="hi"></param>
        /// <returns></returns>
        public int Insert(HallInfo hi)
        {
            string          sql = "insert into hallinfo (htitle,hisdelete) values(@title,0)";
            SQLiteParameter sp  = new SQLiteParameter("@title", hi.HTitle);

            return(SqliteHelper.ExcuteNoQuery(sql, sp));
        }
예제 #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo()
            {
                HTitle = txtHTitle.Text
            };

            if (btnSave.Text.Equals("添加"))
            {
                if (_hiBll.Add(hi))
                {
                    UpdateHallEvent?.Invoke();
                    LoadList();
                }
                else
                {
                    MessageBox.Show("添加失败");
                }
            }
            else if (btnSave.Text.Equals("修改"))
            {
                hi.HId = Convert.ToInt32(txtDId.Text);
                if (_hiBll.Edit(hi))
                {
                    UpdateHallEvent?.Invoke();
                    LoadList();
                }
                else
                {
                    MessageBox.Show("修改失败");
                }
            }
        }
예제 #8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo();

            hi.HTitle = txtTitle.Text;
            if (btnSave.Text == "添加")
            {
                if (hiBll.Add(hi))
                {
                    LoadHallInfoList();
                    UpdateHallInfoEvent();
                }
                else
                {
                    MessageBox.Show("添加失败!请稍后重试!");
                }
            }
            else
            {
                hi.HId = Convert.ToInt32(txtId.Text);
                //修改操作
                if (hiBll.Edit(hi))
                {
                    LoadHallInfoList();
                    UpdateHallInfoEvent();
                }
                else
                {
                    MessageBox.Show("修改失败!请稍后重试!");
                }
            }
        }
예제 #9
0
        public void PopulatingDropdownsForUpdate(HallInfo Hall, int id)
        {
            //Getting hall Types
            Hall.HallTypeSelectedIDs = context.HallTypes
                                       .Where(ht => ht.HallInfoes
                                              .Any(hi => hi.HallInfoID == id))
                                       .Select(i => i.HallTypeID).ToList();

            //Getting hall Activities
            Hall.HallActivitiesSelectedIDs = context.HallActivities
                                             .Where(ht => ht.HallInfoes
                                                    .Any(hi => hi.HallInfoID == id))
                                             .Select(i => i.HallActivityID).ToList();

            //getting Hall Events
            Hall.HallEventTypeSelectedIDs = context.EventTypes
                                            .Where(ht => ht.HallInfoes
                                                   .Any(hi => hi.HallInfoID == id))
                                            .Select(i => i.EventTypeID).ToList();


            Hall.HallFacilitySelectedIDs = context.HallFacilities
                                           .Where(ht => ht.HallInfoes
                                                  .Any(hi => hi.HallInfoID == id))
                                           .Select(i => i.HallFacilityID).ToList();
        }
예제 #10
0
        public int Insert(HallInfo hi)
        {
            string          sql = "insert into HallInfo(HTitle,HIsDelete) values(@title,0)";
            SQLiteParameter p   = new SQLiteParameter("@title", hi.HTitle);

            return(SqliteHelper.ExecuteNonQuery(sql, p));
        }
예제 #11
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo();

            hi.HTitle = txtTitle.Text;
            if (btnSave.Text.Equals("添加"))
            {
                if (new HallInfoBll().Insert(hi))
                {
                    LoadList();
                    LoadType();
                }
                else
                {
                    MessageBox.Show("添加失败,请稍后重试");
                }
            }
            else
            {
                hi.HId = Convert.ToInt32(txtId.Text);
                if (new HallInfoBll().Update(hi))
                {
                    LoadList();
                    LoadType();
                    btnCancel.PerformClick();
                }
                else
                {
                    MessageBox.Show("修改失败,请稍后重试");
                }
            }
        }
예제 #12
0
        public ActionResult AddVenue(int id = 0)
        {
            HallInfo Hall = new HallInfo();

            if (id != 0) //For Update:
            {
                //hall = context.HallInfoes.Where(x => x.HallInfoID == id).FirstOrDefault();
                Hall = context.HallInfoes.Find(id);

                //var HallTypeIDs = from HallType in context.HallTypes
                //            from HallInfo in HallType.HallInfoes
                //            where HallInfo.HallInfoID == id
                //            select HallType.HallTypeID;
                //Hall.HallTypeSelectedIDs = HallTypeIDs.ToList();

                PopulatingDropdownsForUpdate(Hall, id);
            }

            Hall.HallTypes      = context.HallTypes.ToList();
            Hall.HallFacilities = context.HallFacilities.ToList();
            Hall.EventTypes     = context.EventTypes.ToList();
            Hall.HallActivities = context.HallActivities.ToList();

            return(View(Hall));
        }
예제 #13
0
        public ActionResult AddVenue(HallInfo hall)
        {
            //Get Vendor ID
            hall.VendorInfoID = User.Identity.GetUserId();
            //Insert Dropdowns Data
            InsertDropdownSelectedData(hall);


            if (hall.HallInfoID == 0)
            {
                context.HallInfoes.Add(hall);
            }
            else
            {
                context.Entry(hall).State = EntityState.Modified;
            }

            context.SaveChanges();



            ViewBag.msg = "Venue added successfully";
            //return View(hall);
            return(RedirectToAction("AddVenue", new { id = 0 }));
        }
예제 #14
0
        public int Add(HallInfo model)
        {
            string          sql   = "insert into HallInfo(HTitle,HIsDelete) values(@title,0)";
            SQLiteParameter param = new SQLiteParameter("@title", model.HTitle);

            return(SqliteHelper.ExecuteNonQuery(sql, param));
        }
        //添加\修改
        private void button1_Click(object sender, EventArgs e)
        {
            HallInfo hi = new HallInfo();

            hi.HTitle = textBox1.Text;
            if (button1.Text.Equals("添加"))
            {
                //添加
                if (hiBll.Add(hi))
                {
                    button2_Click(null, null);
                    LoadList();
                    RefreshHallEvent();
                }
                else
                {
                    MessageBox.Show("添加失败,请稍后重试!!!");
                }
            }
            else
            {
                hi.HId = Convert.ToInt32(textBox3.Text);
                //修改
                if (hiBll.Edit(hi))
                {
                    button2_Click(null, null);
                    LoadList();
                    RefreshHallEvent();
                }
                else
                {
                    MessageBox.Show("修改失败,请稍后重试!!!");
                }
            }
        }
예제 #16
0
 public string Post([FromBody] HallInfo value)
 {
     if (!cinemaContext.HallInfo.Any(hall => hall.Name.Equals(value.Name) & hall.CinemaId.Equals(value.CinemaId)))
     {
         HallInfo hall = new HallInfo();
         hall.CinemaId = value.CinemaId;
         hall.Name     = value.Name;
         hall.Places   = value.Places;
         hall.Id       = Guid.NewGuid();
         try
         {
             cinemaContext.Add(hall);
             cinemaContext.SaveChanges();
             return(JsonConvert.SerializeObject("Зал успешно добавлен"));
         }
         catch (Exception ex)
         {
             return(JsonConvert.SerializeObject(ex.Message));
         }
     }
     else
     {
         return(JsonConvert.SerializeObject("Такой зал уже существует!"));
     }
 }
예제 #17
0
        public ActionResult VenueDetails(int id)
        {
            HallInfo hall = new HallInfo();

            hall = context.HallInfoes.Find(id);
            //return View(from HallInfo in context.HallInfoes where HallInfo.HallInfoID == id select HallInfo);
            return(View(hall));
        }
예제 #18
0
        /// <summary>
        /// 添加数据
        /// </summary>
        /// <param name="hi"></param>
        /// <returns></returns>
        public int Insert(HallInfo hi)
        {
            //构造sql语句及参数
            string         sql = "INSERT INTO HallInfo (HTitle, HIsDelete) VALUES (@HTitle,0) ";
            MySqlParameter p   = new MySqlParameter("@HTitle", hi.HTitle);

            //执行并返回影响行数
            return(MysqlHelper.ExecuteNonQuery(sql, p));
        }
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="hi"></param>
        /// <returns></returns>
        public int Update(HallInfo hi)
        {
            string sqltext = "update HallInfo set HTitle = @title where HId = @Id";

            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@title", hi.HTitle),
                new SQLiteParameter("@Id",    hi.HId)
            };
            return(SQLiteHelper.ExecuteNonQuery(sqltext, parameters));
        }
예제 #20
0
        /// <summary>
        /// Update HallInfo object
        /// </summary>
        /// <param name="hi"></param>
        /// <returns></returns>
        public int Update(HallInfo hi)
        {
            string sql = "UPDATE HallInfo SET HTitle = @title WHERE HId = @id";

            SQLiteParameter[] ps =
            {
                new SQLiteParameter("@title", hi.HTitle),
                new SQLiteParameter("@id",    hi.HId)
            };
            return(SqliteHelper.ExecuteNonQuery(sql, ps));
        }
예제 #21
0
        public int Update(HallInfo hi)
        {
            string sql = "update HallInfo set HTitle=@HTitle where HId=@HId";

            SQLiteParameter[] sp =
            {
                new SQLiteParameter("HTitle", hi.HTitle),
                new SQLiteParameter("HId",    hi.HId)
            };
            return(SQLiteHelper.ExecuteNonQuery(sql, sp));
        }
예제 #22
0
        /// <summary>
        /// 修改操作
        /// </summary>
        /// <param name="hi"></param>
        /// <returns></returns>
        public int Update(HallInfo hi)
        {
            string sql = "update hallinfo set htitle=@title where hid=@id";

            SQLiteParameter [] sp = new SQLiteParameter[]
            {
                new SQLiteParameter("@title", hi.HTitle),
                new SQLiteParameter("@id", hi.HId),
            };
            return(SqliteHelper.ExcuteNoQuery(sql, sp));
        }
예제 #23
0
        public int Update(HallInfo model)
        {
            string sql = "update HallInfo set HTitle=@title where HId=@id";

            SQLiteParameter[] param =
            {
                new SQLiteParameter("@title", model.HTitle),
                new SQLiteParameter("@id",    model.HId)
            };
            return(SqliteHelper.ExecuteNonQuery(sql, param));
        }
예제 #24
0
        public int Insert(HallInfo hi)
        {
            string sql = "insert into hallinfo(htitle,hisdelete) values(@htitle,0)";

            SQLiteParameter[] ps =
            {
                new SQLiteParameter("@htitle", hi.HTitle),
            };

            return(SqliteHelper.ExecuteNonQuery(sql, ps));
        }
예제 #25
0
        public int Update(HallInfo hi)
        {
            string sql = "update hallinfo set htitle=@htitle where hid=@hid";

            SQLiteParameter[] ps =
            {
                new SQLiteParameter("@htitle", hi.HTitle),
                new SQLiteParameter("@hid",    hi.HId),
            };
            return(SqliteHelper.ExecuteNonQuery(sql, ps));
        }
예제 #26
0
        public int Update(HallInfo hi)
        {
            string sql = "update hallinfo set htitle=@title where Id=@id";

            SqlParameter[] ps =
            {
                new SqlParameter("@title", hi.HTitle),
                new SqlParameter("@id",    hi.Id)
            };

            return(SQLHelper.ExecuteNonQuery(sql, ps));
        }
예제 #27
0
        /// <summary>
        /// Insert HallInfo object
        /// </summary>
        /// <param name="hi"></param>
        /// <returns></returns>
        public int Insert(HallInfo hi)
        {
            string sql = "INSERT INTO HallInfo (HTitle, HIsDELETE) VALUES(@title, @isDelete)";

            SQLiteParameter[] ps =
            {
                new SQLiteParameter("@title",    hi.HTitle),
                new SQLiteParameter("@isDelete", 1)
            };

            return(SqliteHelper.ExecuteNonQuery(sql, ps));
        }
예제 #28
0
        public string Delete(string id)
        {
            HallInfo hall = cinemaContext.HallInfo.FirstOrDefault(x => x.Id.ToString().Equals(id));

            if (hall == null)
            {
                return(JsonConvert.SerializeObject("Зал не найден!"));
            }
            cinemaContext.HallInfo.Remove(hall);
            cinemaContext.SaveChangesAsync();
            return(JsonConvert.SerializeObject("Успешно удален!"));
        }
        public ActionResult GetHallInfo(int timeslotId)
        {
            var timeslot      = _ticketService.GetTimeslotById(timeslotId);
            var currentTariff = _ticketService.GetTariffById(timeslot.TariffId);
            var model         = new HallInfo
            {
                CurrentTariff     = currentTariff,
                CurrentTimeslotId = timeslotId,
                RequestedSeats    = timeslot.RequestedSeats
            };

            return(View("~/Views/Tickets/HallInfo.cshtml", model));
        }
예제 #30
0
        /// <summary>
        /// 修改数据
        /// </summary>
        /// <param name="hi"></param>
        /// <returns></returns>
        public int Update(HallInfo hi)
        {
            //构造sql语句及参数
            string sql = "UPDATE HallInfo SET HTitle =@HTitle WHERE HId = @HId";

            MySqlParameter[] ps =
            {
                new MySqlParameter("@HId",    hi.HId),
                new MySqlParameter("@HTitle", hi.HTitle)
            };
            //执行并返回影响行数
            return(MysqlHelper.ExecuteNonQuery(sql, ps));
        }