using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CoreFS.CA06;
using Core.Mes.Client.Comm.Control;
using Infragistics.Win.UltraWinGrid;
using Core.Mes.Client.Comm.Tool;
namespace Core.StlMes.Client.SaleOrder.ReviewForm
{
public partial class FrmOrderPrdcrBack : FrmBase
{
public FrmOrderPrdcrBack()
{
InitializeComponent();
}
private DataTable dt = new DataTable();
public DataTable Dt
{
get { return dt; }
set { dt = value; }
}
private void FrmOrderPrdcrBack_Load(object sender, EventArgs e)
{
GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
}
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
switch (e.Tool.Key)
{
case "Confirm":
Confirm();
break;
case "Close":
ExitForm();
break;
}
}
private void Confirm()
{
ultraGrid1.UpdateData();
if (HasFailRsn())
{
MessageUtil.ShowWarning("请将回退原因维护完整!");
return;
}
this.Dt = dataTable1;
this.DialogResult = DialogResult.OK;
}
private void ExitForm()
{
this.Close();
}
///
/// 是否存在失败原因 True 存在 False 未填入
///
///
private bool HasFailRsn()
{
ultraGrid1.UpdateData();
foreach (UltraGridRow row in ultraGrid1.Rows)
{
if (row.Cells["FAIL_RSN"].Value.ToString() == "")
{
return true;
}
}
return false;
}
private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
{
UltraGridRow ugr = ultraGrid1.ActiveRow;
if (ugr == null)
return;
for (int i = 0; i < ugr.Cells.Count; i++)
{
if (!ugr.Cells[i].Column.Key.Equals("FAIL_RSN"))
ugr.Cells[i].Activation = Activation.ActivateOnly;
}
}
}
}