using System; using System.Collections.Generic; using System.Linq; using System.Text; using CoreFS.CA06; using System.Data; using System.Collections; using Infragistics.Win; using Core.Mes.Client.Comm.Server; namespace Core.StlMes.Client.YdmBcPipeManage { class ClsLoad { /// ///基础信息 /// /// /// public static DataTable GetValueListDataTable(string pCode, OpeBase ob) { DataTable dt = new DataTable(); ArrayList queryList = new ArrayList(); queryList.Add(pCode); dt = ServerHelper.GetData("com.steering.ydm.bc.BaseOperations.queryBaseConfion", new object[] { queryList }, ob); return dt; } public static DataTable GetValueListDataTable(string[] pCode, OpeBase ob) { DataTable dt = new DataTable(); ArrayList queryList = new ArrayList(); for (int i = 0; i < pCode.Length; i++) { queryList.Add(pCode[i].ToString()); } dt = ServerHelper.GetData("com.steering.ydm.bc.BaseOperations.queryBaseConfion", new object[] { queryList }, ob); return dt; } /// /// 根据指定DataTable生成ValueList /// /// /// value /// Text /// public static ValueList GeneralValuelist(ref DataTable table, string strKey, string strText) { if (table == null || !table.Columns.Contains(strKey) || !table.Columns.Contains(strText)) { return null; } ArrayList alist = new ArrayList(); ValueList vlist = new ValueList(); for (int i = 0; i < table.Rows.Count; i++) { try { if (!alist.Contains(table.Rows[i][strKey])) { alist.Add(table.Rows[i][strKey]); vlist.ValueListItems.Add(table.Rows[i][strKey], Convert.ToString(table.Rows[i][strText])); } } catch { } } return vlist; } /// /// 通过科室查找对应的部门 /// /// 科室ID /// /// 部门名称 public static string GetDepartBySectionId1(string sectionId, OpeBase ob) { DataTable dt = ServerHelper.GetData("com.steering.mes.SendRecive.FrmFilpOutStorage.getDeptBySection", new object[] { sectionId }, ob); if (dt.Rows.Count > 0) { return dt.Rows[0]["DEPARTNAME"].ToString(); } else { return ""; } } /// /// 通过科室查找对应的部门 /// /// 科室ID /// /// 部门名称 public static string GetDepartBySectionId(string sectionId, OpeBase ob) { DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.ComLgValidDataPurviewIds.getDeptBySection", new object[] { sectionId }, ob); if (dt.Rows.Count > 0) { return dt.Rows[0]["DEPARTNAME"].ToString(); } else { return ""; } } /// /// 通过科室查找对应的部门 /// /// 科室ID /// /// 部门ID public static string GetDepartIdBySectionId(string sectionId, OpeBase ob) { DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.ComLgValidDataPurviewIds.getDeptBySection", new object[] { sectionId }, ob); if (dt.Rows.Count > 0) { return dt.Rows[0]["DEPARTID"].ToString(); } else { return ""; } } /// /// 通过科室查找对应的部门 /// /// 科室ID /// /// 部门ID public static string GetDepartIdBySectionId1(string sectionId, OpeBase ob) { DataTable dt = ServerHelper.GetData("com.steering.mes.SendRecive.FrmFilpOutStorage.getDeptBySection", new object[] { sectionId }, ob); if (dt.Rows.Count > 0) { return dt.Rows[0]["DEPARTID"].ToString(); } else { return ""; } } /// /// 将T1 实体的参数复制给 T2 ,不能处理多层次 /// /// /// /// /// public static void CopyModel(T1 a, T2 b) { System.Reflection.PropertyInfo[] cfgItemProperties = a.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public); foreach (System.Reflection.PropertyInfo item in cfgItemProperties) { string name = item.Name; object value = item.GetValue(a, null); //string 或 值属性,且value 不为 null if ((item.PropertyType.IsValueType || item.PropertyType.Name.StartsWith("String")) && value != null && !string.IsNullOrEmpty(value.ToString())) { #region 在MODEL2中查找是否有此参数名,有则赋值 System.Reflection.PropertyInfo[] list2 = b.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public); foreach (System.Reflection.PropertyInfo i2 in list2) { //两者 PropertyType.Name 要相等 if (item.Name == i2.Name && item.PropertyType.Name == i2.PropertyType.Name) { i2.SetValue(b, value, null); } } #endregion } } } /// /// 获取作业类型信息 /// /// 快速索引码,参数数组 /// 界面OB对象 /// //public static DataTable getComTypeInfo(string sortCode, OpeBase ob) //{ // return ServerHelper.GetData("com.steering.pss.ydm.pipemanage.PipeManageClassInfo.queryType", new object[] { sortCode }, ob); //} } }