Beispiel #1
0
 public DatePickerHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
 {
     this.IsRequired = obj["isRequired"] != null && ((bool)obj["isRequired"]);
     this.ShowType   = obj["showtype"].ToStringObj();
     this.DateFormat = obj["dateformat"].ToStringObj();
     this.FillValue();
 }
 public CaptchaHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
 {
     this.SiteKey    = DomainUtility.toString(obj["sitekey"]);
     this.PrivateKey = DomainUtility.toString(obj["privatekey"]);
     this.Language   = DomainUtility.toString(obj["language"]);
     this.FillValue();
 }
 public BindingElementBase(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId)
 {
     this.Fill            = DomainUtility.toString(obj["fillBinding"]);
     this.Map             = DomainUtility.toString(obj["mapBinding"]);
     this.Parameter       = obj["parameter"].ToStringObj();
     this.IsReadonly      = isFormReadOnly ? true : (obj["readOnly"] != null ? ((bool)obj["readOnly"]) : (bool?)null);
     this.ValidationGroup = string.IsNullOrWhiteSpace(obj["validationGroup"].ToStringObj()) ? "nextAction" : obj["validationGroup"].ToStringObj().Trim();
 }
Beispiel #4
0
        public ImageHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
        {
            this.Width   = obj["width"] != null && !string.IsNullOrWhiteSpace(obj["width"].ToString()) ? Convert.ToInt32(obj["width"]) : (int?)null;
            this.Height  = obj["height"] != null && !string.IsNullOrWhiteSpace(obj["height"].ToString()) ? Convert.ToInt32(obj["height"]) : (int?)null;
            this.Address = DomainUtility.toString(obj["address"]);

            this.FillValue();
        }
Beispiel #5
0
 public CheckBoxListHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
 {
     this.IsRequired       = obj["isRequired"] != null && (bool)obj["isRequired"];
     this.FontIconCssClass = DomainUtility.toString(obj["fontIconCssClass"]);
     this.IsInline         = obj["isInline"] != null && obj["isInline"].ToBoolObj();
     this.Options          = new List <OptionHtml>();
     this.FillValue(obj);
 }
