168 lines
5.3 KiB
C#
168 lines
5.3 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
|
||
namespace VRS.Management.VSAT
|
||
{
|
||
public partial class SubjectVideo : BasePage
|
||
{
|
||
DataService.BLL.admin_log log = new DataService.BLL.admin_log();
|
||
//DataService.BLL.zhc_task_proc_material bll = new DataService.BLL.zhc_task_proc_material();
|
||
|
||
DataService.BLL.pro_file bll = new DataService.BLL.pro_file();
|
||
|
||
protected override void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
DataLoad();
|
||
}
|
||
}
|
||
protected void DataLoad()
|
||
{
|
||
string result_id = Request.Params["Id"];
|
||
//Id = "File202202151119465646225645626624619";
|
||
//var model = bll.GetModel(Id);
|
||
var model = bll.GetModelByOutid(result_id);
|
||
if (null != model)
|
||
{
|
||
name.Text = model.file_desc;
|
||
filesize.Text = model.file_size.ToString();
|
||
video.Src = "~/" + model.file_url;
|
||
}
|
||
else
|
||
{
|
||
//OnError(null);
|
||
Response.Write("视频不存在");
|
||
}
|
||
}
|
||
|
||
/*
|
||
protected void btnSure_Click(object sender, EventArgs e)
|
||
{
|
||
if (string.IsNullOrEmpty(name.Text))
|
||
{
|
||
RadAjaxManager1.Alert("素材名称不能为空!");
|
||
return;
|
||
}
|
||
|
||
var type_value = type.SelectedValue;
|
||
|
||
if (type_value == "0" && string.IsNullOrEmpty(imgTopic.ImageUrl))
|
||
{
|
||
RadAjaxManager1.Alert("图片内容不能为空!");
|
||
return;
|
||
}
|
||
if (type_value == "1" && string.IsNullOrEmpty(video.Src))
|
||
{
|
||
RadAjaxManager1.Alert("视频内容不能为空!");
|
||
return;
|
||
}
|
||
var url = imgTopic.ImageUrl;
|
||
if (type_value == "1")
|
||
{
|
||
url = video.Src;
|
||
}
|
||
|
||
|
||
if (string.IsNullOrEmpty(position.Text))
|
||
{
|
||
RadAjaxManager1.Alert("顺序不能为空!");
|
||
return;
|
||
}
|
||
int pos = 0;
|
||
if (!int.TryParse(position.Text, out pos))
|
||
{
|
||
RadAjaxManager1.Alert("顺序值为整数!");
|
||
return;
|
||
}
|
||
DataService.Model.zhc_task_proc_material model = bll.GetModel(Request.Params["Id"]);
|
||
model.name = name.Text.Trim();
|
||
model.type = int.Parse(type.SelectedValue);
|
||
model.url = url;
|
||
|
||
model.position = pos;
|
||
if (bll.Update(model))
|
||
{
|
||
log.write_log("修改素材成功。" + "素材名称:" + name.Text.Trim() + ",ID:" + model.material_id);
|
||
RadAjaxManager1.ResponseScripts.Add("alert('修改成功!');CloseAndRebind();");
|
||
}
|
||
else
|
||
RadAjaxManager1.Alert("修改失败!");
|
||
}
|
||
|
||
protected void btnUpload_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
var uploadFile = RadAsyncUpload1.UploadedFiles[0];
|
||
var upload_type = type.SelectedValue;
|
||
if (upload_type == "0") //图片
|
||
{
|
||
var arrray = new string[] { ".jpg", ".png", ".bmp", ".jpeg" };
|
||
var extension = uploadFile.GetExtension();
|
||
if (!arrray.Contains(extension))
|
||
{
|
||
RadAjaxManager1.Alert("请上传图片!");
|
||
return;
|
||
}
|
||
}
|
||
else if (upload_type == "1") //视频,.mp4,.avi,.dat,.3gp,.mov,.rmvb
|
||
{
|
||
var arrray = new string[] { ".mp4", ".avi", ".dat", ".3gp", ".mov", ".rmvb" };
|
||
var extension = uploadFile.GetExtension();
|
||
if (!arrray.Contains(extension))
|
||
{
|
||
RadAjaxManager1.Alert("请上传视频!");
|
||
return;
|
||
}
|
||
}
|
||
|
||
if (BasePage.SaveFile(uploadFile, Context, out string filePath))
|
||
{
|
||
if (upload_type == "0")
|
||
{
|
||
imgTopic.ImageUrl = "~" + filePath;
|
||
td_pic.Visible = true;
|
||
td_video.Visible = false;
|
||
}
|
||
else
|
||
{
|
||
td_pic.Visible = false;
|
||
td_video.Visible = true;
|
||
video.Src = "~" + filePath;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
RadAjaxManager1.Alert("上传失败!");
|
||
}
|
||
}
|
||
|
||
protected void btnRemove_Click(object sender, EventArgs e)
|
||
{
|
||
if (!string.IsNullOrEmpty(imgTopic.ImageUrl))
|
||
{
|
||
string path = Server.MapPath(imgTopic.ImageUrl);
|
||
if (File.Exists(path))
|
||
{
|
||
File.Delete(path);
|
||
}
|
||
imgTopic.ImageUrl = "";
|
||
}
|
||
if (!string.IsNullOrEmpty(video.Src))
|
||
{
|
||
string path = Server.MapPath(video.Src);
|
||
if (File.Exists(path))
|
||
{
|
||
File.Delete(path);
|
||
}
|
||
video.Src = "";
|
||
}
|
||
}
|
||
*/
|
||
}
|
||
} |