private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                //if ((int)nuTimeSpan.Value < dataManager.DailyShowPlan.DailyPlan.Timespan)
                //{
                //    nuTimeSpan.Value = (decimal)dataManager.DailyShowPlan.DailyPlan.Timespan;
                //    MessageBox.Show("最小场间隔不能小于日计划的场间隔!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //    return;
                //}

                if (this.showPlan.ShowTypeId == 2 && cbCarom.SelectedIndex < 0)
                {
                    MessageBox.Show("请先选择连场组号!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (this.showPlan.ShowTypeId == 3 && cbCycles.SelectedIndex < 0)
                {
                    MessageBox.Show("请先选择循环场组号!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (this.showPlan.LowestPrice > this.showPlan.SinglePrice ||
                    this.showPlan.LowestPrice > this.showPlan.DoublePrice ||
                    this.showPlan.LowestPrice > this.showPlan.StudentPrice
                    //|| tmp.Film.LowestPrice > theaterPrice.GroupPrice
                    || this.showPlan.LowestPrice > this.showPlan.MemberPrice ||
                    this.showPlan.LowestPrice > this.showPlan.BoxPrice)
                {
                    MessageBox.Show("最低票价不能小于影片的最低价!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                //判断设置的放映时间是否符合要求
                dataManager.CheckShowPlan(this.showPlan);

                //把票价设置等级更新为分场票价等级
                this.showPlan.FareSettingId = fareSettingId;


                //重新更新单选控件的值
                Updaterb();

                DialogResult = DialogResult.OK;
            }
            catch (Exception E)
            {
                MessageBox.Show(E.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        /// <summary>
        /// 批量生成放映计划信息
        /// </summary>
        /// <param name="hallId"></param>
        /// <param name="filmId"></param>
        /// <param name="StartTime"></param>
        /// <param name="timeSpan"></param>
        /// <param name="showPlanNumber"></param>
        /// <returns></returns>
        public bool BuildShowPlan(string hallId, string filmId, DateTime StartTime, int timeSpan, int showPlanNumber)
        {
            bool IsHashMode = false;

            if (showPlanNumber < 1)
            {
                throw new NotImplementedException("安排场次不能为0");
            }

            //清空缓存中的场次计划
            showPlanList.Clear();

            Film_FilmMode film_FilmMode = new Film_FilmMode();

            string[] Id;
            int?     film_FilmModeId = null;

            if (filmId.Contains(";") == true)
            {
                // 有 ";"号好的,则说明此条数据有放映模式的
                Id = filmId.Split(';');

                filmId = Id[0];

                try
                {
                    film_FilmModeId = Convert.ToInt32(Id[1]);

                    //获取放映模式数据
                    film_FilmMode = GetFilm_FilmMode((int)film_FilmModeId);

                    IsHashMode = true;
                }
                catch { return(false); }
            }
            //获取影片信息
            Film tmpFilm = GetFilm(filmId);

            if (tmpFilm == null)
            {
                return(false);
            }
            //如果日计划的开始时间的小时大于或等于日计划的结束时间的小时数,则说明此日计划是跨天的。并且ShowPlan的开始时间小于日计划的开始时间的小时,则是第二天的

            //因为选择的时候没有更改选择时间的日期。所以要从新构造以当前日计划一致的时间
            if ((dataMager.DailyShowPlan.DailyPlan.EndTime.Value <= dataMager.DailyShowPlan.DailyPlan.StartTime.Value) && StartTime.Hour < dataMager.DailyShowPlan.DailyPlan.StartTime.Value.Hours)
            {
                StartTime = new DateTime(dataMager.DailyShowPlan.DailyPlan.PlanDate.Value.Year, dataMager.DailyShowPlan.DailyPlan.PlanDate.Value.Month, dataMager.DailyShowPlan.DailyPlan.PlanDate.Value.Day + 1, StartTime.Hour, StartTime.Minute, 0);
            }
            else
            {
                StartTime = new DateTime(dataMager.DailyShowPlan.DailyPlan.PlanDate.Value.Year, dataMager.DailyShowPlan.DailyPlan.PlanDate.Value.Month, dataMager.DailyShowPlan.DailyPlan.PlanDate.Value.Day, StartTime.Hour, StartTime.Minute, 0);
            }


            while (showPlanNumber > 0)
            {
                showPlanNumber--;

                ShowPlan newData = new ShowPlan();

                if (IsHashMode == true && tmpFilm.HasMode == true && film_FilmMode.Film_FilmModeId.ToString().Trim() != string.Empty)
                {
                    //如果影片信息的放映模式为真且放映模式的编号不为空

                    //设置放映计划名称 影片名称+放映模式名称
                    newData.ShowPlanName = tmpFilm.FilmName + "(" + film_FilmMode.FilmMode.FilmModeName + ")";

                    //设置放映模式编号
                    newData.Film_FilmModeId = film_FilmModeId;
                }
                else
                {
                    newData.ShowPlanName = tmpFilm.FilmName;
                }

                newData.Film = dataMager.GetFilm(tmpFilm.FilmId);

                newData.Position  = 0;
                newData.StartTime = StartTime;
                newData.EndTime   = newData.StartTime.Value.AddMinutes((int)tmpFilm.FilmLength);
                newData.HallId    = hallId;

                //设置下一场的开始时间
                StartTime = newData.EndTime.Value.AddMinutes((int)timeSpan);

                newData.FilmLength = tmpFilm.FilmLength;
                newData.DailyPlan  = dataMager.DailyShowPlan.DailyPlan;
                newData.Timespan   = timeSpan;
                newData.Ratio      = tmpFilm.Ratio;
                //    newData.DiscountId = 0;
                newData.IsDiscounted  = false;
                newData.FareSettingId = 1;

                var tmp = dataMager.GetTheaterPrice();
                if (tmp != null)
                {
                    newData.SinglePrice  = tmp.SinglePrice;
                    newData.DoublePrice  = tmp.DoublePrice;
                    newData.StudentPrice = tmp.StudentPrice;
                    newData.GroupPrice   = tmp.GroupPrice;
                    newData.MemberPrice  = tmp.MemberPrice;
                    newData.BoxPrice     = tmp.BoxPrice;
                }
                else
                {
                    newData.SinglePrice  = 0;
                    newData.DoublePrice  = 0;
                    newData.StudentPrice = 0;
                    newData.GroupPrice   = 0;
                    newData.MemberPrice  = 0;
                    newData.BoxPrice     = 0;
                }

                newData.ShowStatus        = 0;
                newData.ShowTypeId        = 1;
                newData.IsCheckingNumber  = true;
                newData.IsTicketChecking  = true;
                newData.IsOnlineTicketing = true;
                newData.IsApproved        = false;
                newData.IsSalable         = false;
                newData.IsLocked          = false;
                newData.ActiveFlag        = true;
                newData.Created           = DateTime.Now;
                newData.Updated           = DateTime.Now;

                //设置最低价格
                newData.LowestPrice = dataMager.GetFilm(tmpFilm.FilmId).LowestPrice;

                showPlanList.Add(newData);
            }
            try
            {
                if (dataMager.CheckShowPlan(this.showPlanList) == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception EX)
            {
                throw new NotImplementedException(EX.Message);
            }
        }