/// <summary> /// Getting the custom fields data from EquipData table /// </summary> /// <param name="bIsComponent">The boolean argument using for defining owner of data: the Equipment or the its component.</param> /// <param name="iTypeId">The integer argument for defining type of data</param> /// <param name="sContext_User_Identity">The Org string</param> /// <returns>Return the array containing data of custom fields in the clsCustomFieldsDef classes</returns> internal static ArrayList GetCustomFields(CFDataType cfdDataTypeId, int iTypeId, string sContext_User_Identity) { ArrayList arrCFD = null; clsCustomFieldsDef cfd = null; clsCustFields custfield = null; DataTable dtFields = null; try { custfield = new clsCustFields(); arrCFD = new ArrayList(); custfield.iOrgId = GetUserOrgId(sContext_User_Identity, false); custfield.iDataTypeId = (int)cfdDataTypeId; custfield.iComponentTypeID = (SqlInt32)iTypeId; dtFields = custfield.GetCustFields(); if (dtFields.Rows.Count == 0) { return(null); } for (int i = 0; i < dtFields.Rows.Count; i++) { cfd = new clsCustomFieldsDef(); cfd.Id = Convert.ToInt32(dtFields.Rows[i]["Id"]); cfd.NumberColumn = Convert.ToInt32(dtFields.Rows[i]["NumberColumn"]); cfd.Name = Convert.ToString(dtFields.Rows[i]["vchName"]); cfd.NameText = Convert.ToString(dtFields.Rows[i]["vchNameText"]); cfd.NameLookupTable = Convert.ToString(dtFields.Rows[i]["vchNameLookupTable"]); cfd.NameFieldLookup = Convert.ToString(dtFields.Rows[i]["vchNameFieldLookup"]); cfd.Required = Convert.ToBoolean(dtFields.Rows[i]["btRequired"]); cfd.FieldTypeId = (DBFieldType)Convert.ToInt32(dtFields.Rows[i]["intFieldTypeId"]); cfd.Default = Convert.ToString(dtFields.Rows[i]["vchDefault"]); cfd.Help = Convert.ToString(dtFields.Rows[i]["vchHelp"]); arrCFD.Add(cfd); cfd = null; } return(arrCFD); } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { if (custfield != null) { custfield.Dispose(); } } }
/// <summary> /// Getting the custom fields data from EquipData table /// </summary> /// <param name="bIsComponent">The boolean argument using for defining owner of data: the Equipment or the its component.</param> /// <param name="iTypeId">The integer argument for defining type of data</param> /// <param name="sContext_User_Identity">The Org string</param> /// <returns>Return the array containing data of custom fields in the clsCustomFieldsDef classes</returns> public static ArrayList GetCustomFields(CFDataType cfdDataTypeId, int iTypeId, string sContext_User_Identity) { ArrayList arrCFD = null; clsCustomFieldsDef cfd = null; clsCustFields custfield = null; DataTable dtFields = null; try { custfield = new clsCustFields(); arrCFD = new ArrayList(); custfield.iOrgId = GetUserOrgId(sContext_User_Identity, false); custfield.iDataTypeId = (int)cfdDataTypeId; custfield.iComponentTypeID = (SqlInt32)iTypeId; dtFields = custfield.GetCustFields(); if(dtFields.Rows.Count == 0) { return null; } for(int i = 0; i < dtFields.Rows.Count; i++) { cfd = new clsCustomFieldsDef(); cfd.Id = Convert.ToInt32(dtFields.Rows[i]["Id"]); cfd.NumberColumn = Convert.ToInt32(dtFields.Rows[i]["NumberColumn"]); cfd.Name = Convert.ToString(dtFields.Rows[i]["vchName"]); cfd.NameText = Convert.ToString(dtFields.Rows[i]["vchNameText"]); cfd.NameLookupTable = Convert.ToString(dtFields.Rows[i]["vchNameLookupTable"]); cfd.NameFieldLookup = Convert.ToString(dtFields.Rows[i]["vchNameFieldLookup"]); cfd.Required = Convert.ToBoolean(dtFields.Rows[i]["btRequired"]); cfd.FieldTypeId = (DBFieldType)Convert.ToInt32(dtFields.Rows[i]["intFieldTypeId"]); cfd.Default = Convert.ToString(dtFields.Rows[i]["vchDefault"]); cfd.Help = Convert.ToString(dtFields.Rows[i]["vchHelp"]); arrCFD.Add(cfd); cfd = null; } return arrCFD; } catch(Exception ex) { throw new Exception(ex.Message, ex); } finally { if(custfield != null) { custfield.Dispose(); } } }