Example #1
0
        public static IHtmlContent Control <TBuilder>(this IHtmlHelper htmlHelper, Action <TBuilder> configAction,
                                                      TBuilder builder, INonTypedControlRenderer renderer, ControlConfig config, IHtmlContent htmlContent)
        {
            FormConfig formConfig = htmlHelper.ViewBag.FormConfig as FormConfig;

            if (htmlHelper == null)
            {
                throw new ArgumentNullException(nameof(htmlHelper));
            }
            if (formConfig == null)
            {
                throw new InvalidOperationException("Control must be placed inside an MVC Core Bootstrap form");
            }

            config.ColumnWidths = formConfig.ColumnWidths;
            config.PropertyValidationMessages = formConfig.PropertyValidationMessages;
            configAction?.Invoke(builder);

            return(renderer.Render(htmlContent, htmlHelper));
        }
Example #2
0
        public GUI_SocialPolicy(Client client, SceneGame sceneGame, Canvas canvas)
        {
            // load the form config
            formConfig     = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Game/SocialPolicy"));
            this.client    = client;
            this.sceneGame = sceneGame;
            this.canvas    = canvas;

            client.PlayerUpdated += (s, a) =>
            {
                if (Visible)
                {
                    Show();
                }
            };

            // load sprites
            policyLockedSprite   = Engine.Instance.Content.GetAsset <Sprite>("Core:Textures/Interface/Tech_Locked");
            policyUnlockedSprite = Engine.Instance.Content.GetAsset <Sprite>("Core:Textures/Interface/Tech_Unlocked");
            policyAdoptable      = Engine.Instance.Content.GetAsset <Sprite>("Core:Textures/Interface/Tech_Selectedable");
        }
Example #3
0
        public ActionResult SaveFormConfig(int?id)
        {
            FormConfig model = null;

            if (id.HasValue)
            {
                model = _IFormDesign.GetFormConfig(id.Value);
                if (model == null)
                {
                    return(Alert("表单配置不存在!"));
                }
            }
            else
            {
                model = new FormConfig();
            }
            ViewBag.TableName = _IFormDesign.GetDBTableAndView();
            ViewData["FieldTemplateGroupId"] = new SelectList(_IFormDesign.GetFieldTemplateGroup(), "Id", "Name", model.FieldTemplateGroupId);
            ViewData["FormTemplateId"]       = new SelectList(_IFormDesign.GetFormTemplate(), "Id", "Name", model.FormTemplateId);
            return(View(model));
        }
        public static void testFile()
        {
            if (Directory.Exists(ClassConstantes.Table.InitialDirectory) == true)
            {
            }

            else
            {
                Directory.CreateDirectory(ClassConstantes.Table.InitialDirectory);
            }

            if (File.Exists(ClassConstantes.Table.chemin) == true)
            {
                //connec = File.ReadAllText("C:\\cheminBdCredit\\monChemin.txt");
            }
            else
            {
                FormConfig frm = new FormConfig();
                frm.ShowDialog();
            }
        }
Example #5
0
        private ColumnRightConfig GetColumnRight(FormConfig form, DataFormConfig dataForm, ModuleConfig moduleConfig, PageStyle pagestyle)
        {
            ColumnRightConfig columnRight     = null;
            string            columnRightname = form.FormColumnRight.Name;

            if (form.FormColumnRight.RegName.IsEmpty())
            {
                //Debug.AssertArgumentNullOrEmpty(columnRightname, "FormColumnRight中若没指定RegName,Name属性不能为空", moduleConfig);

                columnRight = moduleConfig.Right.ColumnRights.FirstOrDefault(a => a.Name == columnRightname);
                //Debug.AssertArgumentNull(columnRight, string.Format("ModuleXml中必须配置名为'{0}'的ColumnRight", columnRightname), moduleConfig);
            }
            else
            {
                IColumnRight columnRightPlug = provider.GetCodePlugService <IColumnRight>(form.FormColumnRight.RegName); //form.FormColumnRight.RegName.CodePlugIn<IColumnRight>();
                columnRightname = columnRightPlug.GetColumnRightName();
                columnRight     = moduleConfig.Right.ColumnRights.FirstOrDefault(a => a.Name == columnRightname);
                //Debug.AssertArgumentNull(columnRight, string.Format("ModuleXml中必须配置名为'{0}'的ColumnRight", columnRightname), moduleConfig);
            }
            return(columnRight);
        }
