/// <summary> /// 修改是否显示的状态 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void sbShow_Click(object sender, EventArgs e) { try { StateButton ub = (StateButton)sender; int index = ((GridViewRow)(ub.Parent.Parent)).RowIndex; int id = int.Parse(this.GridView1.DataKeys[index].Value.ToString()); // Song.Entities.Video entity = Business.Do <IContents>().VideoSingle(id); entity.Vi_IsShow = !entity.Vi_IsShow; Business.Do <IContents>().VideoSave(entity); BindData(null, null); } catch (Exception ex) { Message.ExceptionShow(ex); } }
/// <summary> /// 设置初始界面 /// </summary> private void fill() { try { //lbDir1.Text = lbDir2.Text = Upload.Get[type].Virtual; Song.Entities.Video mm; if (id != 0) { mm = Business.Do <IContents>().VideoSingle(id); //唯一标识 ViewState["UID"] = mm.Vi_Uid == null || mm.Vi_Uid.Length < 1 ? WeiSha.Common.Request.UniqueID() : mm.Vi_Uid; //是否使用与显示 cbIsRec.Checked = mm.Vi_IsRec; cbIsShow.Checked = mm.Vi_IsShow; //热点与置顶 cbIsHot.Checked = mm.Vi_IsHot; cbIsTop.Checked = mm.Vi_IsTop; //栏目分类 ListItem li = ddlColumn.Items.FindByValue(mm.Col_Id.ToString()); if (li != null) { li.Selected = true; } //上线时间 tbPushTime.Text = mm.Vi_PushTime.ToString(); } else { //如果是新增 mm = new Song.Entities.Video(); ViewState["UID"] = WeiSha.Common.Request.UniqueID(); } if (mm.Vi_FilePath != string.Empty && mm.Vi_FilePath != "") { tbVideo.Text = mm.Vi_VideoFile; //flv = Upload.Get[type].Virtual + mm.Vi_VideoFile; flv = mm.Vi_VideoFile; //如果视频不存在 if (!System.IO.File.Exists(Server.MapPath(flv))) { this.videoBox.Visible = false; this.videoError.Visible = true; } else { this.videoBox.Visible = true; this.videoError.Visible = false; } } tbName.Text = mm.Vi_Name; //标签 tbLabel.Text = mm.Vi_Label; //内容 tbDetails.Text = mm.Vi_Details; //发布设置 tbKeywords.Text = mm.Vi_Keywords; tbDescr.Text = mm.Vi_Descr; } catch (Exception ex) { Message.ExceptionShow(ex); } }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEnter_Click(object sender, EventArgs e) { Song.Entities.Video mm = null; try { if (id != 0) { mm = Business.Do <IContents>().VideoSingle(id); } else { //如果是新增 mm = new Song.Entities.Video(); EmpAccount acc = Extend.LoginState.Admin.CurrentUser; mm.Acc_Id = acc.Acc_Id; mm.Acc_Name = acc.Acc_Name; } mm.Vi_Name = tbName.Text.Trim(); mm.Vi_FilePath = tbVideo.Text.Trim(); mm.Col_Id = Convert.ToInt32(ddlColumn.SelectedValue); mm.Col_Name = ddlColumn.SelectedItem.Text; mm.Vi_Label = tbLabel.Text.Trim(); //是否使用与显示 mm.Vi_IsRec = cbIsRec.Checked; mm.Vi_IsShow = cbIsShow.Checked; //热点与置顶 mm.Vi_IsHot = cbIsHot.Checked; mm.Vi_IsTop = cbIsTop.Checked; //详细信息 mm.Vi_Details = tbDetails.Text; //发布设置 mm.Vi_Keywords = tbKeywords.Text; mm.Vi_Descr = tbDescr.Text; mm.Vi_PushTime = tbPushTime.Text.Trim() != "" ? Convert.ToDateTime(tbPushTime.Text) : DateTime.Now; //其它 mm.Vi_Uid = getUID(); } catch (Exception ex) { Message.ExceptionShow(ex); } //确定操作 try { if (id == 0) { mm.Vi_CrtTime = DateTime.Now; Business.Do <IContents>().VideoAdd(mm); } else { Business.Do <IContents>().VideoSave(mm); } flv = mm.Vi_FilePath; //如果视频不存在 if (!System.IO.File.Exists(Server.MapPath(flv))) { this.videoBox.Visible = false; this.videoError.Visible = true; } else { this.videoBox.Visible = true; this.videoError.Visible = false; } Master.AlertCloseAndRefresh("操作成功!"); } catch (Exception ex) { Master.Alert(ex.Message); } }