You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
206 lines
7.2 KiB
206 lines
7.2 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Drawing;
|
||
|
using System.Windows.Forms;
|
||
|
using QMAPP.Entity;
|
||
|
using QMAPP.FJC.Entity.Equipment;
|
||
|
using QMAPP.FJC.Entity.ODS;
|
||
|
using QMAPP.ServicesAgent;
|
||
|
using QMAPP.WinForm.Common;
|
||
|
using QMAPP.WinForm.Forms.Injection;
|
||
|
using QMFrameWork.Common.Serialization;
|
||
|
using QMFrameWork.Data;
|
||
|
|
||
|
namespace QMAPP.WinForm.Forms.ODS
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 模块编号:M11-3
|
||
|
/// 作 用:视频类型维护
|
||
|
/// 作 者:周晓东
|
||
|
/// 编写日期:2017年11月02日
|
||
|
///</summary>
|
||
|
public partial class VideoTypeForm : Form
|
||
|
{
|
||
|
VideoTypeEntity searchModel = new VideoTypeEntity();//查询条件
|
||
|
public VideoTypeForm()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
}
|
||
|
|
||
|
#region 窗体载入
|
||
|
|
||
|
private void Form_Load(object sender, EventArgs e)
|
||
|
{
|
||
|
#region 绑定下拉列表
|
||
|
//BasicData basicData = new BasicData();
|
||
|
//初始化控件属性
|
||
|
this.DGView.AutoGenerateColumns = false;
|
||
|
//加载所有设备下拉列表
|
||
|
//this.comMachine.DataSource = basicData.GetMachineInfoList(new string[]{}, true);
|
||
|
//this.comMachine.DisplayMember = "MACHINENAME";
|
||
|
//this.comMachine.ValueMember = "MACHINECODDE";
|
||
|
#endregion
|
||
|
|
||
|
//初始化分页
|
||
|
this.pager1.Init();
|
||
|
//加载默认查询条件
|
||
|
SetSearchModel();
|
||
|
BindGirdData();
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 绑定数据
|
||
|
|
||
|
private DataPage BindGirdData()
|
||
|
{
|
||
|
List<VideoTypeEntity> recorders = null;//查询结果列表
|
||
|
DataPage dataPage = new DataPage();
|
||
|
//获取前台分页设置信息
|
||
|
dataPage = pager1.DataPage;
|
||
|
try
|
||
|
{
|
||
|
#region 服务查询
|
||
|
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
||
|
//dataPage = agent.InvokeServiceFunction<DataPage>("VideoTypeBLL_GetDataPageLis", searchModel, dataPage);
|
||
|
DataResult<DataPage> result = agent.InvokeServiceFunction<DataResult<DataPage>>("VideoTypeBLL_GetDataPageList", searchModel, dataPage);
|
||
|
dataPage = result.Result;
|
||
|
recorders = JsonConvertHelper.GetDeserialize<List<VideoTypeEntity>>(dataPage.Result.ToString());
|
||
|
|
||
|
#endregion
|
||
|
this.DGView.DataSource = recorders;
|
||
|
this.pager1.DataPage = dataPage;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
return dataPage;
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
/// <summary>
|
||
|
/// 分页事件
|
||
|
/// </summary>
|
||
|
/// <param name="e"></param>
|
||
|
/// <returns></returns>
|
||
|
private DataPage pager1_EventPaging(Controls.EventPagingArg e)
|
||
|
{
|
||
|
return BindGirdData();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 查询事件
|
||
|
/// </summary>
|
||
|
/// <param name="sender"></param>
|
||
|
/// <param name="e"></param>
|
||
|
private void tsbSearch_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
SetSearchModel();
|
||
|
this.pager1.Init();
|
||
|
BindGirdData();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 设置查询条件
|
||
|
/// </summary>
|
||
|
private void SetSearchModel()
|
||
|
{
|
||
|
//searchModel = new VideoTypeEntity();
|
||
|
////设备
|
||
|
//if (this.comMachine.SelectedValue != null && string.IsNullOrEmpty(this.comMachine.SelectedValue.ToString().Trim()) == false)
|
||
|
//{
|
||
|
// searchModel.MACHINECODDE = this.comMachine.SelectedValue.ToString().Trim();
|
||
|
//}
|
||
|
////开始时间
|
||
|
//if (string.IsNullOrEmpty(this.dtpStart.Text.Trim()) == false)
|
||
|
//{
|
||
|
// searchModel.DOWNTIMESTART = Convert.ToDateTime(this.dtpStart.Text);
|
||
|
//}
|
||
|
////结束时间
|
||
|
//if (string.IsNullOrEmpty(this.dtpEnd.Text.Trim()) == false)
|
||
|
//{
|
||
|
// searchModel.DOWNTIMEEND = Convert.ToDateTime(this.dtpEnd.Text).AddDays(1);
|
||
|
//}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 删除
|
||
|
/// </summary>
|
||
|
/// <param name="sender"></param>
|
||
|
/// <param name="e"></param>
|
||
|
private void tsbDelete_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
|
||
|
if (this.DGView.SelectedRows.Count <= 0)
|
||
|
return;
|
||
|
if (MessageBox.Show(Resource1.ConfirmDelete, Resource1.ConfirmTitle, MessageBoxButtons.OKCancel) != DialogResult.OK)
|
||
|
return;
|
||
|
#region 删除
|
||
|
string selectKey = this.DGView.SelectedRows[0].Cells["PID"].Value.ToString();
|
||
|
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
||
|
//直接删除
|
||
|
DataResult<int> result = agent.InvokeServiceFunction<DataResult<int>>("VideoTypeBLL_Delete", selectKey);
|
||
|
//MessageBox.Show(result.Msg);
|
||
|
if (result.IsSuccess)
|
||
|
{
|
||
|
BindGirdData();
|
||
|
}
|
||
|
#endregion
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 打开维护页面
|
||
|
/// </summary>
|
||
|
/// <param name="sender"></param>
|
||
|
/// <param name="e"></param>
|
||
|
private void tsbAdd_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
VideoTypeEditForm editForm = new VideoTypeEditForm();
|
||
|
DialogResult result = editForm.ShowDialog();
|
||
|
if (result == System.Windows.Forms.DialogResult.OK)//判断是否操作成功
|
||
|
{
|
||
|
this.pager1.Init();
|
||
|
BindGirdData();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 打开维护页面
|
||
|
/// </summary>
|
||
|
/// <param name="sender"></param>
|
||
|
/// <param name="e"></param>
|
||
|
private void tsbEdit_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
if (this.DGView.SelectedRows.Count > 0)
|
||
|
{
|
||
|
string selectID = this.DGView.SelectedRows[0].Cells["PID"].Value.ToString();
|
||
|
//string selectStr = this.DGView.SelectedRows[0].Cells["VideoType"].Value.ToString();
|
||
|
VideoTypeEditForm editForm = new VideoTypeEditForm(selectID);
|
||
|
DialogResult result = editForm.ShowDialog();
|
||
|
if (result == System.Windows.Forms.DialogResult.OK)//判断是否操作成功
|
||
|
{
|
||
|
this.pager1.Init();
|
||
|
BindGirdData();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 行序号
|
||
|
/// </summary>
|
||
|
/// <param name="sender"></param>
|
||
|
/// <param name="e"></param>
|
||
|
private void DG_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
||
|
{
|
||
|
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, this.DGView.RowHeadersWidth - 4, e.RowBounds.Height);
|
||
|
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), new Font("宋体", 12, FontStyle.Bold), rectangle, this.DGView.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
|
||
|
}
|
||
|
|
||
|
private void DGView_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|