| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- namespace Pur.ck
- {
- class CkClassCommon
- {
- //激活输入当前值行数据
- /// <summary>
- /// 激活输入当前值行数据
- /// </summary>
- /// <param name="ug">ultragrid</param>
- /// <param name="strColumn">列名</param>
- /// <param name="strKey">列值</param>
- public static string doActiveSelRow(UltraGrid ug, string strColumn, string strKey)
- {
- try
- {
- if (strKey != "")
- {
- foreach (UltraGridRow row in ug.Rows)
- {
- if (row.Cells[strColumn].Text.ToString() == strKey)
- {
- row.Activated = true;
- if (row.ChildBands != null)
- row.Expanded = true;
- }
- }
- }
- return "";
- }
- catch (Exception ex)
- {
- return ex.ToString();
- }
- }
- public static string getYearMouth()
- {
- string NowYearMouth = DateTime.Now.ToString("yyyyMM");
- return NowYearMouth;
- }
- /// <summary>
- /// 绑定combobox
- /// </summary>
- /// <param name="cmbx">控件名</param>
- /// <param name="dset">数据源ds</param>
- /// <param name="strVal">值</param>
- /// <param name="strName">显示名</param>
- /// <param name="filCondition">筛选条件</param>
- /// <param name="tips">是否新增</param>
- /// <param name="addItem">新增itemName</param>
- public static void FilComboboxAdd(UltraComboEditor cmbx, DataTable dt, string strVal, string strName, string filCondition, Boolean tips, String addItemName, String addItemValue)
- {
- if (dt.Columns.Count > 1)
- {
- DataView dvw = dt.DefaultView;
- dvw.RowFilter = filCondition;
- ArrayList aryTmp = new ArrayList();
- if (tips == true)
- {
- aryTmp.Add(new ValueListItem(addItemValue, addItemName));
- }
- for (int i = 0; i < dvw.Count; i++)
- {
- aryTmp.Add(new ValueListItem(dvw[i][strVal].ToString(), dvw[i][strName].ToString()));
- }
- cmbx.DataSource = aryTmp;
- cmbx.DisplayMember = "DisplayText";
- cmbx.ValueMember = "DataValue";
- }
- }
- }
- }
|