Пример #1
0
        public static int GetOperationTcpVersion(OperationTypes operationType)
        {
            switch (operationType)
            {
            case OperationTypes.Ping:
            case OperationTypes.None:
                return(-1);

            case OperationTypes.Drop:
                return(-2);

            case OperationTypes.Subscription:
                return(SubscriptionTcpVersion);

            case OperationTypes.Replication:
                return(ReplicationTcpVersion);

            case OperationTypes.Cluster:
                return(ClusterTcpVersion);

            case OperationTypes.Heartbeats:
                return(HeartbeatsTcpVersion);

            case OperationTypes.TestConnection:
                return(TestConnectionTcpVersion);

            default:
                throw new ArgumentOutOfRangeException(nameof(operationType), operationType, null);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ValidateWithDataErrorInfo"/> class.
 /// </summary>
 /// <param name="appliesWhen">The rule applies when.</param>
 /// <exception cref="ArgumentOutOfRangeException">appliesWhen;appliesWhen may only be a combination of Insert or Update</exception>
 public ValidateWithDataErrorInfo(OperationTypes appliesWhen) : base(appliesWhen)
 {
     if (appliesWhen.HasFlag(OperationTypes.Select) || appliesWhen.HasFlag(OperationTypes.Delete))
     {
         throw new ArgumentOutOfRangeException("appliesWhen", appliesWhen, "appliesWhen may only be a combination of Insert or Update");
     }
 }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ValueRule"/> class.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="valueFactory">The value factory.</param>
        /// <param name="appliesWhen">The applies when.</param>
        /// <exception cref="ArgumentOutOfRangeException">appliesWhen;appliesWhen may only be a combination of Insert, Update, or Delete</exception>
        public ValueRule(string columnName, ColumnValueGenerator valueFactory, OperationTypes appliesWhen) : base(columnName, appliesWhen)
        {
            if (appliesWhen.HasFlag(OperationTypes.Select))
                throw new ArgumentOutOfRangeException("appliesWhen", appliesWhen, "appliesWhen may only be a combination of Insert, Update, or Delete");

            ValueFactory = valueFactory;
        }
Пример #4
0
 private void CheckOperationPermission(OperationTypes operationType)
 {
     if (!CurrentEmployee.AllowedOperationTypes.HasFlag(operationType))
     {
         throw new Exception("У текущего сотрудника нет прав на осуществление операции");
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UserDataRule" /> class.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="appliesWhen">The rule can be applied to insert, update, and/or soft delete operations.</param>
 /// <exception cref="ArgumentOutOfRangeException">appliesWhen;appliesWhen may only be a combination of Insert, Update, or Delete</exception>
 /// <remarks>
 /// This will have no effect on hard deletes.
 /// </remarks>
 public DateTimeOffsetRule(string columnName, OperationTypes appliesWhen) : base(columnName, appliesWhen)
 {
     if (appliesWhen.HasFlag(OperationTypes.Select))
     {
         throw new ArgumentOutOfRangeException("appliesWhen", appliesWhen, "appliesWhen may only be a combination of Insert, Update, or Delete");
     }
 }
Пример #6
0
        public static ExecuteOperation CreateOperations(OperationTypes operation)
        {
            ExecuteOperation execOperations;

            switch (operation)
            {
            case OperationTypes.add:
                execOperations = Add;
                break;

            case OperationTypes.substract:
                execOperations = Substract;
                break;

            case OperationTypes.multiply:
                execOperations = Multiply;
                break;

            case OperationTypes.divide:
                execOperations = Divide;
                break;

            default:
                execOperations = Add;
                break;
            }

            return(execOperations);
        }
Пример #7
0
        public Employee CreateEmployee(string name, OperationTypes allowedOperationTypes)
        {
            var newEmployee = new Employee(Employees.Count, name, allowedOperationTypes);

            Employees.Add(newEmployee);
            return(newEmployee);
        }
Пример #8
0
        /// <summary>
        /// Sets the source property value from a <see cref="JToken"/>.
        /// </summary>
        /// <param name="value">The source value.</param>
        /// <param name="json">The <see cref="JToken"/>.</param>
        /// <param name="operationType">The single <see cref="Mapper.OperationTypes"/> being performed to enable selection.</param>
        public void SetSrceValue(TSrce value, JToken json, OperationTypes operationType)
        {
            if (value == null)
                throw new ArgumentNullException(nameof(value));

            SetSrceValue(value, (TSrceProperty)((IODataPropertyMapper)this).GetSrceValue(json, operationType), operationType);
        }
Пример #9
0
        /// <summary>
        /// Maps the destination to the source.
        /// </summary>
        /// <param name="destinationEntity">The destination entity.</param>
        /// <param name="operationType">The single <see cref="Mapper.OperationTypes"/> being performed to enable selection.</param>
        /// <returns>The source entity.</returns>
        public TSrce MapToSrce(TDest destinationEntity, OperationTypes operationType = OperationTypes.Unspecified)
        {
            if (destinationEntity == null)
            {
                return(null);
            }

            var srce = new TSrce();

            foreach (var map in Mappings)
            {
                if (map.OperationTypes.HasFlag(operationType))
                {
                    map.MapToSrce(destinationEntity, srce, operationType);
                }
            }

            srce = OnMapToSrce(destinationEntity, srce, operationType);

            if (srce != null && MapToSrceNullWhenIsInitial && srce is ICleanUp ic && ic.IsInitial)
            {
                return(null);
            }

            return(srce);
        }
Пример #10
0
        /// <summary>
        /// Gets the source property value from a <see cref="JToken"/>.
        /// </summary>
        /// <param name="json">The <see cref="JToken"/>.</param>
        /// <param name="operationType">The single <see cref="Mapper.OperationTypes"/> being performed to enable selection.</param>
        /// <returns>The source value.</returns>
        object IODataPropertyMapper.GetSrceValue(JToken json, OperationTypes operationType)
        {
            if (json == null)
                throw new ArgumentNullException(nameof(json));

            if (Converter != null)
                return (TSrceProperty)Converter.ConvertToSrce(Cleaner.Clean(json.ToObject(Converter.DestType)));

            if (!IsSrceComplexType)
                return json.ToObject<TSrceProperty>();

            if (!json.HasValues)
                return null;

            var em = (IODataMapper)Mapper;
            if (SrceComplexTypeReflector.ComplexTypeCode == Reflection.ComplexTypeCode.Object)
                return (em == null) ? json.ToObject(SrceComplexTypeReflector.PropertyInfo.PropertyType) : em.MapFromOData(json, operationType);

            if (json.Type != JTokenType.Array)
                throw new MapperException($"Property '{SrcePropertyName}' has Type '{SrcePropertyType.Name}' and therefore expects a JTokenType.Array not JTokenType.{json.Type}.");

            if (em == null)
                return json.ToObject(SrceComplexTypeReflector.PropertyInfo.PropertyType);

            var vals = new List<Object>();
            foreach (var jao in json.Children<JObject>())
            {
                vals.Add(em.MapFromOData(jao, operationType));
            }

            return SrceComplexTypeReflector.CreateValue(vals);
        }
        public IOperation CreateOperation(OperationTypes operationType)
        {
            IOperation newOperation = null;

            switch (operationType)
            {
            case OperationTypes.Addition:
                newOperation = new AdditionOperation();
                break;

            case OperationTypes.Subtraction:
                newOperation = new SubtractionOperation();
                break;

            case OperationTypes.Multiplication:
                newOperation = new MultiplicationOperation();
                break;

            case OperationTypes.Division:
                newOperation = new DivisionOperation();
                break;

            case OperationTypes.Modulus:
                newOperation = new ModulusOperation();
                break;

            case OperationTypes.Undefined:
                newOperation = new NullOperation();
                break;
            }

            return(newOperation);
        }
Пример #12
0
 public static List <Operation> GetOne(OperationTypes type, string ip, List <List <Value> > before = default, List <List <Value> > after = default)
 {
     return(new List <Operation>()
     {
         new Operation(type, ip, before, after)
     });
 }
Пример #13
0
        /// <summary>
        /// Creates a source entity mapping values from the <see cref="DatabaseParameters"/>.
        /// </summary>
        /// <param name="dr">The <see cref="DatabaseParameters"/>.</param>
        /// <param name="operationType">The single <see cref="Mapper.OperationTypes"/> being performed to enable selection.</param>
        /// <param name="data">An optional (additional) data object.</param>
        /// <returns>A <typeparamref name="TSrce"/> instance populated from the <see cref="DatabaseParameters"/>.</returns>
        public TSrce MapFromDb(DatabaseRecord dr, OperationTypes operationType = OperationTypes.Unspecified, object data = null)
        {
            if (dr == null)
            {
                throw new ArgumentNullException(nameof(dr));
            }

            TSrce value = new TSrce();

            foreach (IDatabasePropertyMapper <TSrce> map in Mappings)
            {
                if (map.OperationTypes.HasFlag(operationType) && map.MapDestToSrceWhen(dr))
                {
                    map.SetSrceValue(value, dr, operationType);
                }
            }

            value = OnMapFromDb(value, dr, operationType, data);

            if (value != null && MapFromDbNullWhenIsInitial && value is ICleanUp ic && ic.IsInitial)
            {
                return(null);
            }

            return(value);
        }
Пример #14
0
        public static SupportedStatus OperationVersionSupported(OperationTypes operationType, int version, out int current)
        {
            current = -1;
            if (OperationsToSupportedProtocolVersions.TryGetValue(operationType, out var supportedProtocols) == false)
            {
                throw new ArgumentException($"This is a bug. Probably you forgot to add '{operationType}' operation " +
                                            $"to the '{nameof(OperationsToSupportedProtocolVersions)}' dictionary.");
            }

            for (var i = 0; i < supportedProtocols.Count; i++)
            {
                current = supportedProtocols[i];
                if (current == version)
                {
                    return(SupportedStatus.Supported);
                }

                if (current < version)
                {
                    return(SupportedStatus.NotSupported);
                }
            }

            return(SupportedStatus.OutOfRange);
        }
        public OperationItemControl(OperationTypes operation, bool isRoot)
        {
            InitializeComponent();

            RanetHotButton add = new RanetHotButton()
            {
                Margin = new Thickness(5, 0, 0, 0)
            };

            add.Click  += new RoutedEventHandler(add_Click);
            add.Width   = 18;
            add.Height  = 18;
            add.Content = UiHelper.CreateIcon(UriResources.Images.AddHot16);
            LayoutRoot.Children.Add(add);
            Grid.SetColumn(add, 1);

            m_IsRoot = isRoot;
            operationControl.HorizontalContentAlignment = HorizontalAlignment.Stretch;

            operationControl.SelectionChanged += new SelectionChangedEventHandler(operationControl_SelectionChanged);
            operationControl.DropDownClosed   += new EventHandler(operationControl_DropDownClosed);

            InitItems();

            if (operationControl.Items.Count > 0)
            {
                operationControl.SelectedIndex = 0;
            }
        }
Пример #16
0
        private void ShowEditForm(OrderEntity orderEntity, OperationTypes operationType)
        {
            //OrderForm caForm = CommonFunction.GetOrderForm(orderEntity);
            //caForm.Width = this.ActualWidth;
            //caForm.Height = this.ActualHeight;
            //caForm.Closed += (o, e) =>
            //{
            //    if (caForm.IsNeedToRefresh)
            //    {
            //        this.GetOrders();
            //    }
            //};
            //caForm.Show();
            FBPage page = FBPage.GetPage(orderEntity);

            page.EditForm.OperationType = operationType;
            FrameworkElement plRoot = CommonFunction.ParentLayoutRoot;
            EntityBrowser    eb     = new EntityBrowser(page);

            eb.EntityScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            eb.Show <string>(DialogMode.Default, plRoot, "", (result) => { });


            page.RefreshData += (o, e) =>
            {
                this.GetOrders();
            };
            page.PageClosing += (o, e) =>
            {
                eb.Close();
            };
        }
Пример #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UserDataRule"/> class.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="appliesWhen">The rule can be applied to insert, update, and/or soft delete operations.</param>
        /// <exception cref="ArgumentOutOfRangeException">appliesWhen;appliesWhen may only be a combination of Insert, Update, or Delete</exception>
        /// <remarks>This will have no effect on hard deletes.</remarks>
        public UserDataRule(string columnName, string propertyName, OperationTypes appliesWhen) : base(columnName, appliesWhen)
        {
            if (appliesWhen.HasFlag(OperationTypes.Select))
                throw new ArgumentOutOfRangeException("appliesWhen", appliesWhen, "appliesWhen may only be a combination of Insert, Update, or Delete");

            PropertyName = propertyName;
        }
Пример #18
0
 /// <summary>
 /// Sets the source property value.
 /// </summary>
 /// <param name="entity">The entity value.</param>
 /// <param name="value">The property value.</param>
 /// <param name="operationType">The single <see cref="Mapper.OperationTypes"/> being performed to enable selection.</param>
 protected void SetSrceValue(TSrce entity, TSrceProperty value, OperationTypes operationType)
 {
     if (OperationTypes.HasFlag(operationType))
     {
         SrcePropertyInfo.SetValue(entity, value);
     }
 }
        public OperationItemControl(OperationTypes operation, bool isRoot)
        {
            InitializeComponent();

            RanetHotButton add = new RanetHotButton() { Margin = new Thickness(5, 0, 0, 0) };
            add.Click += new RoutedEventHandler(add_Click);
            add.Width = 18;
            add.Height = 18;
            add.Content = UiHelper.CreateIcon(UriResources.Images.AddHot16);
            LayoutRoot.Children.Add(add);
            Grid.SetColumn(add, 1);

            m_IsRoot = isRoot;
            operationControl.HorizontalContentAlignment = HorizontalAlignment.Stretch;

            operationControl.SelectionChanged += new SelectionChangedEventHandler(operationControl_SelectionChanged);
            operationControl.DropDownClosed += new EventHandler(operationControl_DropDownClosed);

            InitItems();

            if (operationControl.Items.Count > 0)
            {
                operationControl.SelectedIndex = 0;
            }
        }
Пример #20
0
 public Operator(string symbol, OperatorTypes type, int precedence, AssociativityTypes associativity, OperationTypes operationType)
 {
     this.Symbol            = symbol;
     this.Type              = type;
     this.Precedence        = precedence;
     this.AssociativityType = associativity;
     this.OperationType     = operationType;
 }
Пример #21
0
 protected void SaveLogOperation(OperationTypes operation, object objectKey, object masterKey = null, string actionName = null)
 {
     if (Request.Form["hfContainer"].FirstOrDefault() != null)
     {
         var html = Request.Form["hfContainer"].FirstOrDefault();
         SaveLogOperation(this.ControllerName?.ToLower(), actionName ?? this.ActionName, html, operation, objectKey, masterKey);
     }
 }
Пример #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserDataRule" /> class.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="kind">The kind.</param>
 /// <param name="appliesWhen">The rule can be applied to insert, update, and/or soft delete operations.</param>
 /// <exception cref="ArgumentOutOfRangeException">appliesWhen;appliesWhen may only be a combination of Insert, Update, or Delete</exception>
 /// <remarks>
 /// This will have no effect on hard deletes.
 /// </remarks>
 public DateTimeRule(string columnName, DateTimeKind kind, OperationTypes appliesWhen) : base(columnName, appliesWhen)
 {
     if (appliesWhen.HasFlag(OperationTypes.Select))
         throw new ArgumentOutOfRangeException("appliesWhen", appliesWhen, "appliesWhen may only be a combination of Insert, Update, or Delete");
     if (kind == DateTimeKind.Unspecified)
         throw new ArgumentOutOfRangeException("kind");
     Kind = kind;
 }
Пример #23
0
        public void CreateOperation(OperationTypes operationType, decimal deltaMoney)
        {
            // проверить доступ сотрудника

            // создать операцию

            // применить операцию
        }
Пример #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ColumnRule"/> class.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="appliesWhen">The applies when.</param>
        /// <exception cref="ArgumentException"></exception>
        protected ColumnRule(string columnName, OperationTypes appliesWhen) : base(appliesWhen)
        {
            if (string.IsNullOrEmpty(columnName))
                throw new ArgumentException($"{nameof(columnName)} is null or empty.", nameof(columnName));

            ColumnName = columnName;

        }
Пример #25
0
 public static SupportedFeatures GetSupportedFeaturesFor(OperationTypes type, int protocolVersion)
 {
     if (SupportedFeaturesByProtocol[type].TryGetValue(protocolVersion, out var features) == false)
     {
         throw new ArgumentException($"{type} in protocol {protocolVersion} was not found in the features set.");
     }
     return(features);
 }
Пример #26
0
 public void CleanAll()
 {
     MyOperationType = OperationTypes.FirstOrDefault();
     MyAccName       = AvailableAccNames.FirstOrDefault();
     Amount          = null;
     MyCurrency      = Currencies.FirstOrDefault();
     MyTagPickerVm.Tags.Clear();
     MyComment = "";
 }
Пример #27
0
    /// <summary>
    /// Initializes a new instance of the <see cref="UserDataRule"/> class.
    /// </summary>
    /// <param name="columnName">Name of the column.</param>
    /// <param name="propertyName">Name of the property.</param>
    /// <param name="appliesWhen">The rule can be applied to insert, update, and/or soft delete operations.</param>
    /// <exception cref="ArgumentOutOfRangeException">appliesWhen;appliesWhen may only be a combination of Insert, Update, or Delete</exception>
    /// <remarks>This will have no effect on hard deletes.</remarks>
    public UserDataRule(string columnName, string propertyName, OperationTypes appliesWhen) : base(columnName, appliesWhen)
    {
        if (appliesWhen.HasFlag(OperationTypes.Select))
        {
            throw new ArgumentOutOfRangeException(nameof(appliesWhen), appliesWhen, "appliesWhen may only be a combination of Insert, Update, or Delete");
        }

        PropertyName = propertyName;
    }
Пример #28
0
 public MessageOperation(Id64 zone, Id64 message, Id64 operation, OperationTypes operationType, AddressDefinition address1, AddressDefinition address2, AddressDefinition address3, short isVirtual) : base(zone, Messages.RUN_TASK, message)
 {
     Operation     = operation;
     OperationType = operationType;
     Address1      = address1;
     Address2      = address2;
     Address3      = address3;
     IsVirtual     = isVirtual;
 }
Пример #29
0
        public Employee(int number, string name, string password,
                        OperationTypes allowedOperationTypes)
            : base(number, name)
        {
            IsSingIn = false;

            Password = password;
            AllowedOperationTypes = allowedOperationTypes;
        }
Пример #30
0
    /// <summary>
    /// Initializes a new instance of the <see cref="ValueRule"/> class.
    /// </summary>
    /// <param name="columnName">Name of the column.</param>
    /// <param name="valueFactory">The value factory.</param>
    /// <param name="appliesWhen">The applies when.</param>
    /// <exception cref="ArgumentOutOfRangeException">appliesWhen;appliesWhen may only be a combination of Insert, Update, or Delete</exception>
    public ValueRule(string columnName, ColumnValueGenerator valueFactory, OperationTypes appliesWhen) : base(columnName, appliesWhen)
    {
        if (appliesWhen.HasFlag(OperationTypes.Select))
        {
            throw new ArgumentOutOfRangeException(nameof(appliesWhen), appliesWhen, "appliesWhen may only be a combination of Insert, Update, or Delete");
        }

        ValueFactory = valueFactory;
    }
Пример #31
0
 /// <summary>
 /// Gets the source property value.
 /// </summary>
 /// <param name="entity">The entity value.</param>
 /// <param name="operationType">The single <see cref="Mapper.OperationTypes"/> being performed to enable selection.</param>
 /// <returns>The property value.</returns>
 protected TSrceProperty GetSrceValue(TSrce entity, OperationTypes operationType)
 {
     if (OperationTypes.HasFlag(operationType))
     {
         return(SrcePropertyExpression.GetValue(entity));
     }
     else
     {
         return(default);
 public DiskSpaceRequirements(OperationTypes operation, Host host, string updateName, long requiredDiskSpace, long availableDiskSpace, long reclaimableDiskSpace)
 {
     Operation            = operation;
     Host                 = host;
     UpdateName           = updateName;
     RequiredDiskSpace    = requiredDiskSpace;
     AvailableDiskSpace   = availableDiskSpace;
     ReclaimableDiskSpace = reclaimableDiskSpace;
 }
Пример #33
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ColumnRule"/> class.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="appliesWhen">The applies when.</param>
        /// <exception cref="ArgumentException"></exception>
        protected ColumnRule(string columnName, OperationTypes appliesWhen) : base(appliesWhen)
        {
            if (string.IsNullOrEmpty(columnName))
            {
                throw new ArgumentException($"{nameof(columnName)} is null or empty.", nameof(columnName));
            }

            ColumnName = columnName;
        }
        public OperationTreeNode(OperationTypes operation, bool isRoot, List<LevelPropertyInfo> properties)
        {
            m_Properties = properties;
            item_ctrl = new OperationItemControl(operation, isRoot);
            Header = item_ctrl;
            item_ctrl.CustomCommandClick += new EventHandler<CustomItemEventArgs>(item_ctrl_CustomCommandClick);

            IsExpanded = true;
        }
 public DiskSpaceRequirements(OperationTypes operation, Host host, string updateName, long requiredDiskSpace, long availableDiskSpace, long reclaimableDiskSpace)
 {
     Operation = operation;
     Host = host;
     UpdateName = updateName;
     RequiredDiskSpace = requiredDiskSpace;
     AvailableDiskSpace = availableDiskSpace;
     ReclaimableDiskSpace = reclaimableDiskSpace;
 }
Пример #36
0
        /// <summary>
        /// Maps the source to the destination updating an existing object.
        /// </summary>
        /// <param name="sourceEntity">The source entity.</param>
        /// <param name="destinationEntity">The destination entity.</param>
        /// <param name="operationType">The single <see cref="Mapper.OperationTypes"/> being performed to enable selection.</param>
        public void MapToDest(TSrce sourceEntity, TDest destinationEntity, OperationTypes operationType = OperationTypes.Unspecified)
        {
            foreach (var map in Mappings)
            {
                map.MapToDest(sourceEntity, destinationEntity, operationType);
            }

            destinationEntity = OnMapToDest(sourceEntity, destinationEntity, operationType);
        }
Пример #37
0
        public void InitControl(OperationTypes operationType)
        {
            columnHeaderStyle = (Style)Application.Current.Resources["DataGridColumnHeaderStyle"];
            this.Style = (Style)Application.Current.Resources["DataGridStyle"];
            this.RowStyle = (Style)Application.Current.Resources["DataGridRowStyle"];
            //this.ColumnHeaderStyle = 
            this.Columns.Clear();
            for (int i = 0; i < GridItems.Count; i++)
            {
                DataGridColumn dgtc = GetDataGridColumn(GridItems[i]);
                string toolTipText = GridItems[i].TipText;


                dgtc.Header = GridItems[i].PropertyDisplayName;
                dgtc.Width = new DataGridLength(GridItems[i].Width);
                
                dgtc.SortMemberPath = GridItems[i].PropertyName;
                dgtc.CanUserSort = true;
                
                // 可写背景色
                if (!GridItems[i].IsReadOnly && (operationType != OperationTypes.Browse && operationType != OperationTypes.Audit))
                {
                    dgtc.CellStyle = writtableStyle;
                    
                    dgtc.IsReadOnly = false;
                }
                else
                {
                    dgtc.IsReadOnly = true;
                }
                this.Columns.Add(dgtc);

                var styleHeader = this.columnHeaderStyle;
                if (toolTipText != null)
                {
                    //<TextBlock Margin="3 2 0 2"  Foreground="{StaticResource HeaderBackgroundfontColor1}" x:Name="ContentFontColor">
                    //</TextBlock>

                    XElementString gridXCs = new XElementString("TextBlock",
                        new XAttributeString("Margin", "3 2 0 2"),
                        new XAttributeString("Foreground", "{StaticResource HeaderBackgroundfontColor1}"),
                        new XAttributeString("x:Name", "ContentFontColor"),
                        new XAttributeString("Text", "{Binding  Converter={StaticResource GridHeaderConverter}, RelativeSource={RelativeSource TemplatedParent}}"),
                        new XAttributeString("ToolTipService.ToolTip", toolTipText)
                        );

                    var dtHeadTextBlockTemplate = DataTemplateHelper.GetDataTemplate(gridXCs);

                    styleHeader = styleHeader.Copy();
                    styleHeader.SetStyle(DataGridColumnHeader.ContentTemplateProperty, dtHeadTextBlockTemplate);
                }
                dgtc.HeaderStyle = styleHeader;
                
            }
        }
Пример #38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SoftDeleteRule"/> class.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="deletedValue">The value that represents a deleted row.</param>
 /// <param name="appliesWhen">The rule can be applied to delete and/or select operations.</param>
 /// <exception cref="ArgumentOutOfRangeException">appliesWhen;appliesWhen may only be Select or Delete</exception>
 public SoftDeleteRule(string columnName, object deletedValue, OperationTypes appliesWhen) : base(columnName, appliesWhen)
 {
     switch (appliesWhen)
     {
         case OperationTypes.Select:
         case OperationTypes.Delete:
         case OperationTypes.SelectOrDelete:
             break;
         default:
             throw new ArgumentOutOfRangeException("appliesWhen", appliesWhen, "appliesWhen may only be Select or Delete");
     }
     DeletedValue = deletedValue;
 }
Пример #39
0
        public CForm(OrderEntity source)
        {
            orderEntity = source;

            Type type = typeof(OrderSource<>).MakeGenericType(new Type[] { source.OrderType });
            OrderSource = Activator.CreateInstance(type) as IOrderSource;

            if (string.IsNullOrEmpty(source.OrderID))
            {
                OperationType = OperationTypes.New;
                this.GridToolBar_Delete.Visibility = Visibility.Collapsed;
            }
            else
            {
                OperationType = OperationTypes.Edit;
            }
            InitializeComponent();

            
            List<string[]> FInfo = new List<string[]>();
            FInfo.Add(new string[]{"单据编号", "OrderCode", "OrderCode", "0", "0"});
            FInfo.Add(new string[] { "状态", "OrderStates", "OrderStates", "0", "0" });
            FInfo.Add(new string[] { "创建人", "CreateUser", "CreateUser", "0", "0" });
            FInfo.Add(new string[] { "创建时间", "CreateDate", "CreateDate", "0", "0" });
            this.GForm.LeftFForm.Items = GetFieldItems(FInfo);
            this.GForm.LeftFForm.InitForm();

            FInfo.Clear();
            FInfo.Add(new string[] { "单据类型", "OrderType", "OrderType", "0", "0" });
            FInfo.Add(new string[] { "申请人", "Applicant", "Applicant", "3", "1" });
            FInfo.Add(new string[] { "申请部门", "AppliedDepartMent", "AppliedDepartMentData", "2", "1" });
            FInfo.Add(new string[] { "申请公司", "Company", "CompanyData", "2", "1" });
            this.GForm.RightForm.Items = GetFieldItems(FInfo);
            this.GForm.RightForm.InitForm();

            FInfo.Clear();
            FInfo.Add(new string[] { "备注", "Remark", "Remark", "4", "0" });
            this.GFormRemark.Items = GetFieldItems(FInfo);
            this.GFormRemark.InitForm();

            FInfo.Clear();
            FInfo.Add(new string[] { "编号", "SerialNumber", "75", "1" });
            FInfo.Add(new string[] { "预算项目", "ObjectName", "200", "1" });
            FInfo.Add(new string[] { "可用金额", "UsableMoney", "100", "1" });
            FInfo.Add(new string[] { "已用金额", "UsedMoney", "100", "0" });
            FInfo.Add(new string[] { "费用类型", "ChargeType", "100", "1" });
            this.AGrid.Items= GetDataGridItem(FInfo);
            this.AGrid.InitGrid();

            BindingData();
        }
        public FilterOperationItemControl(OperationTypes operation)
        {
            Operation = operation;
            Text = operation.ToString();

            switch (operation)
            { 
                case OperationTypes.And:
                    Icon = UriResources.Images.And16;
                    break;
                case OperationTypes.Or:
                    Icon = UriResources.Images.Or16;
                    break;
            }
            
        }
Пример #41
0
        /// <summary>
        /// Записывает "описание операции" в хранилище
        /// </summary>
        /// <param name="operationDescription">"описание операции"</param>
        public void Save(int argument1,
            int argument2,
            decimal operationResult,
            OperationTypes operationType)
        {
            var operationDescription = new OperationDescription
            {
                //аргумент 1
                Argument1 = argument1,
                //аргумент 2
                Argument2 = argument2,
                //тип операции
                OperationType = operationType,
                //результат операции
                OperationResult = operationResult,
                //время операции (проставляется текущее)
                OperationTime = dateTimeService.DateTimeNow()
            };

            //сохраняем "описание операции" в хранилище
            this.Save(operationDescription);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ValidateWithNotifyDataErrorInfo"/> class.
 /// </summary>
 /// <param name="appliesWhen">The rule applies when.</param>
 /// <exception cref="ArgumentOutOfRangeException">appliesWhen;appliesWhen may only be a combination of Insert or Update</exception>
 public ValidateWithNotifyDataErrorInfo(OperationTypes appliesWhen) : base(appliesWhen)
 {
     if (appliesWhen.HasFlag(OperationTypes.Select) || appliesWhen.HasFlag(OperationTypes.Delete))
         throw new ArgumentOutOfRangeException("appliesWhen", appliesWhen, "appliesWhen may only be a combination of Insert or Update");
 }
Пример #43
0
 public void InitControl(OperationTypes operationType)
 {
 }
Пример #44
0
        private void ShowEditForm(OrderEntity orderEntity, OperationTypes operationType)
        {
            //OrderForm caForm = CommonFunction.GetOrderForm(orderEntity);
            //caForm.Width = this.ActualWidth;
            //caForm.Height = this.ActualHeight;
            //caForm.Closed += (o, e) =>
            //{
            //    if (caForm.IsNeedToRefresh)
            //    {
            //        this.GetOrders();
            //    }
            //};
            //caForm.Show();
            FBPage page = FBPage.GetPage(orderEntity);
            page.EditForm.OperationType = operationType;
            FrameworkElement plRoot = CommonFunction.ParentLayoutRoot;
            EntityBrowser eb = new EntityBrowser(page);
            eb.EntityScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            eb.Show<string>(DialogMode.Default, plRoot, "", (result) => { });


            page.RefreshData += (o, e) =>
            {
                this.GetOrders();
            };
            page.PageClosing += (o, e) =>
            {
                eb.Close();
            };
        }
 public FilterOperation(OperationTypes operation)
 {
     Operation = operation;           
 }
Пример #46
0
        private void ShowEditForm(OrderEntity orderEntity, OperationTypes operationType)
        {
           
            FBPage page = FBPage.GetPage(orderEntity);
            page.EditForm.OperationType = operationType;
            FrameworkElement plRoot = CommonFunction.ParentLayoutRoot;
            EntityBrowser eb = new EntityBrowser(page);
            eb.Show<string>(DialogMode.Default, plRoot, "", (result) => { });


            eb.MinWidth = 400;
            eb.MinHeight = 300;
                        
            page.PageClosing += (o, e) =>
            {
                eb.Close();
            };
        }
Пример #47
0
 public void InitControl(OperationTypes operationType)
 {
     OperationType = operationType;
     IsReadOnly = !(OperationType == OperationTypes.Add || OperationType == OperationTypes.Edit);
     InitForm();
 }
Пример #48
0
        public void InitControl(OperationTypes operationType)
        {
            this.OperationType = operationType;
            //if (operationType == OperationTypes.Audit || operationType == OperationTypes.Browse)
            //{
                //UploadControl.FileState = SMT.SaaS.FrameworkUI.FileUpload.Constants.FileStates.FileBrowse;
                //UploadControl.InitBtn(Visibility.Collapsed, Visibility.Collapsed);
                //模块编码,一般为表名
                string ModelName = uploadInfo.ModelName;
                //动作
                //OperationType formTypes = ;\
                FormTypes formTypes = new FormTypes();
                string ide = UploadID;
                switch (OperationType)
                {
                    case OperationTypes.Add:
                        formTypes = FormTypes.New;
                        break;
                    case OperationTypes.Edit:
                        formTypes = FormTypes.Edit;
                        break;
                    case OperationTypes.ReSubmit:
                        formTypes = FormTypes.Resubmit;
                        break;
                    case OperationTypes.Browse:
                        formTypes = FormTypes.Browse;
                        break;

                    case OperationTypes.Audit:
                        formTypes = FormTypes.Audit;
                        break;
                }
                if (!string.IsNullOrEmpty(UploadID))
                {
                    //UploadControl.Load_fileData(, this);//获取相应的上传信息
                    InitFileLoad(ModelName, UploadID, formTypes, NewUploadControl, true);
                }
            //}
            else
            {
                //UploadControl.InitBtn(Visibility.Visible, Visibility.Collapsed);//隐藏删除、添加按钮
                //UploadControl.EntityEditor = this;//查看、审核时初始化用来解决异步显示控件的问题
            }
        }
Пример #49
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ValidationRule"/> class.
        /// </summary>
        /// <param name="appliesWhen">The rule applies when.</param>
        protected ValidationRule(OperationTypes appliesWhen) : base(appliesWhen)
        {

        }
Пример #50
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuditRule"/> class.
 /// </summary>
 /// <param name="appliesWhen">The rule applies when.</param>
 protected AuditRule(OperationTypes appliesWhen)
 {
     AppliesWhen = appliesWhen;
 }
        /// <summary>
        /// Validates an atomic instruction.
        /// </summary>
        /// <param name="programInternalForm">The program internal form.</param>
        /// <returns>The error encountered.</returns>
        protected ErrorTypes ValidateAtomic(List<PIFEntry> programInternalForm)
        {
            List<string> tokens = new List<string>();
            string op = null;
            foreach (PIFEntry entry in programInternalForm)
            {
                if (entry.Code <= 1)
                {
                    tokens.Add(entry.Code.ToString());
                }
                else
                {
                    tokens.Add(entry.Symbol);
                }

                if (entry.Symbol == "}")
                {
                    return ErrorTypes.Invalid;
                }

                if (ScopeScanner.AssignmentOperators.Contains(entry.Symbol))
                {
                    op = entry.Symbol;
                    break;
                }
            }

            if (!parser.ValidateExpression(tokens, opGrammar))
            {
                return ErrorTypes.Invalid;
            }

            if (op == "+=")
            {
                opType = OperationTypes.Addition;
            }

            if (op == "-=")
            {
                opType = OperationTypes.Subtraction;
            }

            if (op == "++")
            {
                opType = OperationTypes.Increment;
            }

            if (op == "--")
            {
                opType = OperationTypes.Decrement;
            }

            StringBuilder variableBuilder = new StringBuilder();
            int i = 0;

            while (programInternalForm[i].Symbol != op)
            {
                variableBuilder.Append(programInternalForm[i].Symbol);
                i++;
            }

            i++;
            variable = variableBuilder.ToString();
            StringBuilder expressionBuilder = new StringBuilder();

            while (programInternalForm[i].Symbol != ";" && programInternalForm[i].Symbol != ",")
            {
                expressionBuilder.Append(programInternalForm[i].Symbol);
                i++;
            }

            expression = expressionBuilder.ToString();

            return ErrorTypes.Valid;
        }
Пример #52
0
        private static OperationData FindOperation(OperationTypes type)
        {
            lock (_lockObject)
            {
                for (int i = 0; i < _allOperations.Count; ++i)
                {
                    if (_allOperations[i].Type == type)
                        return _allOperations[i];
                }
            }

            return null;
        }
Пример #53
0
 public OperationData(OperationTypes type)
 {
     Type = type;
     Count = 1;
 }
Пример #54
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RestrictColumn"/> class.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="appliesWhen">While operations are being restricted.</param>
 /// <param name="exceptWhen">This function will return true if the rule doesn't apply to this user..</param>
 public RestrictColumn(string columnName, OperationTypes appliesWhen, ExceptWhenPredicate exceptWhen) : base(appliesWhen)
 {
     ColumnName = columnName;
     ExceptWhen = exceptWhen;
 }