Example #6
0
        /// <summary>
        /// Formが閉じられる時に発生するイベントメソッド
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                e.Cancel = true;
                Hide();
                return;
            }

            // フォームデータ保存
            FormConfig formConfig = new FormConfig
            {
                excludeOwnerComment = excludeOwnerComment.Checked,
                No2AsNo1Comment     = No2AsNo1Comment.Checked,
                ReplyCommentToggle  = ReplyCommentToggle.Checked,
                ReplyCommentText    = ReplyCommentTextBox.Text
            };

            AppConfigIO.SaveFormData(_Host.DirectoryPathAppSetting, formConfig);
            // 履歴データ保存
            AppConfigIO.SaveHistoryData(_Host.DirectoryPathAppSetting, _HistoryDataList);
        }
Example #7
0
        private static IHtmlContent CheckBoxFor <TModel>(this IHtmlHelper <TModel> htmlHelper,
                                                         Expression <Func <TModel, bool> > expression, Action <MvcCoreBootstrapCheckBoxBuilder> configAction,
                                                         CheckBoxConfig config)
        {
            FormConfig formConfig = htmlHelper.ViewBag.FormConfig as FormConfig;

            Debug.Assert(formConfig != null);
            if (htmlHelper == null)
            {
                throw new ArgumentNullException(nameof(htmlHelper));
            }
            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            config.ColumnWidths = formConfig.ColumnWidths;
            config.PropertyValidationMessages = formConfig.PropertyValidationMessages;
            configAction?.Invoke(new MvcCoreBootstrapCheckBoxBuilder(config));

            return(new CheckBoxRenderer(config, new TooltipRenderer()).Render(htmlHelper, expression));
        }
Example #8
0
        public void MergeColumns(FormConfig form, DataFormConfig dataForm, ModuleConfig moduleConfig, PageStyle pagestyle, out List <ColumnConfig> fullColumns)
        {
            if (form.FormColumnRight != null)
            {
                ColumnRightConfig columnRight = GetColumnRight(form, dataForm, moduleConfig, pagestyle);
                if (columnRight.Delete != null)
                {
                    columnRight.Delete.ForEach(dCol =>
                    {
                        var col = dataForm.Columns.FirstOrDefault(baseCol => baseCol.Name.Equals(dCol.Name, StringComparison.OrdinalIgnoreCase));
                        if (col != null)
                        {
                            dataForm.Columns.Remove(col);
                        }
                    });
                }
                if (columnRight.Override != null)
                {
                    columnRight.Override.ForEach(oCol =>
                    {
                        var col = dataForm.Columns.FirstOrDefault(baseCol => baseCol.Name.Equals(oCol.BaseColumnName, StringComparison.OrdinalIgnoreCase));
                        if (col != null)
                        {
                            AssignColumn(oCol, col);
                        }
                    });
                }
                if (columnRight.Add != null)
                {
                    dataForm.Columns.AddRange(columnRight.Add);
                }
            }

            fullColumns = new List <ColumnConfig>();

            fullColumns = dataForm.Columns;

            dataForm.Columns = dataForm.Columns.Where(a => a.ShowPage.HasFlag(pagestyle)).ToList();
        }
Example #9
0
        public JsonResult SaveForm()
        {
            var dic = Request.Form["formData"].JsonToObject <Dictionary <string, object> >();

            if (string.IsNullOrEmpty(dic.GetValue("Id")))
            {
                FormConfig cForm = ConvertHelper.ConvertToObj <FormConfig>(dic);
                cForm.Id = GuidHelper.CreateTimeOrderID();
                cForm.ReCreateCtrl();
                UnitOfWork.Add(cForm);
            }
            else
            {
                FormConfig cForm = UnitOfWork.GetByKey <FormConfig>(dic.GetValue("Id"));
                ConvertHelper.UpdateEntity(cForm, dic, true, "CtrlSetting", "LayOutSetting");
                UnitOfWork.UpdateEntity(cForm);
            }

            bool b = UnitOfWork.Commit();

            return(Json(b));
        }