Beispiel #6
0
 public WordCaptchaHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
 {
     this.Length = obj["length"].ToIntObj();
     if (this.Length <= 0)
     {
         this.Length = 8;
     }
     this.FillValue();
 }
        public ListItemElementBase(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
        {
            this.Key  = DomainUtility.toString(obj["fillKey"]);
            this.Text = DomainUtility.toString(obj["fillText"]);
            this.Text = string.IsNullOrWhiteSpace(this.Text) ? nameof(this.Text) : this.Text;
            this.Key  = string.IsNullOrWhiteSpace(this.Key) ? nameof(this.Key) : this.Key;

            this.FillList = DomainUtility.toString(obj["fillListBinding"]);
        }
 public TextBoxHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
 {
     this.IsRequired       = obj["isRequired"] != null && ((bool)obj["isRequired"]);
     this.FontIconCssClass = DomainUtility.toString(obj["fontIconCssClass"]);
     this.SubType          = DomainUtility.toString(obj["subtype"]);
     this.PlaceHolderText  = DomainUtility.toString(obj["placeholderText"]);
     this.IsMultiline      = obj["isMultiline"] != null && ((bool)obj["isMultiline"]);
     this.Pattern          = obj["pattern"].ToStringObj();
     this.MaxLength        = obj["maxLength"]?.ToIntObj();
     this.FillValue();
 }
Beispiel #9
0
 public FileUploadHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
 {
     this.VariableId       = DomainUtility.toString(obj["entityVariableId"]);
     this.DocumentdefId    = DomainUtility.toString(obj["documentDefId"]);
     this.DocumentFolderId = obj["documentFolderId"].ToStringObj();
     this.Multiple         = !string.IsNullOrWhiteSpace(DomainUtility.toString(obj["multiple"])) && Convert.ToBoolean(obj["multiple"]);
     this.DeleteClass      = DomainUtility.toString(obj["deleteClass"]);
     this.DownloadClass    = DomainUtility.toString(obj["downloadClass"]);
     this.DeleteCaption    = DomainUtility.toString(obj["deleteCaption"]);
     this.DownloadCaption  = DomainUtility.toString(obj["downloadCaption"]);
     this.ListDocument     = new List <QueryModel>();
     this.FillValue();
 }
Beispiel #10
0
 public DownloadLinkHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
 {
     this.VariableId       = DomainUtility.toString(obj["entityVariableId"]);
     this.DocumentDefId    = DomainUtility.toString(obj["documentDefId"]).ToGuidObjNull();
     this.DocumentFolderId = obj["documentFolderId"].ToGuidObjNull();
     this.ListDocument     = new List <Guid>();
     if (base.Helper.FormAction == HtmlElementHelperModel.e_FormAction.Onload &&
         (this.DocumentFolderId.HasValue || this.DocumentDefId.HasValue))
     {
         this.ListDocument = base.Helper?.DocumentEngine?.GetList(this.DocumentDefId.ToGuidObjNull(),
                                                                  this.VariableId.ToGuidObjNull(), this.DocumentFolderId).Select(c => new { c.GUID, c.CaptionOf }).ToList();
     }
 }
 public FormModel(JObject obj, HtmlElementHelperModel helper, List <sysBpmsStep> listStep, sysBpmsStep currentStep, sysBpmsDynamicForm dynamicForm, bool isFormReadOnly)
 {
     helper?.AddScript(dynamicForm?.ConfigXmlModel.OnLoadFunctionBody);
     helper?.AddStyleSheet(dynamicForm?.ConfigXmlModel.StyleSheetCode);
     this.ContentHtml = new ContentHtml(obj, helper, dynamicForm.ID, isFormReadOnly);
     if (helper?.FormAction == HtmlElementHelperModel.e_FormAction.Onload ||
         helper?.FormAction == HtmlElementHelperModel.e_FormAction.Preview)
     {
         this.FillDependentControls();
     }
     this.SetParams(listStep, currentStep);
     this.FormName        = dynamicForm?.Name ?? string.Empty;
     this.IsFormReadOnly  = isFormReadOnly;
     this.IsEncrypted     = helper.IsEncrypted;
     this.DynamicFormID   = dynamicForm?.ID ?? Guid.Empty;
     this.ResultOperation = helper?.ResultOperation ?? new ResultOperation();
     this.ContentHtml.CheckAllVisibility(this);
 }
Beispiel #12
0
 public ChartHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
 {
     this.ChartDataSet        = DomainUtility.toString(obj["chartDataSet"]);
     this.ChartLabelDataField = DomainUtility.toString(obj["chartLabelDataField"]);
     this.ChartFillListLabel  = DomainUtility.toString(obj["chartFillListLabel"]);
     this.DisplayLegend       = obj["displayLegend"].ToBoolObj();
     this.IsSmooth            = obj["isSmooth"].ToBoolObj();
     if (!string.IsNullOrWhiteSpace(obj["chartType"].ToStringObj()))
     {
         this.ChartType = (e_ChartType)Enum.Parse(typeof(e_ChartType), obj["chartType"].ToStringObj(), true);
     }
     if (!string.IsNullOrWhiteSpace(obj["colorType"].ToStringObj()))
     {
         this.ColorType = (e_ColorType)Enum.Parse(typeof(e_ColorType), obj["colorType"].ToStringObj(), true);
     }
     this.PieColorName = obj["pieColorName"].ToStringObj();
     this.FillValue();
 }
Beispiel #13
0
        public ButtonHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId)
        {
            this.IsReadonly    = isFormReadOnly;
            this.subtype       = (e_subtype)Enum.Parse(typeof(e_subtype), DomainUtility.toString(obj["subtype"]), true);
            this.BackendCoding = DomainUtility.toString(obj["backendCoding"]).FromBase64();

            this.OpenFormId             = obj["openFormId"].ToStringObj();
            this.OpenFormParameter      = obj["openFormParameter"].ToStringObj();
            this.OpenFormCallBackScript = obj["openFormCallBackScript"].ToStringObj().FromBase64();

            //confirm setting
            this.ConfirmText           = obj["confirmText"].ToStringObj();
            this.HasConfirm            = obj["hasConfirm"].ToStringObj().ToLower() == "true";
            this.HasExpressionConfirm  = obj["hasExpressionConfirm"].ToStringObj().ToLower() == "true";
            this.ExpressionConfirmText = obj["expressionConfirmText"].ToStringObj();
            this.ExpressionConfirmCode = obj["expressionConfirmCode"].ToStringObj().FromBase64();
            if (!string.IsNullOrWhiteSpace(this.ExpressionConfirmCode))
            {
                this.ConfirmDesignCodeModel = DesignCodeUtility.GetDesignCodeFromXml(this.ExpressionConfirmCode);
            }

            this.ExpressionConfirmHasFalseAction = obj["expressionConfirmHasFalseAction"].ToStringObj().ToLower() == "true";
            this.FormWidth  = obj["formWidth"].ToStringObj();
            this.FormHeight = obj["formHeight"].ToStringObj();

            if (!string.IsNullOrWhiteSpace(this.OpenFormId))
            {
                if (this.Helper?.FormAction != HtmlElementHelperModel.e_FormAction.FillMode &&
                    this.Helper?.FormAction != HtmlElementHelperModel.e_FormAction.Preview)
                {
                    base.AddElementEventModel(new ElementEventScriptModel()
                    {
                        EventName    = ElementBase.e_EventName.click.ToString(),
                        FunctionName = "openForm" + this.Id,
                        ScriptBody   = $@"function openForm{this.Id}(target){{ FormControl.openFormPopUp(target.element,'{this.OpenFormId}','{this.GetParameter}',function(){{ {this.OpenFormCallBackScript} }},{(string.IsNullOrWhiteSpace(this.FormWidth) ? "null" : this.FormWidth)},{(string.IsNullOrWhiteSpace(this.FormHeight) ? "null" : this.FormHeight)});}}",
                    }, true);
                }
            }
            this.ValidationGroup = string.IsNullOrWhiteSpace(obj["validationGroup"].ToStringObj()) ? "nextAction" : obj["validationGroup"].ToStringObj().Trim();

            this.HasPostBack = this.subtype == ButtonHtml.e_subtype.submit ||
                               (DesignCodeUtility.GetDesignCodeFromXml(this.BackendCoding).CodeObjects?.Any() ?? false);
        }
        public DataGridHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
        {
            this.ColumnSetting = DomainUtility.toString(obj["columnSetting"]);

            if (string.IsNullOrWhiteSpace(this.ColumnSetting))
            {
                this.DataGridColumns = new List <DataGridColumsSetting>();
            }
            else
            {
                this.DataGridColumns = DataGridColumsSetting.ConvertTo(JArray.Parse(this.ColumnSetting));
            }


            //paging
            this.HasPaging = DomainUtility.toString(obj["hasPaging"]).ToLower() == "true";
            this.PageSize  = obj["pageSize"].ToIntObj() > 0 ? obj["pageSize"].ToIntObj() : 10;
            this.ShowExcel = DomainUtility.toString(obj["showExcel"]).ToLower() == "true";
            this.ShowPdf   = obj["showPdf"].ToStringObj().ToLower() == "true";

            //report
            this.ReportHeader          = obj["reportHeader"].ToStringObj();
            this.ReportFooter          = obj["reportFooter"].ToStringObj();
            this.ReportGridHeaderColor = obj["reportGridHeaderColor"].ToStringObj();
            this.ReportGridFooterColor = obj["reportGridFooterColor"].ToStringObj();
            this.ReportGridEvenColor   = obj["reportGridEvenColor"].ToStringObj();
            this.ReportGridOddColor    = obj["reportGridOddColor"].ToStringObj();
            this.ReportPaperSize       = obj["reportPaperSize"].ToStringObj();
            this.ReportShowDate        = obj["reportShowDate"].ToStringObj().ToLower() == "true";

            //default sorting
            if (obj["sortColumn"] != null)
            {
                this.SortColumn = obj["sortColumn"].ToStringObj();
                this.SortType   = !string.IsNullOrWhiteSpace(DomainUtility.toString(obj["sortType"])) ?
                                  (PagingProperties.e_OrderByType)Enum.Parse(typeof(PagingProperties.e_OrderByType), DomainUtility.toString(obj["sortType"]), true) : (PagingProperties.e_OrderByType.Asc);
            }
            //if this.Parameter is null ,it means that it is not dependent to other controls.
            if (string.IsNullOrWhiteSpace(this.Parameter))
            {
                this.FillData();
            }
        }
        public ElementBase(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId)
        {
            this.DynamicFormID            = dynamicFormId;
            this.Id                       = DomainUtility.toString(obj["id"]);
            this.Type                     = DomainUtility.toString(obj["type"]);
            this.CssClass                 = DomainUtility.toString(obj["cssClass"]);
            this.HtmlType                 = DomainUtility.toString(obj["htmlType"]);
            this.ExpressionVisibilityCode = obj["expressionVisibilityCode"].ToStringObj().FromBase64();
            if (!string.IsNullOrWhiteSpace(this.ExpressionVisibilityCode))
            {
                this.VisibilityDesignCodeModel = DesignCodeUtility.GetDesignCodeFromXml(this.ExpressionVisibilityCode);
            }

            this.Label           = DomainUtility.toString(obj["label"]);
            this.HelpMessageText = DomainUtility.toString(obj["helpMessageText"]);
            this.AccessType      = !string.IsNullOrWhiteSpace(DomainUtility.toString(obj["accessType"])) ?
                                   (e_AccessType)Enum.Parse(typeof(e_AccessType), DomainUtility.toString(obj["accessType"]), true) : (e_AccessType?)null;

            this.Helper = _helper;
            this.FillElementEventModel(obj);
        }
        /// <summary>
        /// this method set HtmlElement to ColumnHtml and RowHtml and FormHtml
        /// </summary>
        /// <param name="_helper">if set null it does not fill element values.</param>
        public FormHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId)
        {
            if (dynamicFormId != Guid.Empty && _helper?.UnitOfWork != null && this.Helper?.FormAction != HtmlElementHelperModel.e_FormAction.FillMode)
            {
                sysBpmsDynamicForm dynamicForm = _helper?.UnitOfWork.Repository <IDynamicFormRepository>().GetInfo(dynamicFormId);
                if (dynamicForm != null)
                {
                    //If It is ApplicationPage,It must set ApplicationPageID To current ApplicationPageID for DataManageHelper and DocumentEngine
                    //to retrieve variables for current form
                    Guid?parentAppPageID = _helper.DataManageHelper.GetSharedModel().CurrentApplicationPageID;
                    if (dynamicForm.ApplicationPageID.HasValue)
                    {
                        _helper.DataManageHelper.SetApplicationPageID(dynamicForm.ApplicationPageID.Value);
                        _helper.DocumentEngine.SetApplicationPageID(dynamicForm.ApplicationPageID.Value);
                    }

                    isFormReadOnly = !isFormReadOnly ? (obj["readOnly"] != null ? ((bool)obj["readOnly"]) : false) : true;
                    //convert form xml code to json object
                    JObject newObj = JObject.Parse(dynamicForm.DesignJson);
                    //if json object has a control with type = CONTENT
                    if (newObj != null && newObj["type"].ToString() == "CONTENT")
                    {
                        this.ContentHtml = new ContentHtml(newObj, _helper, dynamicFormId, isFormReadOnly);
                    }
                    base.Helper?.AddScript(dynamicForm.ConfigXmlModel.OnLoadFunctionBody);
                    base.Helper?.AddStyleSheet(dynamicForm.ConfigXmlModel.StyleSheetCode);
                    this.IsFormReadOnly = isFormReadOnly;

                    //If It is ApplicationPage,It must restore ApplicationPageID To parent form for DataManageHelper and DocumentEngine
                    if (dynamicForm.ApplicationPageID.HasValue)
                    {
                        _helper.DataManageHelper.SetApplicationPageID(parentAppPageID.Value);
                        _helper.DocumentEngine.SetApplicationPageID(parentAppPageID.Value);
                    }
                }
            }
        }
