RepositoryItemComboBox rcboFormat = new RepositoryItemComboBox();//new一个控件
gdcFieldPrompt.RepositoryItems.Add(rcboFormat);//将控件添加到GridControl中的Items
DevGridControlHelper.BindData(gdcFieldPrompt, dtFieldPrompt);//GridControl绑定数据后
gdvFieldPrompt.Columns[0].OptionsColumn.AllowEdit = false;
gdvFieldPrompt.Columns[2].ColumnEdit = rcboFormat;//添加控件
gdvFieldPrompt.Columns[3].ColumnEdit = rspnSize;
gdvFieldPrompt.Columns[4].ColumnEdit = rcboTable;
gdvFieldPrompt.Columns[5].ColumnEdit = rcboTableColumn;
===============
服务器保存时间至Oracle数据库时直接保存即可:
//StringBuilder cc =new StringBuilder();
//for (int j = 0; j < sIntlckEndTime.Length; j++)
//{
// char c = sIntlckEndTime[j];
// if (c != '/' && c != ' ' && c != ':')
// {
// cc.Append(c);
// }
//}
//sIntlckEndTime = cc.ToString();
客户端取出时间并进行格式转换:
string sIntlckStartTime = CommonFunction.ToStandardTime((DateTime)gdvMailGroupUser.GetRowCellValue(iUsers[i], "INTLCK_START_TIME"), GlobalConstant.SYS_CONVERT_DATETIME_FORMAT);
list_item.AddString("INTLCK_START_TIME", sIntlckStartTime);
===================
GridView复选框,取消选择行时,清空列的值
private void gdvMailGroupUser_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
{
//e.ControllerRow,获取改变行,gdvMailGroupUser.Columns[""],要改变值的列,列名,false为该列的值
if (!gdvMailGroupUser.IsRowSelected(e.ControllerRow))
{
gdvMailGroupUser.SetRowCellValue(e.ControllerRow, gdvMailGroupUser.Columns["INTLCK_EMAIL_FLAG"], false);
gdvMailGroupUser.SetRowCellValue(e.ControllerRow, gdvMailGroupUser.Columns["INTLCK_SMS_FLAG"], false);
gdvMailGroupUser.SetRowCellValue(e.ControllerRow, gdvMailGroupUser.Columns["INTLCK_START_TIME"], "");
gdvMailGroupUser.SetRowCellValue(e.ControllerRow, gdvMailGroupUser.Columns["INTLCK_END_TIME"], "");
}
}
=================================
给某一列添加数字(repositoryItemSpinEdit1)控件、下拉(repositoryItemComboBox)控件。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using MESCore;
using TRSCore;
using MESCore.ListRoutines;
using DevExpress.XtraEditors.Repository;
namespace FDCCore
{
public partial class frmFDCSpecModelSetup : BaseFormEdit, IBaseFormFunc
{
public frmFDCSpecModelSetup()
{
InitializeComponent();
}
public frmFDCSpecModelSetup(string FormName, string[] TableKeys)
{
InitializeComponent();
this.saTableKeys = TableKeys;
this.Text = FormName;
}
#region Variable
private bool mbLoadFlag = false;
private string[] saTableKeys;
string sResId = "";
#endregion
#region Function
public Control GetFisrtFocusItem()
{
try
{
return this.tabMain;
}
catch (Exception ex)
{
CommonFunction.ShowMsgBox(ex.Message);
return null;
}
}
/*
private void ClearData(string ProcStep)
{
try
{
if (ProcStep == "1")
{
CommonFunction.FieldClear(this.pnlRight);
}
else if (ProcStep == "2")
{
CommonFunction.ClearList(lstOperation, true);
}
}
catch (Exception ex)
{
CommonFunction.ShowMsgBox(ex.Message);
}
}
*/
RepositoryItemSpinEdit repositoryItemSpinEdit1 = new RepositoryItemSpinEdit();
RepositoryItemSpinEdit repositoryItemSpinEdit2 = new RepositoryItemSpinEdit();
RepositoryItemComboBox repositoryItemComboBox = new RepositoryItemComboBox();
private void InitControl()
{
try
{
repositoryItemSpinEdit1.IsFloatValue = false;
repositoryItemSpinEdit2.IsFloatValue = true;
repositoryItemComboBox.Items.Add("N/A");
repositoryItemComboBox.Items.Add("ALARM");
repositoryItemComboBox.Items.Add("HOLD");
repositoryItemComboBox.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
if (saTableKeys[3]== "Model_Group_Create")
{
txtSpecRawId.Enabled = true;
gluProductID.Enabled = true;
gluRecipeID.Enabled = true;
gluStepID.Enabled = true;
gluParaDisplayName.Enabled = true;
gluSpecUnit.Enabled = true;
gluSpecType.Enabled = true;
gluSpecModelGroupID.Enabled = true;
gluFdType.Enabled = true;
txtCttSpecID.Enabled = true;
cheAutoSpecEnabledFlag.Enabled = true;
cheIdleCheckFlag.Enabled = true;
cheInputType.Enabled = true;
}
if (saTableKeys[3] == "Model_Group_Edit")
{
gluProductID.Enabled = false;
gluRecipeID.Enabled = false;
gluStepID.Enabled = false;
gluParaDisplayName.Enabled = false;
gluSpecUnit.Enabled = false;
gluSpecType.Enabled = false;
gluSpecModelGroupID.Enabled = false;
gluFdType.Enabled = false;
txtCttSpecID.Enabled = false;
cheAutoSpecEnabledFlag.Enabled = false;
cheIdleCheckFlag.Enabled = false;
cheInputType.Enabled = false;
}
}
catch (Exception ex)
{
CommonFunction.ShowMsgBox(ex.Message);
}
}
private bool CheckCondition(string FuncName, char ProcStep)
{
try
{
switch (CommonFunction.Trim(FuncName))
{
case "Create_Spec_Model_Group":
if (txtSpecRawId.Text == "")
{
CommonFunction.ShowMsgBox(CommonFunction.GetMessage(108));
txtSpecRawId.Focus();
return false;
}
if (CommonFunction.CheckValue(txtSpecRawId,CHECK_VALUE_TYPE.Numeric) ==false)
{
return false;
}
if (gluResId.Text =="" )
{
CommonFunction.ShowMsgBox(CommonFunction.GetMessage(108));
gluResId.Focus();
return false;
}
if (gluProductID.Text == "")
{
CommonFunction.ShowMsgBox(CommonFunction.GetMessage(108));
gluProductID.Focus();
return false;
}
if (gluRecipeID.Text == "")
{
CommonFunction.ShowMsgBox(CommonFunction.GetMessage(108));
gluRecipeID.Focus();
return false;
}
if (gluStepID.Text == "")
{
CommonFunction.ShowMsgBox(CommonFunction.GetMessage(108));
gluStepID.Focus();
return false;
}
if (gluParaDisplayName.Text == "")
{
CommonFunction.ShowMsgBox(CommonFunction.GetMessage(108));
gluParaDisplayName.Focus();
return false;
}
if (gluSpecUnit.Text == "")
{
CommonFunction.ShowMsgBox(CommonFunction.GetMessage(108));
gluParaDisplayName.Focus();
return false;
}
if (gluSpecType.Text == "")
{
CommonFunction.ShowMsgBox(CommonFunction.GetMessage(108));
gluSpecType.Focus();
return false;
}
if (gluSpecModelGroupID.Text == "")
{
CommonFunction.ShowMsgBox(CommonFunction.GetMessage(108));
gluSpecModelGroupID.Focus();
return false;
}
if (gluFdType.Text == "")
{
CommonFunction.ShowMsgBox(CommonFunction.GetMessage(108));
gluFdType.Focus();
return false;
}
switch (CommonFunction.ToChar(CommonFunction.Trim(ProcStep)))
{
case GlobalConstant.SYS_STEP_CREATE:
case GlobalConstant.SYS_STEP_UPDATE:
break;
case GlobalConstant.SYS_STEP_DELETE:
return true;
}
break;
case "Update_Spec_Model_Group":
if (txtSpecRawId.Text == "")
{
CommonFunction.ShowMsgBox(CommonFunction.GetMessage(108));
txtSpecRawId.Focus();
return false;
}
switch (CommonFunction.ToChar(CommonFunction.Trim(ProcStep)))
{
case GlobalConstant.SYS_STEP_CREATE:
case GlobalConstant.SYS_STEP_UPDATE:
break;
case GlobalConstant.SYS_STEP_DELETE:
return true;
}
break;
case "Update_Item_List":
DataTable dt = (DataTable)gdcMultiSpec.DataSource;
foreach (DataRow dr in dt.Rows)
{
if (dr.RowState != DataRowState.Deleted)
{
double d = double.MinValue;
double[] dSpec = new double[7];
if (dr["SPEC_SEQ"].ToString().Trim() == ""|| dr["SPEC_SEQ"] is DBNull)
{
CommonFunction.ShowMsgBox(CommonFunction.GetMessage(108));
return false;
}
else
{
if (Convert.ToInt32(dr["SPEC_SEQ"]) < 0)
{
CommonFunction.ShowMsgBox("SPEC_SEQ:必须是大于等于0的整数!");
return false;
}
}
if (!(dr["BAND_ORDER"]is DBNull) &&Convert.ToInt32(dr["BAND_ORDER"]) < 0)
{
CommonFunction.ShowMsgBox("BAND_ORDER:必须是大于等于0的整数!");
return false;
}
if (dr["TARGET"] is DBNull)
{
dSpec[3] = double.MinValue;
}
else
{
if (double.TryParse(dr["TARGET"].ToString(), out d))
{
dSpec[3] = d;
}
else
{
CommonFunction.ShowMsgBox("TARGET:必须是数字!");
return false;
}
}
if (dr["UHL"] is DBNull)
{
dSpec[6] = double.MinValue;
}
else
{
if (double.TryParse(dr["UHL"].ToString(), out d))
{
dSpec[6] = d;
}
else
{
CommonFunction.ShowMsgBox("UHL:必须是数字!");
return false;
}
}
if (dr["USL"] is DBNull)
{
dSpec[5] = double.MinValue;
}
else