Exemplo n.º 1
0
 protected PropertyBase.Parameters CreateParameters(
     BindableObjectProvider businessObjectProvider,
     IPropertyInformation propertyInfo,
     Type underlyingType,
     Type concreteType,
     IListInfo listInfo,
     bool isRequired,
     bool isReadOnly,
     IBindablePropertyReadAccessStrategy bindablePropertyReadAccessStrategy   = null,
     IBindablePropertyWriteAccessStrategy bindablePropertyWriteAccessStrategy = null,
     BindableObjectGlobalizationService bindableObjectGlobalizationService    = null)
 {
     return(new PropertyBase.Parameters(
                businessObjectProvider,
                propertyInfo,
                underlyingType,
                new Lazy <Type> (() => concreteType),
                listInfo,
                isRequired,
                isReadOnly,
                new BindableObjectDefaultValueStrategy(),
                bindablePropertyReadAccessStrategy ?? SafeServiceLocator.Current.GetInstance <IBindablePropertyReadAccessStrategy>(),
                bindablePropertyWriteAccessStrategy ?? SafeServiceLocator.Current.GetInstance <IBindablePropertyWriteAccessStrategy>(),
                bindableObjectGlobalizationService ?? SafeServiceLocator.Current.GetInstance <BindableObjectGlobalizationService>()));
 }
Exemplo n.º 2
0
 public IManagedWindow GetWindow(string window_name, long id, IListInfo module)
 {
     ITableInfo tableinfo = null;
     if(module != null)
         tableinfo = ServerConnection.Instance.Resources.GetTableInfo(module.TableName);
     if(id != 0)
     {
         foreach(IManagedWindow window in windows)
         {
             if(window.WindowName == window_name && window.Id == id && window.TableInfo == tableinfo)
             {
                 window.Present();
                 return window;
             }
         }
     }
     IManagedWindow win = (IManagedWindow)FormFactory.Create(window_name);
     win.TableInfo = tableinfo;
     win.LoadItem(id);
     windows.Add(win);
     win.Destroyed += delegate {
         windows.Remove(win);
     };
     win.Present();
     return win;
 }
 public DataTableListStoreBinding(DataTableView view, DataTable dt, IListInfo listinfo)
 {
     this.Mapping = new ListStoreMapping();
     this.DataTableView = view;
     this.DataTable = dt;
     this.ListInfo = listinfo;
     this.Mapping.ColumnClicked += ToggleSort;
 }
Exemplo n.º 4
0
        public DataTableView(IListInfo info, params object[] parameters)
        {
            this.ListInfo = info;
            this.parameters = parameters;
            this.FixedHeightMode = true;
            this.RulesHint = true;

            this.LoadData();
        }
Exemplo n.º 5
0
        public void SetInfo(Guid listId, string name, string description, bool isPrivate)
        {
            IListInfo listInfo = this.GetFullInfo(listId).ListInfo;

            if (listInfo.IsPersonnal)
            {
                throw new IsPersonnalList();
            }

            listInfo.Name        = name;
            listInfo.Description = description;
            listInfo.IsPrivate   = isPrivate;
        }
Exemplo n.º 6
0
    public void SetIndex(IListInfo info, int listIndex)
    {
        Info      = info;
        ListIndex = listIndex;

        if (!Info.ListItemEnabled(ListIndex))
        {
            GetComponent <Button>().interactable = false;
            Label.text = "Locked";
        }
        else
        {
            Label.text = Info.GetLabelForListItem(ListIndex);
        }
    }
