/// <summary> /// Initializes the field. /// </summary> /// <remarks> /// Ranaya, 26/05/2017. /// </remarks> /// <param name="pObjField"> /// The object field. /// </param> private void InitializeField(Models.Field pObjField) { UserFieldsMD lObjUserField = null; try { if (!ExistsField(pObjField.TableName, pObjField.GetAttributes().Name)) { lObjUserField = pObjField.GetUserField(); HandleException.Field(lObjUserField.Add()); } } finally { MemoryUtility.ReleaseComObject(lObjUserField); } }
public List <Models.Field> GetTagDetailIdentifier(string extractedText) { var returnRes = new List <Models.Field>(); try { var filteredTags = GetAll(); var addedTags = new List <string>(); foreach (var tagDetail in filteredTags) { if (Regex.IsMatch(extractedText, tagDetail.NameExpression, RegexOptions.IgnoreCase) && (!addedTags.Contains(tagDetail.NameField))) { var strSplitList = Regex.Split(extractedText, tagDetail.NameExpression, RegexOptions.IgnoreCase); if (strSplitList.Length > 1) { if (Regex.IsMatch(strSplitList[1], tagDetail.ValueExpression, RegexOptions.IgnoreCase)) { var resTag = new Models.Field { name = tagDetail.NameField }; var res = Regex.Match(strSplitList[1], tagDetail.ValueExpression); resTag.values = res.Value; if (!String.IsNullOrEmpty(resTag.values)) { addedTags.Add(tagDetail.NameField); returnRes.Add(resTag); } } } } } } catch (Exception e) { Console.WriteLine(e); } return(returnRes); }
/// <summary> /// update existing field /// </summary> /// <param name="clientid"></param> /// <param name="tbID"></param> /// <param name="fields"></param> /// <returns></returns> public JsonpResult UpdateField(string clientid, string tbID, string fields) { try { ClientServer c = new ClientServer(clientid); Tz.Net.DataManager dataManager = new Net.DataManager(tbID, c.GetServer().ServerID, clientid); Models.Field mField = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.Field>(fields); //if (mField.IsPrimaryKey) //{ // // dataManager.AddPrimarykey(mField.FieldName, mField.FieldType, mField.Length); //} //else //{ dataManager.ChangeField(mField.FieldID, mField.FieldName, mField.FieldType, mField.Length, mField.IsNullable, mField.IsPrimaryKey, mField.NewFieldName); dataManager.AcceptChanges(); // } return(new JsonpResult(dataManager.getTableID())); } catch (System.Exception ex) { throw ex; } }
private static List <StockTable> GetStockTables() { var list = new List <StockTable>(); var tables = XmlManager.GetList("/Tables/Table", XmlEnum.Field); if (tables != null) { var length = 0; for (var i = 0; i < tables.Count; i++) { var table = tables[i]; var stockTable = new StockTable { Name = table.Attributes["Name"].Value, Title = table.Attributes["Title"].Value, IsSpace = table.Attributes["IsSpace"].Value == "true" ? true : false }; if (table.Attributes["Type"] != null) { stockTable.Type = table.Attributes["Type"].Value; } var fields = table.SelectNodes("Field"); if (fields != null) { var ff = new List <Models.Field>(); for (var j = 0; j < fields.Count; j++) { var fi = fields[j]; var str = fi.Attributes["Type"].Value; if (!string.IsNullOrEmpty(str)) { var item = new Models.Field() { Name = fi.Attributes["Name"].Value, Title = fi.Attributes["Title"].Value, Length = int.TryParse(fi.Attributes["Length"].Value, out length) ? length : 0, }; switch (str.ToLower()) { case "int": item.Type = Models.FieldType.Int; break; case "float": item.Type = Models.FieldType.Float; break; case "char": item.Type = Models.FieldType.Char; break; } if (fi.Attributes["Min"] != null && int.TryParse(fi.Attributes["Min"].Value, out length)) { item.Min = length; } ff.Add(item); } } stockTable.Fields = ff; } list.Add(stockTable); } } return(list); }
internal static void Set(this List <Models.Field> list, Models.Field field) { Set(list, field, f => f.Name); }