Beispiel #17
0
        public TitleHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
        {
            this.TitleType = DomainUtility.toString(obj["titleType"]);

            this.FillValue();
        }
 public HtmlCodeHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
 {
     this.FillOnLoad();
 }
Beispiel #19
0
 public CardHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId)
 {
     this.Rows = obj["rows"].Select(c => new RowHtml((JObject)c, _helper, dynamicFormId, isFormReadOnly)).ToList();
 }
 public AccordionHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId)
 {
     this.Cards = obj["cards"].Select(c => new CardHtml((JObject)c, _helper, dynamicFormId, isFormReadOnly)).ToList();
 }
Beispiel #21
0
 public ColumnHtml(JObject obj, HtmlElementHelperModel helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, helper, dynamicFormId)
 {
     this.children =
         obj["children"].Select(c => ElementBase.GetElement((JObject)c, helper, dynamicFormId, isFormReadOnly))
         .Where(c => c != null /**for cheking controls having not access **/).ToList();
 }
        public static object GetElement(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly)
        {
            object element = null;

            switch ((e_Type)Enum.Parse(typeof(e_Type), obj["type"].ToString(), true))
            {
            case e_Type.DROPDOWNLIST:
                element = new DropDownHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.TEXTBOX:
                element = new TextBoxHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.RADIOBUTTONLIST:
                element = new RadioButtonListHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.CHECKBOXLIST:
                element = new CheckBoxListHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.CHECKBOX:
                element = new CheckBoxHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.IMAGE:
                element = new ImageHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.LINK:
                element = new LinkHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.CAPTCHA:
                element = new CaptchaHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.TITLE:
                element = new TitleHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.DATEPICKER:
                element = new DatePickerHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.CKEDITOR:
                element = new CkeditorHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.HTMLCODE:
                element = new HtmlCodeHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.FILEUPLOAD:
                element = new FileUploadHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.BUTTON:
                element = new ButtonHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                if (!((ElementBase)element).CheckAccess())
                {
                    element = null;
                }
                break;

            case e_Type.DOWNLOADLINK:
                element = new DownloadLinkHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.COMBOSEARCH:
                element = new ComboSearchHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.DATAGRID:
                element = new DataGridHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.FORM:
                element = new FormHtml(obj, _helper, obj["formId"].ToGuidObj(), isFormReadOnly);
                break;

            case e_Type.ACCORDION:
                element = new AccordionHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.CARD:
                element = new CardHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.ROW:
                element = new RowHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.CHART:
                element = new ChartHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;

            case e_Type.WORDCAPTCHA:
                element = new WordCaptchaHtml(obj, _helper, dynamicFormId, isFormReadOnly);
                break;
            }
            return(element);
        }
 public ComboSearchHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
 {
     this.IsRequired       = obj["isRequired"] != null && (bool)obj["isRequired"];
     this.FontIconCssClass = DomainUtility.toString(obj["fontIconCssClass"]);
     this.FillValue();
 }
Beispiel #24
0
 public CkeditorHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId, isFormReadOnly)
 {
     this.IsRequired = obj["isRequired"] != null && ((bool)obj["isRequired"]);
     this.FillValue();
 }
 public RowHtml(JObject obj, HtmlElementHelperModel _helper, Guid dynamicFormId, bool isFormReadOnly) : base(obj, _helper, dynamicFormId)
 {
     this.IsFooter = obj["isFooter"] != null && (bool)obj["isFooter"];
     this.Columns  = obj["columns"].Select(c => new ColumnHtml((JObject)c, _helper, dynamicFormId, isFormReadOnly)).ToList();
 }