Exemplo n.º 7
0
            public Parameters(
                [NotNull] BindableObjectProvider businessObjectProvider,
                [NotNull] IPropertyInformation propertyInfo,
                [NotNull] Type underlyingType,
                [NotNull] Lazy <Type> concreteType,
                [CanBeNull] IListInfo listInfo,
                bool isRequired,
                bool isReadOnly,
                [NotNull] IDefaultValueStrategy defaultValueStrategy,
                [NotNull] IBindablePropertyReadAccessStrategy bindablePropertyReadAccessStrategy,
                [NotNull] IBindablePropertyWriteAccessStrategy bindablePropertyWriteAccessStrategy,
                [NotNull] BindableObjectGlobalizationService bindableObjectGlobalizationService)
            {
                ArgumentUtility.CheckNotNull("businessObjectProvider", businessObjectProvider);
                ArgumentUtility.CheckNotNull("propertyInfo", propertyInfo);
                ArgumentUtility.CheckNotNull("underlyingType", underlyingType);
                ArgumentUtility.CheckNotNull("concreteType", concreteType);
                ArgumentUtility.CheckNotNull("defaultValueStrategy", defaultValueStrategy);
                ArgumentUtility.CheckNotNull("bindablePropertyReadAccessStrategy", bindablePropertyReadAccessStrategy);
                ArgumentUtility.CheckNotNull("bindablePropertyWriteAccessStrategy", bindablePropertyWriteAccessStrategy);
                ArgumentUtility.CheckNotNull("bindableObjectGlobalizationService", bindableObjectGlobalizationService);

                BusinessObjectProvider = businessObjectProvider;
                PropertyInfo           = propertyInfo;
                UnderlyingType         = underlyingType;
                ConcreteType           = new Lazy <Type> (
                    () =>
                {
                    var actualConcreteType = concreteType.Value;
                    if (!underlyingType.IsAssignableFrom(actualConcreteType))
                    {
                        throw new InvalidOperationException(
                            string.Format(
                                "The concrete type must be assignable to the underlying type '{0}'.\r\nConcrete type: {1}",
                                underlyingType.FullName,
                                actualConcreteType.FullName));
                    }
                    return(actualConcreteType);
                },
                    LazyThreadSafetyMode.ExecutionAndPublication);
                ListInfo             = listInfo;
                IsRequired           = isRequired;
                IsReadOnly           = isReadOnly;
                DefaultValueStrategy = defaultValueStrategy;
                BindablePropertyReadAccessStrategy  = bindablePropertyReadAccessStrategy;
                BindablePropertyWriteAccessStrategy = bindablePropertyWriteAccessStrategy;
                BindableObjectGlobalizationService  = bindableObjectGlobalizationService;
            }
Exemplo n.º 8
0
        protected PropertyBase(Parameters parameters)
        {
            ArgumentUtility.CheckNotNull("parameters", parameters);

            if (parameters.PropertyInfo.GetIndexParameters().Length > 0)
            {
                throw new InvalidOperationException("Indexed properties are not supported.");
            }

            _businessObjectProvider = parameters.BusinessObjectProvider;
            _propertyInfo           = parameters.PropertyInfo;
            _underlyingType         = parameters.UnderlyingType;
            _listInfo             = parameters.ListInfo;
            _isRequired           = parameters.IsRequired;
            _isReadOnly           = parameters.IsReadOnly;
            _defaultValueStrategy = parameters.DefaultValueStrategy;
            _bindablePropertyReadAccessStrategy  = parameters.BindablePropertyReadAccessStrategy;
            _bindablePropertyWriteAccessStrategy = parameters.BindablePropertyWriteAccessStrategy;
            _bindableObjectGlobalizationService  = parameters.BindableObjectGlobalizationService;
            _isNullable  = GetNullability();
            _valueGetter = Maybe.ForValue(_propertyInfo.GetGetMethod(true)).Select(mi => mi.GetFastInvoker <Func <object, object> >()).ValueOrDefault();
            _valueSetter = Maybe.ForValue(_propertyInfo.GetSetMethod(true)).Select(mi => mi.GetFastInvoker <Action <object, object> >()).ValueOrDefault();
        }
 private new PropertyBase.Parameters CreateParameters(
     BindableObjectProvider businessObjectProvider = null,
     IPropertyInformation propertyInfo             = null,
     Type underlyingType = null,
     Type concreteType   = null,
     IListInfo listInfo  = null,
     bool isRequired     = false,
     bool isReadOnly     = false,
     IBindablePropertyReadAccessStrategy bindablePropertyReadAccessStrategy   = null,
     IBindablePropertyWriteAccessStrategy bindablePropertyWriteAccessStrategy = null,
     BindableObjectGlobalizationService bindableObjectGlobalizationService    = null)
 {
     return(base.CreateParameters(
                businessObjectProvider ?? _bindableObjectProvider,
                propertyInfo,
                underlyingType,
                concreteType,
                listInfo,
                isRequired,
                isReadOnly,
                bindablePropertyReadAccessStrategy,
                bindablePropertyWriteAccessStrategy,
                bindableObjectGlobalizationService));
 }