Example #10
0
        // sets up the main for
        private void SetUpMainForm()
        {
            lock (_lock_guiSetUp)
            {
                // load the form config
                FormConfig formConfig = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Menu/Main"));
                // setup the form
                canvas.RemoveChild(frm_main);
                frm_main = new Form(formConfig, canvas);
                frm_main.CentreControl();

                // get and setup the form elements
                Button btnHost = (Button)frm_main.GetChildByName("btnHost");
                btnHost.MouseClick += Main_BtnHost_MouseClick;
                Button btnJoin = (Button)frm_main.GetChildByName("btnJoin");
                btnJoin.MouseClick += Main_BtnJoin_MouseClick;
                Button btnOptions = (Button)frm_main.GetChildByName("btnOptions");
                btnOptions.MouseClick += Main_BtnOptions_MouseClick;
                Button btnQuit = (Button)frm_main.GetChildByName("btnQuit");
                btnQuit.MouseClick += Main_BtnQuit_MouseClick;
            }
        }
Example #11
0
        /// <summary>
        /// フォームデータ保存
        /// </summary>
        /// <param name="saveDirectoryPath">保存先パス</param>
        /// <param name="formConfig">フォームデータ</param>
        /// <returns></returns>
        public static bool SaveFormData(string saveDirectoryPath, FormConfig formConfig)
        {
            string settingDirectory = $"{saveDirectoryPath}\\{SETTING_FOLDER_NAME}";
            string filePath         = $"{settingDirectory}\\{FORM_DATA_FILE_NAME}";

            try
            {
                // フォルダ生成
                if (!Directory.Exists(settingDirectory))
                {
                    Directory.CreateDirectory(settingDirectory);
                }


                using (var fs = new FileStream(filePath, FileMode.Create))
                    using (var jw = JsonReaderWriterFactory.CreateJsonWriter(fs, Encoding.UTF8, true, true, "    "))
                    {
                        DataContractJsonSerializerSettings serSetting = new DataContractJsonSerializerSettings
                        {
                            UseSimpleDictionaryFormat = true,
                            DateTimeFormat            = new DateTimeFormat("yyyy-MM-dd HH:mm:ss")
                        };
                        DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(FormConfig), serSetting);

                        ser.WriteObject(jw, formConfig);
                        jw.Flush();
                    }
            }
            catch
            {
                // TODO: 例外処理
                // 報告しやすい(してもらいやすい)形式で出力する

                return(false);
            }

            return(true);
        }
Example #12
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="host">プラグインホスト</param>
        public MainForm(IPluginHost host)
        {
            InitializeComponent();

            _Host = host;

            // フォームデータ読み込み
            FormConfig formConfig = AppConfigIO.LoadFormData(_Host.DirectoryPathAppSetting);

            if (formConfig != null)
            {
                excludeOwnerComment.Checked = formConfig.excludeOwnerComment;
                No2AsNo1Comment.Checked     = formConfig.No2AsNo1Comment;
                ReplyCommentToggle.Checked  = formConfig.ReplyCommentToggle;
                ReplyCommentTextBox.Text    = formConfig.ReplyCommentText;
            }
            // 履歴データ読み込み
            _HistoryDataList       = AppConfigIO.LoadHistoryData(_Host.DirectoryPathAppSetting);
            HistoryView.DataSource = _HistoryDataList;

            // イベント設定
            _Host.ReceivedComment += new ReceivedCommentEventHandler(_Host_ReceivedComment);
        }
Example #13
0
 private void SetUpJoinGameForm()
 {
     lock (_lock_guiSetUp)
     {
         if (getWANcancellationToken != null)
         {
             getWANcancellationToken.Cancel();
         }
         FormConfig formConfig = FormConfig.FromStream(Engine.Instance.Content.GetAsset <Stream>("Core:XML/Interface/Menu/Join"));
         canvas.RemoveChild(frm_joinGame);
         frm_joinGame          = new Form(formConfig, canvas);
         frm_joinGame.Location = new Point(GraphicsManager.Instance.Viewport.Width / 2 - frm_joinGame.Size.Width / 2, GraphicsManager.Instance.Viewport.Height / 2 - frm_joinGame.Size.Height / 2);
         tbAddress             = (TextBox)frm_joinGame.GetChildByName("tbAddress");
         tbAddress.Text        = ConfigManager.Instance.GetVar(CONFIG_NET_CLIENT_ADDRESS);
         tbUsername            = (TextBox)frm_joinGame.GetChildByName("tbUsername");
         tbUsername.Text       = Environment.MachineName;
         tbPassword            = (TextBox)frm_joinGame.GetChildByName("tbPassword");
         tbPassword.Text       = "dog";
         Button btnBack = (Button)frm_joinGame.GetChildByName("btnBack");
         btnBack.MouseClick += Join_BtnBack_MouseClick;
         Button btnJoin = (Button)frm_joinGame.GetChildByName("btnJoin");
         btnJoin.MouseClick += Join_BtnJoin_MouseClick;
     }
 }
