Exemplo n.º 1
0
        public ActionResult ShowInlineEditing(ITableColumnService tableColumnService, ILocalizationService localizationService, TableColumnModel column, int index, string tableName)
        {
            if (column.ColumnDataTypeId == 470 || column.ColumnDataTypeId == 471)
            {
                var model = new TextEditorModel()
                {
                    LabelName   = localizationService.GetLocalizedData(column.Id.ToString() + ";" + DataType.TableName + ";ColumnName"),
                    Name        = tableName + "[" + index.ToString() + "]." + column.ColumnName,
                    Value       = column.ColumnValue,
                    PlaceHolder = localizationService.GetLocalizedData(column.Id.ToString() + ";" + DataType.TableName + ";ColumnName")
                };
                if (column.ColumnDataTypeId == 471)
                {
                    model.Type = "Number";
                }
                return(PartialView(UrlHelpers.FloatingTemplate("_TextEditor.cshtml"), model));
            }
            else
            if (column.ColumnDataTypeId == 472)
            {
                var model = new DatePickerModel()
                {
                    LabelName   = localizationService.GetLocalizedData(column.Id.ToString() + ";" + DataType.TableName + ";ColumnName"),
                    Name        = tableName + "[" + index.ToString() + "]." + column.ColumnName,
                    DateFormat  = "dd/MM/yyyy",
                    Vertical    = "top",
                    PlaceHolder = localizationService.GetLocalizedData(column.Id.ToString() + ";" + DataType.TableName + ";ColumnName")
                };
                if (column.ColumnValue != null && !string.IsNullOrEmpty(column.ColumnValue))
                {
                    model.Value = DateTime.Parse(column.ColumnValue);
                }
                else
                {
                    model.Value = null;
                }
                return(PartialView(UrlHelpers.FloatingTemplate("_DatePicker.cshtml"), model));
            }
            else
            if (column.ColumnDataTypeId == 473)
            {
                var model = new DropdownListModel()
                {
                    LabelName          = localizationService.GetLocalizedData(column.Id.ToString() + ";" + DataType.TableName + ";ColumnName"),
                    DataType           = DataType.MasterData,
                    PropertyName       = "Name",
                    IsAnimationLabel   = false,
                    IsTagsInput        = false,
                    IsMultipleLanguage = false,
                    ValueField         = "Id",
                    DisplayField       = "Name",
                    Name  = tableName + "[" + index.ToString() + "]." + column.ColumnName,
                    Value = column.ColumnValue
                };
                var responseColumn = tableColumnService.ExcuteSqlString(column.SqlData);
                if (responseColumn != null)
                {
                    var resultColumn = JsonConvert.DeserializeObject <HrmResultModel <dynamic> >(responseColumn);
                    if (!CheckPermission(resultColumn))
                    {
                        //return to Access Denied
                    }
                    else
                    {
                        model.Data = resultColumn.Results;
                    }
                }

                return(PartialView(UrlHelpers.FloatingTemplate("_Dropdown.cshtml"), model));
            }
            else
            if (column.ColumnDataTypeId == 10519)
            {
                var model = new CheckboxModel()
                {
                    LabelName = localizationService.GetLocalizedData(column.Id.ToString() + ";" + DataType.TableName + ";ColumnName"),
                    Name      = tableName + "[" + index.ToString() + "]." + column.ColumnName,
                    Value     = column.ColumnValue,
                };
                return(PartialView(UrlHelpers.FloatingTemplate("_Checkbox.cshtml"), model));
            }
            else
            {
                return(Content("<div class=\"hrm-v2-td-template\"><span id=\"original-row-column-\"" + column.Id + ">" + column.ColumnValue + "</span></div>"));
            }
        }
Exemplo n.º 2
0
        public ActionResult FilterValueSelector(ITableColumnService tableColumnService, TableColumnModel column)
        {
            if (column.ColumnDataTypeId == 473)
            {
                var model = new DropdownListModel()
                {
                    IsAnimationLabel   = false,
                    IsTagsInput        = true,
                    IsMultipleLanguage = false,
                    ValueField         = "Id",
                    DisplayField       = "Name",
                    Name = "filter-value-" + column.Id,
                };
                if (column.IsChecked)
                {
                    model.ValueMultiSelect = JsonConvert.DeserializeObject <List <string> >(column.FilterValue.ToString());
                }
                var responseColumn = tableColumnService.ExcuteSqlString(column.SqlData);
                if (responseColumn != null)
                {
                    var resultColumn = JsonConvert.DeserializeObject <HrmResultModel <dynamic> >(responseColumn);
                    if (!CheckPermission(resultColumn))
                    {
                        //return to Access Denied
                    }
                    else
                    {
                        model.Data = resultColumn.Results;
                    }
                }

                return(PartialView(UrlHelpers.FloatingTemplate("_Dropdown.cshtml"), model));
            }
            else
            if (column.ColumnDataTypeId == 472)
            {
                var model = new DatePickerModel()
                {
                    Name       = "filter-value-" + column.Id,
                    DateFormat = "dd/MM/yyyy",
                    Vertical   = "top"
                };
                if (column.IsChecked)
                {
                    model.Value = DateTime.ParseExact(column.FilterValue, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                return(PartialView(UrlHelpers.FloatingTemplate("_DatePicker.cshtml"), model));
            }
            else
            if (column.ColumnDataTypeId == 470 || column.ColumnDataTypeId == 471)
            {
                var model = new TagsInputModel()
                {
                    Name = "filter-value-" + column.Id
                };
                if (column.IsChecked)
                {
                    model.Value = column.FilterValue ?? string.Empty;
                }
                return(PartialView(UrlHelpers.FloatingTemplate("_MultiSelect.cshtml"), model));
            }
            return(null);
        }