当前位置: 首页>>代码示例>>C#>>正文


C# FormInfo类代码示例

本文整理汇总了C#中FormInfo的典型用法代码示例。如果您正苦于以下问题:C# FormInfo类的具体用法?C# FormInfo怎么用?C# FormInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FormInfo类属于命名空间,在下文中一共展示了FormInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (BaseInfo == null)
        {
            ShowError(GetString("codegenerator.objectwasnotloaded"));
            txtCode.Visible = false;
            return;
        }

        DataClassInfo dci = GetDataClassInfo();
        if (dci != null)
        {
            mClassName = dci.ClassName;
            string formDefinition = dci.ClassFormDefinition;
            var fi = new FormInfo(formDefinition);
            mCode = GetCode(fi);
            txtCode.Text = mCode;
            HeaderActions.AddAction(new HeaderAction()
            {
                Text = GetString("codegenerator.downloadfile"),
                CommandName = DOWNLOAD_FILE,
                OnClientClick = "window.noProgress = true;"
            });

            HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
        }
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:27,代码来源:GeneratedCodePreview.ascx.cs

示例2: CreateForm

        /// <summary>
        /// CreateForm
        /// </summary>
        /// <param name="formInfo"></param>
        /// <returns></returns>
        public static Form CreateForm(FormInfo formInfo)
        {
            if (formInfo == null)
            {
                throw new ArgumentNullException("formInfo");
            }
            if (string.IsNullOrEmpty(formInfo.ClassName))
            {
                throw new ArgumentException("FormInfo of " + formInfo.Name + " 's ClassName must not be null!");
            }

            Form form = null;
            if (formInfo.ClassName.EndsWith(".py"))
            {
                form = ServiceProvider.GetService<IFileScript>().ExecuteFile(formInfo.ClassName,
                    new Dictionary<string, object> { { "Params", formInfo.Params } }) as Form;
            }
            else
            {
                if (!string.IsNullOrEmpty(formInfo.Params))
                {
                    form =
                        Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.GetTypeFromName(formInfo.ClassName),
                                                                formInfo.Params.Split(new char[] { ';' })) as Form;
                }
                else
                {
                    form =
                        Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.GetTypeFromName(formInfo.ClassName)) as Form;
                }
            }
            return form;
        }
开发者ID:urmilaNominate,项目名称:mERP-framework,代码行数:38,代码来源:ArchiveFormFactory.cs

