Ejemplo n.º 1
0
        /// <summary>
        /// Создает lookup для определенного поля по модели.
        /// </summary>
        public static MvcHtmlString SingleLookup(this HtmlHelper html, SingleLookupModel model)
        {
            if (string.IsNullOrWhiteSpace(model.GetItemAction))
            {
                model.GetItemAction = GetItemActionDefault;
            } //if

            if (string.IsNullOrWhiteSpace(model.GetItemsAction))
            {
                model.GetItemsAction = GetItemsActionDefault;
            } //if

            if (string.IsNullOrWhiteSpace(model.Controller))
            {
                model.Controller = model.Property;
            } //if

            if (model.Width < SingleLookupMinWidth)
            {
                model.Width = SingleLookupMinWidth;
            } //if

            if (model.Height < SingleLookupMinHeight)
            {
                model.Height = SingleLookupMinHeight;
            } //if

            return(html.Partial("SingleLookup", model));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Romontinka.Server.WebSite.Metadata.SimpleLookupAttribute"/> class.
 /// </summary>
 public SingleLookupAttribute(string controller, Type searchModelType, string parentID, bool clearButton, bool fullScreen)
 {
     _model             = new SingleLookupModel();
     _model.Controller  = controller;
     _model.ParentID    = parentID;
     _model.ClearButton = clearButton;
     _model.SearchModel = (JLookupSearchBaseModel)Activator.CreateInstance(searchModelType);
     _model.FullScreen  = fullScreen;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Создает lookup для определенного поля.
        /// </summary>
        public static MvcHtmlString SingleLookup(this HtmlHelper html, string controller, string getItemsAction, string getItemAction, string propertyName, string propertyValue, string parentID, bool clieanButton, string editorClasses, bool createValidation)
        {
            var model = new SingleLookupModel
            {
                GetItemsAction = getItemsAction,
                GetItemAction  = getItemAction,
                Controller     = controller,
                ParentID       = parentID,
                Property       = propertyName,
                PropertyValue  = propertyValue,
                ClearButton    = clieanButton,
                EditorClasses  = editorClasses
            };

            return(SingleLookup(html, model));
        }