Exemplo n.º 10
0
 public ListApi(Guid id, IListInfo info)
 {
     Id          = id.ToString();
     Name        = info.Name;
     Description = info.Description;
 }
Exemplo n.º 11
0
 public NpgsqlCommand CreateCommand(IListInfo table, string addsql, params NpgsqlParameter[] parameters)
 {
     if(String.IsNullOrEmpty(addsql))
        return CreateCommand(table, parameters);
     NpgsqlCommand result = CreateCommand(table, addsql);
     foreach(NpgsqlParameter parameter in parameters)
         result.Parameters.Add(parameter);
     return result;
 }
Exemplo n.º 12
0
 public NpgsqlCommand CreateCommand(IListInfo table, params NpgsqlParameter[] parameters)
 {
     NpgsqlCommand command = CreateCommand();
     string sql = table.ListSql;
     string sqllower = sql.ToLower();
     StringBuilder paramstr = new StringBuilder();
     bool first = true;
     foreach(NpgsqlParameter parameter in parameters)
     {
         if(first) first = false; else paramstr.Append(" AND ");
         object val = parameter.Value;
         if(val == null || val is DBNull)
             paramstr.AppendFormat("({0} IS NULL)", parameter.SourceColumn);
         else
             paramstr.AppendFormat("({0} = {1})", parameter.SourceColumn, parameter.ParameterName);
         command.Parameters.Add(parameter);
     }
     int idx = sqllower.IndexOf("{where}");
     string op;
     if(idx >= 0)
     {
         op = first ? "" : " WHERE ";
         command.CommandText = sql.Substring(0, idx) + op + paramstr.ToString() + sql.Substring(idx + "{where}".Length);
         return command;
     }
     idx = sqllower.IndexOf("{and}");
     if(idx >= 0)
     {
         op = first ? "" : " AND ";
         command.CommandText = sql.Substring(0, idx) + op + paramstr.ToString() + sql.Substring(idx + "{and}".Length);
         return command;
     }
     op = first ? "" : " WHERE ";
     command.CommandText = sql + op + paramstr.ToString();
     return command;
 }
Exemplo n.º 13
0
 public NpgsqlCommand CreateCommand(IListInfo table, string addsql)
 {
     string sql = table.ListSql;
     if(addsql == null)
         addsql = "";
     string sqllower = sql.ToLower();
     int idx = sqllower.IndexOf("{where}");
     bool isadd = String.IsNullOrEmpty(addsql.Trim());
     string op;
     if(idx >= 0)
     {
         op = isadd ? "" : " WHERE ";
         return CreateCommand(sql.Substring(0, idx) + op + addsql + sql.Substring(idx + "{where}".Length));
     }
     idx = sqllower.IndexOf("{and}");
     if(idx >= 0)
     {
         op = isadd ? "" : " AND ";
         return CreateCommand(sql.Substring(0, idx) + op + addsql + sql.Substring(idx + "{and}".Length));
     }
     op = isadd ? "" : " WHERE ";
     return CreateCommand(sql + op + addsql);
 }
Exemplo n.º 14
0
        public void GetInfoNormalBehaviour()
        {
            IListInfo listInfo = storage.List.GetInfo(listIdThatExists);

            Assert.AreEqual(listInfo.Name, "listThatExists");
        }
Exemplo n.º 15
0
 public ListApi(Guid id, IListInfo info)
 {
     Id = id.ToString();
     Name = info.Name;
     Description = info.Description;
 }