Example #14
0
 public IHttpActionResult InfusionSoftSetCampain(SetCampainRequest data)
 {
     try
     {
         FormConfig frmConfig = new FormConfig()
         {
             LandingPageId = data.LandingPageId,
             IntegrationId = data.IntegrationId,
             ListId        = data.Id,
             ListName      = data.Name
         };
         _uow.FormConfig.IU(frmConfig);
         return(Ok());
     }
     catch (BusinessException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch (Exception ex)
     {
         _log.Error(ex);
         return(BadRequest(this.General_Err));
     }
 }
 public FormRenderer(FormParameters parameters)
 {
     _parameters = parameters;
     _config     = _parameters.Config;
     _htmlHelper = parameters.HtmlHelper;
 }
Example #16
0
        private void configToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormConfig configForm = new FormConfig();

            configForm.ShowDialog(this);
        }
Example #17
0
        protected virtual void FillDataSet(FormConfig fc)
        {
            IListDataTable dt = provider.GetCodePlugService <IListDataTable>(fc.DataPlug); //fc.DataPlug.InstanceByPage<IListDataTable>(fc.Name);

            dt.PageStyle = PageStyle;
            var dataForm = XmlUtil.PlugGetXml <DataFormConfig>(fc.File); //fc.File.InstanceByPage<DataFormConfig>(fc.Name);
            var keyCols  = dataForm.Columns.Where(a => a.IsKey);

            if (keyCols != null)
            {
                //Debug.Assert(keyCols.ToList().Count == 1, string.Format("{0}只能指定一个主键", fc.File), dataForm);
                if (dataForm.PrimaryKey.IsEmpty())
                {
                    dataForm.PrimaryKey = dataForm.Columns.First(col => col.IsKey).Name;
                }
            }
            MergeColumns(fc, dataForm, ModuleConfig);
            //dt.Initialize(this.PostDataSet, ModuleConfig.PageSize, KeyValue, ForeignKeyValue, fc.TableName, dataForm.PrimaryKey);
            int pageSize = 0;

            if (fc.Pager != null)
            {
                pageSize = fc.Pager.PageSize;
            }
            string foreignKey = GetForeignKey(fc);

            if (!foreignKey.IsEmpty())
            {
                string _foreignKeyValue = KeyValue;
                var    _relations1      = this.ModuleConfig.Relations.Where(a => a.DetailForm == fc.Name).ToList();
                if (_relations1.Count > 0)
                {
                    var    _ra           = _relations1.First();
                    string __relationKey = "_foreignkey_{0}_{1}".SFormat(_ra.MasterForm, _ra.MasterField);
                    //if (AppContext.Current.GetItem(__relationKey) != null)
                    //{
                    //    _foreignKeyValue = AppContext.Current.GetItem(__relationKey).ToString();
                    //}
                    //else
                    //{
                    _foreignKeyValue = KeyValue;
                    //}
                }

                dt.Initialize(new ModuleFormInfo(this.PostDataSet, pageSize, KeyValue, _foreignKeyValue,
                                                 fc.TableName, dataForm.PrimaryKey, foreignKey, IsFillEmpty, dataForm, fc.OrderSql, fc));
            }
            else
            {
                dt.Initialize(new ModuleFormInfo(this.PostDataSet, pageSize, KeyValue, "", fc.TableName,
                                                 dataForm.PrimaryKey, "", IsFillEmpty, dataForm, fc.OrderSql, fc));
            }

            //  if(this.ModuleConfig.Relations.Find(a=>a.MasterForm == fc.Name))
            var _relations = this.ModuleConfig.Relations.Where(a => a.MasterForm == fc.Name).ToList();

            if (dt.List.Count() > 0)
            {
                var row = dt.List.ToList()[0];
                if (_relations.Count > 0)
                {
                    _relations.ForEach((_relation) =>
                    {
                        string _key          = _relation.MasterField;
                        object _value        = row.Row[_key];
                        string __relationKey = "_foreignkey_{0}_{1}".SFormat(_relation.MasterForm, _relation.MasterField);
                        // AppContext.Current.SetItem(__relationKey, _value);
                    });
                }
            }

            if (PageStyle != PageStyle.Insert)
            {
                var _list  = dt.List;
                var __list = _list.ToList();
                __list.ForEach(a =>
                {
                    if (!fc.ButtonRightPlug.IsEmpty())
                    {
                        var gh         = provider.GetCodePlugService <IButtonRight>(fc.ButtonRightPlug);// fc.ButtonRightPlug.CodePlugIn<IButtonRight>();
                        var buttons    = gh.GetButtons(a, dt.List);
                        a.BUTTON_RIGHT = SetDataBtnFilterButtonConfig(buttons);
                    }
                    if (fc.HasReview)
                    {
                        a.BUTTON_RIGHT = a.BUTTON_RIGHT + "|Review";
                    }
                });

                dt.AppendTo(this.BasePageView.Data);
                //给数据源添加虚拟字段
                var dataTable = this.BasePageView.Data.Tables[dt.CodePlugName];
                if (dataTable != null)
                {
                    var virtualCols = dataForm.Columns.Where(a => a.Kind == ColumnKind.Virtual && !a.SourceName.IsEmpty());
                    if (virtualCols != null)
                    {
                        foreach (var col in virtualCols)
                        {
                            dataTable.Columns.Add(col.Name);
                            foreach (DataRow row in dataTable.Rows)
                            {
                                row[col.Name] = row[col.SourceName].ToString();
                            }
                        }
                    }
                }
            }
        }
