예제 #1
0
 /// <summary>
 /// Assign Tab Index of the field
 /// </summary>
 /// <param name="field">The field whose tab index is to be assigned</param>
 /// <param name="page">The page the field belongs to</param>
 private void AssignTabIndex(Field field, Page page)
 {
     ((RenderableField)field).TabIndex = field.GetMetadata().GetFieldTabIndex(field.Id, field.GetView().Id, page.Id);
 }
예제 #2
0
        /// <summary>
        /// Returns a field as a data row
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        public DataRow GetFieldAsDataRow(Field field)
        {
            string queryString =
                "select F.[FieldId], F.[UniqueId] As UniqueId, F.[Name] As Name, F.[PageId], F.[ViewId], F.[FieldTypeId], F.[CheckCodeAfter] As ControlAfterCheckCode, F.[CheckCodeBefore] As ControlBeforeCheckCode,  " +
                "F.[ControlTopPositionPercentage], F.[ControlLeftPositionPercentage], F.[ControlHeightPercentage], F.[ControlWidthPercentage], " +
                "F.[ControlFontFamily] As ControlFontFamily, F.[ControlFontSize] As ControlFontSize, F.[ControlFontStyle] As ControlFontStyle, F.[ControlScriptName], " +
                "F.[PromptTopPositionPercentage], F.[PromptLeftPositionPercentage], F.[PromptText], F.[PromptFontFamily], F.[PromptFontSize], F.[PromptFontStyle], F.[ControlFontFamily], F.[ControlFontSize], F.[ControlFontStyle], F.[PromptScriptName], " +
                "F.[ShouldRepeatLast], F.[IsRequired], F.[IsReadOnly],  " +
                "F.[ShouldRetainImageSize], F.[Pattern], F.[MaxLength], F.[ShowTextOnRight], " +
                "F.[Lower], F.[Upper], F.[RelateCondition], F.[ShouldReturnToParent], F.[RelatedViewId], " +
                "F.[SourceTableName], F.[CodeColumnName], F.[TextColumnName], " +
                "F.[List], F.[BackgroundColor], " +
                "F.[Sort], F.[IsExclusiveTable], F.[TabIndex], F.[HasTabStop],F.[SourceFieldId], F.[DataTableName] " +
                "from metaFields F where F.[ViewId] = @viewId AND F.[UniqueId] = @uniqueId " +
                "order by F.[ControlTopPositionPercentage], F.[ControlLeftPositionPercentage]";

            Query query = db.CreateQuery(queryString);
            query.Parameters.Add(new QueryParameter("@viewID", DbType.Int32, field.GetView().Id));
            query.Parameters.Add(new QueryParameter("@uniqueId", DbType.Guid, field.UniqueId));

            DataTable table = db.Select(query);
            if (table.Rows.Count > 0)
            {
                return table.Rows[0];
            }

            return null;
        }
예제 #3
0
        /// <summary>
        /// Deletes a field from the xml metadata project file
        /// </summary>
        /// <param name="field">A field object</param>
        public void DeleteField(Field field)
        {
            try
            {
                XmlDocument doc = GetXmlDocument();
                XmlNode fieldsNode = GetFieldsNode(field.GetView().ViewElement);
                XmlNode fieldNode = fieldsNode.SelectSingleNode("//Field[@FieldId= '" + field.Id + "']");
                fieldNode.ParentNode.RemoveChild(fieldNode);

                Save();
            }
            catch (Exception ex)
            {
                throw new GeneralException("Could not delete field in the Xml metadata file", ex);
            }
            finally
            {

            }
        }
예제 #4
0
 /// <summary>
 /// Returns a field's view element
 /// </summary>
 /// <param name="field">The field whose view element is to be obtained</param>
 /// <returns>The view element of the field from the xml project file</returns>
 public XmlElement GetFieldViewElement(Field field)
 {
     XmlNode viewsNode = GetViewsNode();
     XmlNode viewNode = viewsNode.SelectSingleNode("//View[@ViewId= '" + field.GetView().Id + "']");
     XmlElement viewElement = (XmlElement)viewNode;
     return viewElement;
 }
예제 #5
0
 public void SuggestRenameFieldInCollectedData(Field field, string nameBeforeEdit)
 {
     if(TableExists(field.GetView().TableName))
     {
         if (dbDriver.ColumnExists(field.GetView().TableName, nameBeforeEdit))
         {
             RenameColumn(nameBeforeEdit, field.Name);
         }
     }
 }