示例3: GenerateDefinition

    /// <summary>
    /// Generates default form definition.
    /// </summary>
    private void GenerateDefinition()
    {
        // Get info on the class
        var classInfo = DataClassInfoProvider.GetDataClassInfo(QueryHelper.GetInteger("classid", 0));
        if (classInfo == null)
        {
            return;
        }

        var manager = new TableManager(classInfo.ClassConnectionString);

        // Update schema and definition for existing class
        classInfo.ClassXmlSchema = manager.GetXmlSchema(classInfo.ClassTableName);

        var fi = new FormInfo();
        try
        {
            fi.LoadFromDataStructure(classInfo.ClassTableName, manager, true);
        }
        catch (Exception ex)
        {
            // Show error message if something caused unhandled exception
            LogAndShowError("ClassFields", "GenerateDefinition", ex);
            return;
        }

        classInfo.ClassFormDefinition = fi.GetXmlDefinition();
        DataClassInfoProvider.SetDataClassInfo(classInfo);

        URLHelper.Redirect(URLHelper.AddParameterToUrl(RequestContext.CurrentURL, "gen", "1"));
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:34,代码来源:Fields.aspx.cs

示例4: Parse

 internal FormInfo Parse()
 {
     var rslt = new FormInfo();
     rslt.Id = this.Id;
     rslt.DataId = this.DataId;
     return rslt;
 }
开发者ID:koksaver,项目名称:CodeHelper,代码行数:7,代码来源:Form.cs

示例5: OnPreInit

    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        SetCulture();

        IFormatProvider culture = DateTimeHelper.DefaultIFormatProvider;
        IFormatProvider currentCulture = new System.Globalization.CultureInfo(System.Threading.Thread.CurrentThread.CurrentUICulture.IetfLanguageTag);

        reportId = ValidationHelper.GetInteger(Request.QueryString["reportid"], 0);
        ReportInfo ri = ReportInfoProvider.GetReportInfo(reportId);
        if (ri != null)
        {
            string[] httpParameters = ValidationHelper.GetString(Request.QueryString["parameters"], "").Split(";".ToCharArray());

            FormInfo fi = new FormInfo(ri.ReportParameters);
            // Get datarow with required columns
            DataRow dr = fi.GetDataRow();

            if (httpParameters.Length > 1)
            {
                string[] parameters = new string[httpParameters.Length / 2];

                // Put values to given data row
                for (int i = 0; i < httpParameters.Length; i = i + 2)
                {
                    if (dr.Table.Columns.Contains(httpParameters[i]))
                    {
                        if (dr.Table.Columns[httpParameters[i]].DataType != typeof(DateTime))
                        {
                            dr[httpParameters[i]] = httpParameters[i + 1];
                        }
                        else
                        {
                            if (httpParameters[i + 1] != String.Empty)
                            {
                                dr[httpParameters[i]] = Convert.ToDateTime(httpParameters[i + 1], culture).ToString(currentCulture);
                            }
                        }
                    }
                }

                dr.AcceptChanges();

                DisplayReport1.LoadFormParameters = false;
                DisplayReport1.ReportName = ri.ReportName;
                DisplayReport1.DisplayFilter = false;
                DisplayReport1.ReportParameters = dr;
            }
            else
            {
                DisplayReport1.ReportName = ri.ReportName;
                DisplayReport1.DisplayFilter = false;
            }
            this.Page.Title = GetString("Report_Print.lblPrintReport") + " " + ri.ReportDisplayName;
        }
    }
开发者ID:v-jli,项目名称:jean0407large,代码行数:57,代码来源:Report_Print.aspx.cs

示例6: OnLoad

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        var dci = DataClassInfoProvider.GetDataClass(FormClassNames.FirstOrDefault());
        var FormDefinition = dci.ClassFormDefinition;
        var fi = new FormInfo(FormDefinition);

        lstFields.DataSource = fi.ItemsList.Select(x => new ListItem { Text = x.ToString(), Value = x.ToString() }).ToList();
        lstFields.DataBind();
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:10,代码来源:FieldSelector.ascx.cs