Example #18
0
        private void buttonConfig_Click(object sender, EventArgs e)
        {
            FormConfig frm = new FormConfig();

            frm.ShowDialog(this);
        }
Example #19
0
        private void empresaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormConfig frmConfig = new FormConfig();

            frmConfig.ShowDialog();
        }
Example #20
0
 private void menuConfigClick(object sender, EventArgs e)
 {
     var frmConfig = new FormConfig(_appConfig, _appResource);
     frmConfig.Show();
 }
Example #21
0
        public override void OnButtonPress()
        {
            var config = new FormConfig();

            config.ShowDialog();
        }
Example #22
0
        public ActionResult GetFormConfigFromFormType(long id, [FromUri] long workFlowStateId = -1)
        {
            FormConfig myConfig = DataFactory.GetFormConfigByDemandType(id);

            return(this.getFormConfigDTO(myConfig, workFlowStateId));
        }
Example #23
0
		public LoginForm(Element parent, FormConfig config )
		{
			Parent= parent;
			Config= config;
		}
Example #24
0
        public JsonResult CreateLayout(string formId, string layoutType)
        {
            formId.CheckNotNullOrEmpty("formId");
            FormConfig cForm = UnitOfWork.GetByKey <FormConfig>(formId);

            cForm.CheckNotNull("FormConfig");
            var           ctrlList   = cForm.GetCtrlAttrList();
            StringBuilder formHtmlSB = new StringBuilder();

            //title
            //hidden dom
            formHtmlSB.Append("<input id='Id' name='Id' type='hidden' />");
            var noCtrlList = ctrlList.Where(a => string.IsNullOrEmpty(a.GetValue("CtrlType")));

            foreach (var ctrl in noCtrlList)
            {
                if (!string.IsNullOrEmpty(ctrl.GetValue("FieldName")))
                {
                    formHtmlSB.Append(string.Format("<input id='{0}' name='{0}' type='hidden' />", ctrl.GetValue("FieldName")));
                }
            }

            //visible dom
            var    withCtrlList = ctrlList.Where(a => !string.IsNullOrEmpty(a.GetValue("CtrlType"))).ToList();
            int    ctrlCount    = withCtrlList.Count();
            double dCol         = 0;

            double.TryParse(layoutType, out dCol);
            if (dCol == 0)
            {
                return(Json(""));
            }


            double tmp      = ctrlCount / dCol;
            int    rowCount = Convert.ToInt32(Math.Ceiling(tmp));

            double leftTdWithPercent  = 15;
            double rightTdWithPercent = Math.Round(100 / dCol, 2) - 15;

            if (rightTdWithPercent < 0)
            {
                rightTdWithPercent = leftTdWithPercent = Math.Round(100 / Convert.ToDouble(2 * dCol), 0);
            }

            formHtmlSB.Append("<table class='groupTable'>");
            //title
            formHtmlSB.Append(string.Format("<tr><td colspan='{0}' class='title'>{1}</td></tr>", 2 * dCol, cForm.Name));

            //row
            int ctrlIndex = 0;

            for (int i = 0; i < rowCount; i++)
            {
                formHtmlSB.Append("<tr>");
                for (int j = 0; j < dCol; j++)
                {
                    string ctrlColName = "";
                    if (ctrlIndex < withCtrlList.Count)
                    {
                        var ctrl = withCtrlList[ctrlIndex];
                        ctrlColName = ctrl.GetValue("ColumnName");
                        if (string.IsNullOrEmpty(ctrlColName))
                        {
                            ctrlColName = ctrl.GetValue("FieldName");
                        }
                    }

                    //left
                    formHtmlSB.Append(string.Format("<td style='width:{0}%'>{1}</td>", leftTdWithPercent,
                                                    string.IsNullOrEmpty(ctrlColName) ? "" : (ctrlColName + ":")));
                    //right
                    formHtmlSB.Append(string.Format("<td style='width:{0}%'>{1}</td>", rightTdWithPercent,
                                                    string.IsNullOrEmpty(ctrlColName) ? "" : ("{" + ctrlColName + "}")));
                    ctrlIndex++;
                }
                formHtmlSB.Append("</tr>");
            }
            formHtmlSB.Append("</table>");


            return(Json(formHtmlSB.ToString()));
        }
 private void btnSetting_Click(object sender, EventArgs e)
 {
     FormConfig form = new FormConfig();
     form.ShowDialog();
 }
        /// <summary>
        ///启动压力特性试验
        /// </summary>

        public void StartPressureTest()
        {
            FormConfig cfm = new FormConfig();

            cfm.Show();
        }
