private void filmLabel_MouseDown(object sender, MouseEventArgs e) { try { if (e.Button == System.Windows.Forms.MouseButtons.Left) { ColorBorderLabel label = sender as ColorBorderLabel; // 计算被点击电影的屏幕坐标 int x = label.Location.X + flPanFilm.Location.X + gbFilm.Location.X + scSplit.Location.X; int y = label.Location.Y + flPanFilm.Location.Y + gbFilm.Location.Y + scSplit.Location.Y; // 计算被点击电影的坐标偏移量(相对于屏幕坐标) xOffset = Control.MousePosition.X - x; yOffset = Control.MousePosition.Y - y; tempLabel = GetNewTempFilmLabel(label); //ShowPlan film = tempLabel.Tag as ShowPlan; //if (film==null||film.FilmLength == null || film.FilmLength == 0) //{ // MessageBox.Show("影片时长为空,请先进行设置!", "信息提示",MessageBoxButtons.OK,MessageBoxIcon.Error); // return; //} this.Controls.Add(tempLabel); tempLabel.Location = new Point(x, y); tempLabel.BringToFront(); tempLabel.IsEnableTimeLabel = true; isMouseDown = true; } if (e.Button == System.Windows.Forms.MouseButtons.Right) { string id; ColorBorderLabel label = sender as ColorBorderLabel; FilmAndFilmMode showPlan = label.Tag as FilmAndFilmMode; id = showPlan.FilmId; if (showPlan.HasMode == true && showPlan.FilmModeId != null && showPlan.Film_FilmModeId != null && showPlan.FilmId.IndexOf(';') == -1) { id += ";" + showPlan.FilmModeId; } FilmSet(id, 1); } } catch { } }
/// <summary> /// 根据电影方块信息,生成临时电影方块 /// </summary> /// <param name="label"></param> /// <returns></returns> private ColorBorderLabel GetNewTempFilmLabel(ColorBorderLabel label) { FilmAndFilmMode film = label.Tag as FilmAndFilmMode; ColorBorderLabel colorBorderLabel = new ColorBorderLabel(dataManager); colorBorderLabel.BackColor = label.BackColor; colorBorderLabel.BorderColor = label.BorderColor; colorBorderLabel.Width = spPanShowPlan.GetFilmLabelWidth(film); colorBorderLabel.TextAlign = label.TextAlign; colorBorderLabel.Text = label.Text; colorBorderLabel.Font = fontOfFilmLabel; colorBorderLabel.Tag = dataManager.GetNewShowPlan(film); return(colorBorderLabel); }
/// <summary> /// 检查并给放映模式颜色赋值 /// </summary> /// <param name="color"></param> /// <param name="i"></param> /// <param name="list"></param> private void CheckModeColor(string color, ref int i, FilmAndFilmMode list) { do { if (i > 31) { break; } color = defineColor[i]; i++; }while (filmAndFilmModeList.Where(p => p.ColorCode == color || p.Film_FilmModeColorCode == color).FirstOrDefault() != null); if (color != "") { if (this.film_FilmModeList.Where(p => p.Film_FilmModeId == list.Film_FilmModeId).FirstOrDefault() != null) { this.film_FilmModeList.Where(p => p.Film_FilmModeId == list.Film_FilmModeId).FirstOrDefault().BorderColour = color; } } }
/// <summary> /// 获取影片信息 /// </summary> /// <returns></returns> public List <FilmAndFilmMode> GetFilmAndFilmModeList(DateTime dt) { List <FilmAndFilmMode> tmpDelList = new List <FilmAndFilmMode>(); List <FilmAndFilmMode> filmModeList = new List <FilmAndFilmMode>(); var tmp = from f in de.Film join m in de.Film_FilmMode on f.FilmId equals m.FilmId into newffm from ffm in newffm.DefaultIfEmpty() join o in de.FilmMode on(int) ffm.FilmModeId equals(int) o.FilmModeId into newfm from fm in newfm.DefaultIfEmpty() select new FilmAndFilmMode { FilmId = f.FilmId, FilmCode = f.FilmCode, FilmName = f.FilmName, PublishDate = (DateTime)f.PublishDate, Publisher = f.Publisher, Producer = f.Producer, Director = f.Director, Cast = f.Cast, Brief = f.Brief, // Poster = f.Poster, StartDate = (DateTime)f.StartDate, EndDate = (DateTime)f.EndDate, FilmLength = (int)f.FilmLength, Rent = (float)f.Rent, Ratio = (float)f.Ratio, LowestPrice = (float)f.LowestPrice, FilmAreaId = f.FilmAreaId, FilmCategoryId = f.FilmCategoryId, HasMode = (bool)f.HasMode, Created = f.Created, Updated = f.Updated, ActiveFlag = f.ActiveFlag, ColorCode = f.BorderColour, Film_FilmModeId = ffm.Film_FilmModeId, Film_FilmModeColorCode = ffm.BorderColour, FilmModeId = fm.FilmModeId, FilmModeName = fm.FilmModeName, }; filmModeList.AddRange(tmp); string oldFilmId = ""; var tmplist = filmModeList.Where(p => p.HasMode == true && p.FilmModeId != null).OrderBy(p => p.FilmId).ToList(); foreach (var obj in tmplist) { if (obj.FilmId == oldFilmId) { continue; } FilmAndFilmMode tmpobj = new FilmAndFilmMode(); tmpobj.FilmId = obj.FilmId; tmpobj.FilmCode = obj.FilmCode; tmpobj.FilmName = obj.FilmName; tmpobj.PublishDate = obj.PublishDate; tmpobj.Publisher = obj.Publisher; tmpobj.Producer = obj.Producer; tmpobj.Director = obj.Director; tmpobj.Cast = obj.Cast; tmpobj.Brief = obj.Brief; // Poster = tmoobj..Poster; tmpobj.StartDate = obj.StartDate; tmpobj.EndDate = obj.EndDate; tmpobj.FilmLength = obj.FilmLength; tmpobj.Rent = obj.Rent; tmpobj.Ratio = obj.Ratio; tmpobj.LowestPrice = obj.LowestPrice; tmpobj.FilmAreaId = obj.FilmAreaId; tmpobj.FilmCategoryId = obj.FilmCategoryId; tmpobj.HasMode = false; tmpobj.Created = obj.Created; tmpobj.Updated = obj.Updated; tmpobj.ActiveFlag = obj.ActiveFlag; tmpobj.ColorCode = obj.Film_FilmModeColorCode; tmpobj.Film_FilmModeId = null; tmpobj.Film_FilmModeColorCode = string.Empty; tmpobj.FilmModeId = null; tmpobj.FilmModeName = string.Empty; filmModeList.Add(tmpobj); } foreach (var list in filmModeList) { if (list.HasMode == true && list.Film_FilmModeId != null && list.FilmModeId != null) { list.FilmId += ";" + list.Film_FilmModeId; list.FilmName += "(" + list.FilmModeName + ")"; } if (list.HasMode == false && list.FilmId == oldFilmId) { tmpDelList.Add(list); } oldFilmId = list.FilmId; } if (tmpDelList.Count > 0) { foreach (var del in tmpDelList) { filmModeList.Remove(del); } } while (filmModeList.Remove(filmModeList.Where(p => p.StartDate == null || p.EndDate == null).FirstOrDefault())) { ; } return(filmModeList.Where(p => p.StartDate.Value.Date <= dt.Date && p.EndDate >= dt.Date).ToList()); }