示例7: GetFormResolver

    /// <summary>
    /// Returns new instance of resolver for given class (includes all fields, etc.).
    /// </summary>
    /// <param name="formInfo">FormInfo</param>
    private static ContextResolver GetFormResolver(FormInfo formInfo)
    {
        ContextResolver mContextResolver = GetDefaultResolver();

        var controlPlaceholder = new EditingFormControl();
        foreach (var fieldInfo in formInfo.ItemsList.OfType<FormFieldInfo>())
        {
            mContextResolver.SetNamedSourceData(fieldInfo.Name, controlPlaceholder);
        }

        return mContextResolver;
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:16,代码来源:ResolverFactory.cs

示例8: GetCode

    private string GetCode(FormInfo formInfo)
    {
        switch (BaseInfo.TypeInfo.ObjectType)
        {
            case BizFormInfo.OBJECT_TYPE:
                return FormInfoClassGenerator.GetOnlineForm(mClassName, formInfo);

            case DataClassInfo.OBJECT_TYPE_DOCUMENTTYPE:
                return FormInfoClassGenerator.GetDocumentType(mClassName, formInfo);

            case DataClassInfo.OBJECT_TYPE_CUSTOMTABLE:
                return FormInfoClassGenerator.GetCustomTable(mClassName, formInfo);
        }

        return null;
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:16,代码来源:GeneratedCodePreview.ascx.cs

示例9: GenerateCode

    /// <summary>
    /// Generates the web part code.
    /// </summary>
    protected void GenerateCode()
    {
        string templateFile = MapPath("~/App_Data/CodeTemplates/WebPart");
        string baseControl = txtBaseControl.Text.Trim();

        WebPartInfo wpi = WebPartInfoProvider.GetWebPartInfo(webpartId);
        if (wpi != null)
        {
            // Generate the ASCX
            string ascx = File.ReadAllText(templateFile + ".ascx.template");

            // Prepare the path
            string path = URLHelper.UnResolveUrl(WebPartInfoProvider.GetWebPartUrl(wpi), SettingsKeyProvider.ApplicationPath);

            // Prepare the class name
            string className = path.Trim('~', '/');
            if (className.EndsWith(".ascx"))
            {
                className = className.Substring(0, className.Length - 5);
            }
            className = className.Replace("/", "_");

            ascx = Regex.Replace(ascx, "(Inherits)=\"[^\"]+\"", "$1=\"" + className + "\"");
            ascx = Regex.Replace(ascx, "(CodeFile|CodeBehind)=\"[^\"]+\"", "$1=\"" + path + "\"");

            this.txtASCX.Text = ascx;

            // Generate the code
            string code = File.ReadAllText(templateFile + ".ascx.cs.template");

            code = Regex.Replace(code, "( class\\s+)[^\\s]+", "$1" + className);

            // Prepare the properties
            FormInfo fi = new FormInfo(wpi.WebPartProperties);

            StringBuilder sbInit = new StringBuilder();

            string propertiesCode = CodeGenerator.GetPropertiesCode(fi, true, baseControl, sbInit);

            // Replace in code
            code = code.Replace("// ##PROPERTIES##", propertiesCode);
            code = code.Replace("// ##SETUP##", sbInit.ToString());

            this.txtCS.Text = code;
        }
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:49,代码来源:WebPart_Edit_Code.aspx.cs

示例10: btnOK_Click

    protected void btnOK_Click(object sender, EventArgs e)
    {
        // If data are valid
        if (bfParameters.ValidateData())
        {
            // Fill BasicForm with user data
            bfParameters.SaveData(null);
            if (bfParameters.DataRow != null)
            {

                int reportID = QueryHelper.GetInteger("ReportID", 0);
                ReportInfo ri = ReportInfoProvider.GetReportInfo(reportID);
                if (ri == null)
                {
                    return;
                }

                FormInfo fi = new FormInfo(ri.ReportParameters);
                DataRow defaultRow = fi.GetDataRow();
                fi.LoadDefaultValues(defaultRow);

                // Load default parameters to items ,where displayed in edit form not checked
                List<FormItem> items = fi.ItemsList;
                foreach (FormItem item in items)
                {
                    FormFieldInfo ffi = item as FormFieldInfo;
                    if ((ffi != null) && (!ffi.Visible))
                    {
                        bfParameters.DataRow[ffi.Name] = defaultRow[ffi.Name];
                    }
                }

                WindowHelper.Add(hdnGuid.Value, bfParameters.DataRow.Table.DataSet);
            }
            // Refreshh opener update panel script
            ltlScript.Text = ScriptHelper.GetScript("wopener.refresh (); window.close ()");
        }
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:38,代码来源:ReportParametersSelector.aspx.cs

示例11: LoadDataRowFromWidget

    /// <summary>
    /// Loads the data row data from given web part instance.
    /// </summary>
    /// <param name="dr">DataRow to fill</param>
    private void LoadDataRowFromWidget(DataRow dr, FormInfo fi)
    {
        if (widgetInstance != null)
        {
            foreach (DataColumn column in dr.Table.Columns)
            {
                try
                {
                    bool load = true;
                    // switch by xml version
                    switch (xmlVersion)
                    {
                        case 1:
                            load = widgetInstance.Properties.Contains(column.ColumnName.ToLowerCSafe()) || column.ColumnName.EqualsCSafe("webpartcontrolid", true);
                            break;
                        // Version 0
                        default:
                            // Load default value for Boolean type in old XML version
                            if ((column.DataType == typeof(bool)) && !widgetInstance.Properties.Contains(column.ColumnName.ToLowerCSafe()))
                            {
                                FormFieldInfo ffi = fi.GetFormField(column.ColumnName);
                                if (ffi != null)
                                {
                                    widgetInstance.SetValue(column.ColumnName, ffi.GetPropertyValue(FormFieldPropertyEnum.DefaultValue));
                                }
                            }
                            break;
                    }

                    if (load)
                    {
                        object value = widgetInstance.GetValue(column.ColumnName);

                        // Convert value into default format
                        if ((value != null) && (value.ToString() != ""))
                        {
                            if (column.DataType == typeof(decimal))
                            {
                                value = ValidationHelper.GetDouble(value, 0, "en-us");
                            }

                            if (column.DataType == typeof(DateTime))
                            {
                                value = ValidationHelper.GetDateTime(value, DateTime.Now, "en-us");
                            }
                        }

                        DataHelper.SetDataRowValue(dr, column.ColumnName, value);
                    }
                }
                catch
                {
                }
            }
        }
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:60,代码来源:WidgetProperties.ascx.cs

示例12: InitHTMLToobar

 /// <summary>
 /// Initializes the HTML toolbar.
 /// </summary>
 /// <param name="form">Form information</param>
 private void InitHTMLToobar(FormInfo form)
 {
     // Display / hide the HTML editor toolbar area
     if (form.UsesHtmlArea())
     {
         plcToolbar.Visible = true;
     }
 }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:12,代码来源:WidgetProperties.ascx.cs

示例13: CreateMappingPanel

    /// <summary>
    /// Creates and initializes a new instance of the Panel class with the specified Data.com contact mapping, and returns it.
    /// </summary>
    /// <param name="formInfo">The CMS contact form info.</param>
    /// <param name="entityInfo">The Data.com contact entity info.</param>
    /// <param name="mapping">The Data.com contact mapping.</param>
    /// <returns>A new instance of the Panel class initialized with the specified Data.com contact mapping.</returns>
    private Panel CreateMappingPanel(FormInfo formInfo, EntityInfo entityInfo, EntityMapping mapping)
    {
        Panel mappingPanel = new Panel { CssClass = "mapping"};
        mappingPanel.Controls.Add(CreateHeaderPanel());
        foreach (IField formItem in formInfo.ItemsList)
        {
            FormFieldInfo formField = formItem as FormFieldInfo;
            if (formField != null)
            {
                EntityMappingItem mappingItem = mapping.GetItem(formField.Name);
                if (mappingItem != null)
                {
                    EntityAttributeInfo entityAttribute = entityInfo.GetAttributeInfo(mappingItem.EntityAttributeName);
                    if (entityAttribute != null)
                    {
                        Panel row = new Panel { CssClass = "control-group-inline" };
                        mappingPanel.Controls.Add(row);

                        Panel formFieldPanel = new Panel { CssClass = "input-width-60 cms-form-group-text" };
                        row.Controls.Add(formFieldPanel);
                        formFieldPanel.Controls.Add(new Literal { Text = ResHelper.LocalizeString(formField.GetDisplayName(MacroContext.CurrentResolver)) });

                        Panel entityAttributePanel = new Panel { CssClass = "input-width-60 cms-form-group-text" };
                        row.Controls.Add(entityAttributePanel);
                        entityAttributePanel.Controls.Add(new Literal { Text = ResHelper.LocalizeString(entityAttribute.DisplayName) });
                    }
                }
            }
        }

        return mappingPanel;
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:39,代码来源:ContactMapping.ascx.cs

示例14: GenerateProperties

    /// <summary>
    /// Generate properties.
    /// </summary>
    protected void GenerateProperties(FormInfo fi)
    {
        // Generate script to display and hide  properties groups
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ShowHideProperties", ScriptHelper.GetScript(@"
            function ShowHideProperties(id) {
                var obj = document.getElementById(id);
                var objlink = document.getElementById(id+'_link');
                if ((obj != null)&&(objlink != null)){
                   if (obj.style.display == 'none' ) { obj.style.display=''; objlink.innerHTML = '<img border=""0"" src=""" + minImg + @""" >'; }
                   else {obj.style.display='none'; objlink.innerHTML = '<img border=""0"" src=""" + plImg + @""" >';}
                objlink.blur();}}"));

        // Get defintion elements
        var infos = fi.GetFormElements(true, false);

        bool isOpenSubTable = false;
        bool firstLoad = true;
        bool hasAnyProperties = false;

        string currentGuid = "";
        string newCategory = null;

        // Check all items in object array
        foreach (IFormItem contrl in infos)
        {
            // Generate row for form category
            if (contrl is FormCategoryInfo)
            {
                // Load castegory info
                FormCategoryInfo fci = contrl as FormCategoryInfo;
                if (fci != null)
                {
                    if (isOpenSubTable)
                    {
                        ltlProperties.Text += "<tr class=\"PropertyBottom\"><td class=\"PropertyLeftBottom\">&nbsp;</td><td colspan=\"2\" class=\"Center\">&nbsp;</td><td class=\"PropertyRightBottom\">&nbsp;</td></tr></table>";
                        isOpenSubTable = false;
                    }

                    if (currentGuid == "")
                    {
                        currentGuid = Guid.NewGuid().ToString().Replace("-", "_");
                    }

                    // Generate properties content
                    newCategory = @"<br />
                        <table cellpadding=""0"" cellspacing=""0"" class=""CategoryTable"">
                          <tr>
                            <td class=""CategoryLeftBorder"">&nbsp;</td>
                            <td class=""CategoryTextCell"">" + HTMLHelper.HTMLEncode(ResHelper.LocalizeString(fci.CategoryCaption)) + @"</td>
                            <td class=""HiderCell"">
                              <a id=""" + currentGuid + "_link\" href=\"#\" onclick=\"ShowHideProperties('" + currentGuid + @"'); return false;"">
                              <img border=""0"" src=""" + minImg + @""" ></a>
                            </td>
                           <td class=""CategoryRightBorder"">&nbsp;</td>
                         </tr>
                       </table>";
                }
            }
            else
            {
                hasAnyProperties = true;
                // Get form field info
                FormFieldInfo ffi = contrl as FormFieldInfo;

                if (ffi != null)
                {
                    // If display only in dashboard and not dashbord zone (or none for admins) dont show
                    if ((ffi.DisplayIn == "dashboard") && ((zoneType != WidgetZoneTypeEnum.Dashboard) && (zoneType != WidgetZoneTypeEnum.None)))
                    {
                        continue;
                    }
                    if (newCategory != null)
                    {
                        ltlProperties.Text += newCategory;
                        newCategory = null;

                        firstLoad = false;
                    }
                    else if (firstLoad)
                    {
                        if (currentGuid == "")
                        {
                            currentGuid = Guid.NewGuid().ToString().Replace("-", "_");
                        }

                        // Generate properties content
                        firstLoad = false;
                        ltlProperties.Text += @"<br />
                        <table cellpadding=""0"" cellspacing=""0"" class=""CategoryTable"">
                          <tr>
                            <td class=""CategoryLeftBorder"">&nbsp;</td>
                            <td class=""CategoryTextCell"">Default</td>
                            <td class=""HiderCell"">
                               <a id=""" + currentGuid + "_link\" href=\"#\" onclick=\"ShowHideProperties('" + currentGuid + @"'); return false;"">
                               <img border=""0"" src=""" + minImg + @""" ></a>
                            </td>
                            <td class=""CategoryRightBorder"">&nbsp;</td>
//.........这里部分代码省略.........
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:101,代码来源:WebPartDocumentation.ascx.cs

示例15: Import

    /// <summary>
    /// Import files.
    /// </summary>
    private void Import(object parameter)
    {
        try
        {
            object[] parameters = (object[])parameter;
            string[] items = (string[])parameters[0];
            CurrentUserInfo currentUser = (CurrentUserInfo)parameters[3];

            if ((items.Length > 0) && (currentUser != null))
            {
                resultListValues.Clear();
                errorFiles.Clear();
                hdnValue.Value = null;
                hdnSelected.Value = null;
                string siteName = CMSContext.CurrentSiteName;
                string targetAliasPath = ValidationHelper.GetString(parameters[1], null);

                bool imported = false; // Flag - true if one file was imported at least
                bool importError = false; // Flag - true when import failed

                TreeProvider tree = new TreeProvider(currentUser);
                TreeNode tn = tree.SelectSingleNode(siteName, targetAliasPath, TreeProvider.ALL_CULTURES, true, null, false);
                if (tn != null)
                {
                    // Check if CMS.File document type exist and check if document contains required columns (FileName, FileAttachment)
                    DataClassInfo fileClassInfo = DataClassInfoProvider.GetDataClass("CMS.File");
                    if (fileClassInfo == null)
                    {
                        AddError(GetString("newfile.classcmsfileismissing"));
                        return;
                    }
                    else
                    {
                        FormInfo fi = new FormInfo(fileClassInfo.ClassFormDefinition);
                        FormFieldInfo fileFfi = null;
                        FormFieldInfo attachFfi = null;
                        if (fi != null)
                        {
                            fileFfi = fi.GetFormField("FileName");
                            attachFfi = fi.GetFormField("FileAttachment");
                        }
                        if ((fi == null) || (fileFfi == null) || (attachFfi == null))
                        {
                            AddError(GetString("newfile.someofrequiredfieldsmissing"));
                            return;
                        }
                    }

                    DataClassInfo dci = DataClassInfoProvider.GetDataClass(tn.NodeClassName);

                    if (dci != null)
                    {
                        // Check if "file" and "folder" are allowed as a child document under selected document type
                        bool fileAllowed = false;
                        bool folderAllowed = false;
                        DataClassInfo folderClassInfo = DataClassInfoProvider.GetDataClass("CMS.Folder");
                        if ((fileClassInfo != null) || (folderClassInfo != null))
                        {
                            string[] paths;
                            foreach (string fullFileName in items)
                            {
                                paths = fullFileName.Substring(rootPath.Length).Split('\\');
                                // Check file
                                if (paths.Length == 1)
                                {
                                    if (!fileAllowed && (fileClassInfo != null) && !DataClassInfoProvider.IsChildClassAllowed(dci.ClassID, fileClassInfo.ClassID))
                                    {
                                        AddError(GetString("Tools.FileImport.NotAllowedChildClass"));
                                        return;
                                    }
                                    else
                                    {
                                        fileAllowed = true;
                                    }
                                }

                                // Check folder
                                if (paths.Length > 1)
                                {
                                    if (!folderAllowed && (folderClassInfo != null) && !DataClassInfoProvider.IsChildClassAllowed(dci.ClassID, folderClassInfo.ClassID))
                                    {
                                        AddError(GetString("Tools.FileImport.FolderNotAllowedChildClass"));
                                        return;
                                    }
                                    else
                                    {
                                        folderAllowed = true;
                                    }
                                }

                                if (fileAllowed && folderAllowed)
                                {
                                    break;
                                }
                            }
                        }

//.........这里部分代码省略.........
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:101,代码来源:ImportFromServer.aspx.cs


注:本文中的FormInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。