Example #27
0
 public ActionResult SaveFormConfig(FormConfig model)
 {
     model.TableName = Request.Form["TableName"];
     _IFormDesign.Save <FormConfig>(model);
     return(Alert("数据保存成功!", Url.Action("FormConfig")));
 }
Example #28
0
 internal MvcCoreBootstrapFormBuilder(FormConfig config)
 {
     _config = config;
 }
Example #29
0
        /// <summary>
        /// 表单预览
        /// </summary>
        /// <returns></returns>
        public ActionResult FormConfigPreview(int id = 1)
        {
            FormConfig config = _IFormDesign.GetFormConfig(id);

            if (config == null)
            {
                return(Alert("请先配置表单信息"));
            }
            FormTemplate ft = _IFormDesign.GetFormTemplate(config.FormTemplateId);

            if (ft == null)
            {
                return(Alert("请先配置表单模板信息"));
            }
            FieldTemplateGroup fg = _IFormDesign.GetFieldTemplateGroup(config.FieldTemplateGroupId);

            if (ft == null)
            {
                return(Alert("请先配置字段模板组信息"));
            }

            IList <FieldTemplate> ftList = _IFormDesign.GetFieldTemplateByGroupId(config.FieldTemplateGroupId);

            if (ftList.Count == 0)
            {
                return(Alert("请先配置表单字段"));
            }
            //表单字段
            if (string.IsNullOrEmpty(config.TableName))
            {
                return(Alert("请先配置表单信息对应表名称"));
            }
            List <FieldConfig> fcList = new List <FieldConfig>();

            foreach (var item in config.TableName.Split(','))
            {
                if (string.IsNullOrEmpty(item) == false)
                {
                    fcList.AddRange(_IFormDesign.GetFieldConfigByTableName(item));
                }
            }

            //组装页面显示html
            StringBuilder sbHdFildHtml = new StringBuilder();
            StringBuilder sbFildHtml   = new StringBuilder();

            //for (int i = 0; i < fcList.Count; i++)
            //{

            //    if (fcList[i].FieldType == (int)EmFieldType.Hidden)
            //    {
            //        sbHdFildHtml.AppendLine("<input type='hidden' name='" + fcList[i].Field + "'>");
            //        continue;
            //    }
            //    else
            //    {
            //        var ftp = ftList.FirstOrDefault(p => p.Id == fcList[i].FieldTemplateId);
            //        if (ftp == null)
            //        {
            //            return Alert(string.Format("{0}下的{1}字段模板不存在", fcList[i].TableName, fcList[i].Field));
            //        }
            //        var currentFiledCount = fcList.Count - (ftp.FieldCount + i);
            //        if (currentFiledCount < 0) //如果剩余字段不够填充
            //        {
            //            ftp = ftList.FirstOrDefault(p => p.FieldCount == (ftp.FieldCount - 1));
            //            if (ftp == null)
            //            {
            //                return Content("<script>alert('请配置字段个数为" + currentFiledCount + "的字段模板!')</script>");
            //            }
            //        }
            //        sbFildHtml.AppendLine(ftp.Content);



            //        //模板字段内容处理
            //        string fildContent = null;
            //        for (int j = 0; j < ftp.FieldCount; j++)
            //        {
            //            if (fcList[i].FieldType == (int)EmFieldType.Lable)
            //            {
            //                fildContent = "<label name=\"" + fcList[i].Field + "\"></label>";
            //            }
            //            else if (fcList[i].FieldType == (int)EmFieldType.Text)
            //            {
            //                fildContent = "<input type=\"text\" name=\"" + fcList[i].Field + "\" />";
            //            }
            //            else if (fcList[i].FieldType == (int)EmFieldType.TextArea)
            //            {
            //                fildContent = "<textarea  name=\"" + fcList[i].Field + "\"></textarea>";
            //            }
            //            else if (fcList[i].FieldType == (int)EmFieldType.Password)
            //            {
            //                fildContent = "<input type=\"password\"  name=\"" + fcList[i].Field + "\"/>";
            //            }
            //            else if (fcList[i].FieldType == (int)EmFieldType.NormalButton)
            //            {
            //                fildContent = "<input type=\"button\" value=\"" + fcList[i].FieldLable + "\"/>";
            //            }
            //            else if (fcList[i].FieldType == (int)EmFieldType.SubmitButton)
            //            {
            //                fildContent = "<input type=\"submit\" value=\"" + fcList[i].FieldLable + "\"/>";
            //            }
            //            else if (fcList[i].FieldType == (int)EmFieldType.Radio)
            //            {

            //            }
            //            else if (fcList[i].FieldType == (int)EmFieldType.CheckBox)
            //            {

            //            }
            //            else if (fcList[i].FieldType == (int)EmFieldType.Select)
            //            {

            //            }
            //            sbFildHtml.Replace("{$filed" + (j + 1) + "Name$}", fcList[i].FieldLable).Replace("{$filed" + (j + 1) + "$}", fildContent);

            //            if (j < ftp.FieldCount - 1)
            //            {
            //                i++;
            //            }
            //        }
            //    }
            //}

            StringBuilder sbHtml = new StringBuilder();

            sbHtml.AppendLine("<style type='text/css'>");
            sbHtml.AppendLine("</style>");
            sbHtml.AppendLine(ft.Content.Replace("<formContent></formContent>", Convert.ToString(sbHdFildHtml) + Convert.ToString(sbFildHtml)));
            return(Content(sbHtml.ToString()));
        }
        public int OpenUIForm(ConfigEnum configEnum, object userData)
        {
            FormConfig fc = ConfigManger.Instance.GetConfig <FormConfig>((int)configEnum);

            return(OpenUIForm(fc.ScenePosition + fc.SceneName, fc.SceneGroup, userData));
        }
Example #31
0
        private void btnSetting_Click(object sender, EventArgs e)
        {
            FormConfig form = new FormConfig();

            form.ShowDialog();
        }
Example #32
0
        private void btnBug_Click(object sender, EventArgs e)
        {
            FormConfig FConfig = new FormConfig();

            FConfig.ShowDialog();
        }