/// <summary>
        /// Store a value into the history tables.
        /// </summary>
        /// <param name="historyType">Type of history information. @see HistoryType</param>
        /// <param name="historyScale">Scale of history data. @see HistoryScale</param>
        /// <param name="historyIndex">Index in the data to obtain</param>
        /// <param name="historyValue">Index in the value to store</param>
        public void SetHistory(HistoryType historyType, HistoryScale historyScale, int historyIndex, short historyValue)
        {
            if (historyType < 0 || historyType >= HistoryType.Count ||
                historyScale < 0 || historyScale >= HistoryScale.Count ||
                historyIndex < 0 || historyIndex >= Constants.HistoryCount)
            {
                return;
            }

            short[] history = null;
            switch (historyType)
            {
            case HistoryType.Res:
                history = ResHist;
                break;

            case HistoryType.Com:
                history = ComHist;
                break;

            case HistoryType.Ind:
                history = IndHist;
                break;

            case HistoryType.Money:
                history = MoneyHist;
                break;

            case HistoryType.Crime:
                history = CrimeHist;
                break;

            case HistoryType.Pollution:
                history = PollutionHist;
                break;

            default:
                //NOT_REACHED();
                break;
            }

            int offset = 0;

            switch (historyScale)
            {
            case HistoryScale.Short:
                offset = 0;
                break;

            case HistoryScale.Long:
                offset = 120;
                break;

            default:
                //NOT_REACHED();
                break;
            }

            history[historyIndex + offset] = historyValue;
        }
        public Modification[] Parse(TextReader bkLog, DateTime from, DateTime to)
        {
            // Read to the first ChangeSet. The first entry in the log
            // information will begin with this line. If no ChangeSet file
            // lines are found then there is nothing to do.
            currentLine = ReadToNotPast(bkLog, BK_CHANGESET_LINE, null);
            fileHistory = DetermineHistoryType();

            var mods = new List<Modification>();
            while (currentLine != null)
            {
                // Parse the ChangeSet entry and read till next ChangeSet
                Modification mod;
                if (fileHistory == HistoryType.Pre40Verbose)
                    mod = ParsePre40VerboseEntry(bkLog);
                else if (fileHistory == HistoryType.Pre40NonVerbose)
                    mod = ParsePre40NonVerboseEntry(bkLog);
                else
                    mod = ParsePost40VerboseEntry(bkLog);

                // Add all the modifications to the local list.
                mods.Add(mod);

                // Read to the next non-blank line.
                currentLine = bkLog.ReadLine();
            }

            return mods.ToArray();
        }
Esempio n. 3
0
        /// <summary>
        /// Unpins the specified recent history record.
        /// </summary>
        /// <param name="historyType">The history type.</param>
        /// <param name="values">The values necessary for loading the object as a dictionary of key value pairs.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="values" /> is <c>null</c> or empty.</exception>
        public void Unpin(HistoryType historyType, IDictionary <string, object> values)
        {
            if (values == null || !values.Any())
            {
                throw new ArgumentNullException("values");
            }

            var queryStringValues = values.ToQueryString(true);
            var sqlParameters     = new List <SqlParameter>();

            sqlParameters.Add(new SqlParameter {
                ParameterName = "@return_value", SqlDbType = SqlDbType.Int, Direction = ParameterDirection.ReturnValue
            });
            sqlParameters.Add(new SqlParameter {
                ParameterName = "@HistoryType_RHC", SqlDbType = SqlDbType.VarChar, Value = historyType.ToString()
            });
            sqlParameters.Add(new SqlParameter {
                ParameterName = "@ObjectValues", SqlDbType = SqlDbType.VarChar, Value = queryStringValues
            });
            sqlParameters.Add(new SqlParameter {
                ParameterName = "@IsPinned", SqlDbType = SqlDbType.Bit, Value = false
            });
            sqlParameters.Add(new SqlParameter {
                ParameterName = "@UserID", SqlDbType = SqlDbType.VarChar, Value = UserService.Username
            });

            SqlService.ExecuteNonQuery(connectionName, "RecentHistoryUpdate", sqlParameters);

            // Data changed so remove all variations of history
            // Note: Changed to explicitly set key models instead of going by key name while non-cluster safe keysInUse process is still in place.
            CacheService.Remove(new KeyModel(CacheType.User, "History").Add("Single").Add(historyType).Add(queryStringValues));
            CacheService.Remove(new KeyModel(CacheType.User, "History").Add("All").Add(historyType));
        }
        private string GetHistoryType(HistoryType type)
        {
            var optionCode = string.Empty;

            switch (type)
            {
            case HistoryType.DividendHistory:
                optionCode = "v";
                break;

            case HistoryType.Day:
                optionCode = "d";
                break;

            case HistoryType.Week:
                optionCode = "w";
                break;

            case HistoryType.Month:
                optionCode = "m";
                break;
            }

            var option = $"&g={optionCode}";

            return(option);
        }
Esempio n. 5
0
        public void ILayerChangeCompleted <T>(Action <ILayer> set, HistoryType type, Func <ILayer, T> getUndo, Action <ILayer, T> setUndo)
        {
            // History
            LayersPropertyHistory history = new LayersPropertyHistory(type);

            // Selection
            this.SetValue((layerage) =>
            {
                ILayer layer = layerage.Self;

                var previous        = getUndo(layer);
                history.UndoAction += () =>
                {
                    // Refactoring
                    layer.IsRefactoringRender     = true;
                    layer.IsRefactoringIconRender = true;
                    setUndo(layer, previous);
                };

                // Refactoring
                layer.IsRefactoringRender     = true;
                layer.IsRefactoringIconRender = true;
                layerage.RefactoringParentsRender();
                layerage.RefactoringParentsIconRender();
                set(layer);
            });

            // History
            this.HistoryPush(history);

            this.Invalidate(); // Invalidate
        }
Esempio n. 6
0
 public GetStockHistoryQuery(string symbol, HistoryType type, DateTime start, DateTime end)
 {
     Symbol = symbol;
     Type   = type;
     Start  = start;
     End    = end;
 }
Esempio n. 7
0
 private HistoryValue_ImgProp preValue_ImgProp     = null; //图片属性
 //准备历史记录
 public void ReadyHistory(HistoryType type)
 {
     if (type == HistoryType.Action)
     {
         if (form_MA.form_MTimeLine != null && form_MA.form_MTimeLine.currentTimeLineHoder != null)
         {
             preValue_Action = getHistoryValue_Action();
         }
     }
     if (type == HistoryType.Actor)
     {
         if (form_MA.form_MActorList != null && form_MA.form_MActorList.actorsManager != null)
         {
             preValue_Actor = getHistoryValue_Actor();
         }
     }
     if (type == HistoryType.Clips)
     {
         if (form_MA.form_MImgsList != null && form_MA.form_MImgsList.MClipsManager != null)
         {
             preValue_Clips = getHistoryValue_Clips();
         }
     }
     if (type == HistoryType.Imgs)
     {
         if (form_MA.form_MImgsList != null && form_MA.form_MImgsList.mImgsManager != null)
         {
             preValue_Imgs = getHistoryValue_Imgs();
         }
     }
 }
        public void SetsHistoryTypeOfSuperState(HistoryType historyType)
        {
            this.testee.WithHistoryType(historyType);

            this.superState.HistoryType
                .Should().Be(historyType);
        }
Esempio n. 9
0
 public HistoryInfo(string data, String userId, DateTime date, HistoryType type)
 {
     this.Data   = data;
     this.UserId = userId;
     this.Date   = date;
     this.Type   = type;
 }
Esempio n. 10
0
        public void SaveHistory(HistoryType ht, RequisitionItem orig, string uid)
        {
            History h = new History();

            h.ObjectTypeName = this.GetType().ToString();
            h.Identifier     = ItemID;
            h.ChangeType     = ht;

            switch (ht)
            {
            case HistoryType.ADD:
                h.OriginalXML = null;
                h.UpdatedXML  = base.Serialize(this);
                break;

            case HistoryType.UPDATE:
                h.OriginalXML = base.Serialize(orig);
                h.UpdatedXML  = base.Serialize(this);
                break;

            case HistoryType.DELETE:
                h.OriginalXML = base.Serialize(this);
                break;
            }

            h.OrganizationID = Requisition.OrganizationID;
            h.Active         = true;
            h.Save(uid);
        }
Esempio n. 11
0
        /// <summary>
        /// Change T type for Style, save history, invalidate canvas.
        /// </summary>
        /// <typeparam name="T"> The T type property. </typeparam>
        /// <param name="set"> The sets of T. </param>
        /// <param name="type"> The history type. </param>
        /// <param name="getUndo"> The gets of history undo T. </param>
        /// <param name="setUndo"> The sets of history undo T. </param>
        public void StyleChanged <T>(Action <IStyle, Transformer> set, HistoryType type, Func <IStyle, T> getUndo, Action <IStyle, T> setUndo)
        {
            // History
            LayersPropertyHistory history = new LayersPropertyHistory(type);

            // Selection
            this.SetValueWithChildrenOnlyGroup((layerage) =>
            {
                ILayer layer = layerage.Self;

                var previous        = getUndo(layer.Style);
                history.UndoAction += () =>
                {
                    // Refactoring
                    layer.IsRefactoringRender     = true;
                    layer.IsRefactoringIconRender = true;
                    setUndo(layer.Style, previous);
                };

                // Refactoring
                layer.IsRefactoringRender     = true;
                layer.IsRefactoringIconRender = true;
                layerage.RefactoringParentsRender();
                layerage.RefactoringParentsIconRender();
                set(layer.Style, layer.Transform.Transformer);
                this.StandardStyleLayer = layer;
            });

            // History
            this.HistoryPush(history);

            this.Invalidate(); // Invalidate
        }
Esempio n. 12
0
        public void History(HistoryType ht)
        {
            switch (ht)
            {
            case HistoryType.Undo:
                if (HistoryIndex + 1 > HistoryText.Count)
                {
                    SetLastAction("Can't undo further");
                    return;
                }

                HistoryIndex++;
                richTextBoxCode.Text = HistoryText[HistoryIndex];
                SetLastAction($"Undo successful (History: {HistoryIndex}/{HistoryText.Count})");
                break;

            case HistoryType.Redo:
                if (HistoryIndex - 1 < 0)
                {
                    SetLastAction("Can't redo further");
                    return;
                }

                HistoryIndex--;
                richTextBoxCode.Text = HistoryText[HistoryIndex];
                SetLastAction($"Redo successful (History: {HistoryIndex}/{HistoryText.Count})");
                break;
            }
            UpdateHistoryIndex();
        }
Esempio n. 13
0
        /// <summary>
        /// Get a value from the history tables.
        /// </summary>
        /// <param name="historyType">Type of history information. see HistoryType</param>
        /// <param name="historyScale">Scale of history data. see HistoryScale</param>
        /// <param name="historyIndex">Index in the data to obtain</param>
        /// <returns>Historic data value of the requested graph</returns>
        public short getHistory(HistoryType historyType, HistoryScale historyScale, int historyIndex)
        {
            if (historyType < 0 || historyType >= HistoryType.HISTORY_TYPE_COUNT ||
                historyScale < 0 || historyScale >= HistoryScale.HISTORY_SCALE_COUNT ||
                historyIndex < 0 || historyIndex >= HISTORY_COUNT)
            {
                return(0);
            }

            short[] history = null;
            switch (historyType)
            {
            case HistoryType.HISTORY_TYPE_RES:
                history = resHist;
                break;

            case HistoryType.HISTORY_TYPE_COM:
                history = comHist;
                break;

            case HistoryType.HISTORY_TYPE_IND:
                history = indHist;
                break;

            case HistoryType.HISTORY_TYPE_MONEY:
                history = moneyHist;
                break;

            case HistoryType.HISTORY_TYPE_CRIME:
                history = crimeHist;
                break;

            case HistoryType.HISTORY_TYPE_POLLUTION:
                history = pollutionHist;
                break;

            default:
                break;
            }

            int offset = 0;

            switch (historyScale)
            {
            case HistoryScale.HISTORY_SCALE_SHORT:
                offset = 0;
                break;

            case HistoryScale.HISTORY_SCALE_LONG:
                offset = 120;
                break;

            default:
                break;
            }

            short result = history[historyIndex + offset];

            return(result);
        }
Esempio n. 14
0
        public void GetHistory(string userId, HistoryType type)
        {
            var otherUser = service.GetChatUser(userId);
            var msgs      = service.GetMessages(type, (int)Clients.Caller.DbId, otherUser.DbId);

            Clients.Caller.messageHistory(msgs, userId, otherUser.Name, null, false);
        }
Esempio n. 15
0
        private void SaveHistory(HistoryType chgType, PaymentMethod orig, string uid)
        {
            History PayHistory = new History();

            PayHistory.ObjectTypeName = this.GetType().ToString();
            PayHistory.Identifier     = this.PaymentMethodID;
            PayHistory.OrganizationID = this.OrganizationID;

            switch (chgType)
            {
            case HistoryType.ADD:
                PayHistory.UpdatedXML = Serialize(this);
                break;

            case HistoryType.UPDATE:
                PayHistory.OriginalXML = Serialize(orig);
                PayHistory.UpdatedXML  = Serialize(this);
                break;

            case HistoryType.DELETE:
                PayHistory.OriginalXML = Serialize(orig);
                break;
            }

            PayHistory.Save(uid);
        }
        private string GetHistoryType(HistoryType type)
        {
            var optionCode = string.Empty;

            switch (type)
            {
            case HistoryType.DividendHistory:
                optionCode = "1d&events=dividends";
                break;

            case HistoryType.Day:
                optionCode = "1d&events=history";
                break;

            case HistoryType.Week:
                optionCode = "1wk&events=history";
                break;

            case HistoryType.Month:
                optionCode = "1mo&events=history";
                break;
            }

            var option = $"&interval={optionCode}";

            return(option);
        }
Esempio n. 17
0
        public void GetGroupHistory(string groupId, HistoryType type)
        {
            var msgs  = service.GetMessages(type, groupId: groupId);
            var group = service.GetChatGroup(groupId);

            Clients.Caller.messageHistory(msgs, groupId, group.Name, null, true);
        }
Esempio n. 18
0
        /// <summary>
        ///  Set an item into recent history storage.
        /// </summary>
        /// <param name="historyType">The type of history.</param>
        /// <param name="values">The values necessary for loading the object as a dictionary of key value pairs.</param>
        /// <param name="displayName">The object's display name.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="values"/> is <c>null</c> or empty.</exception>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="displayName"/> is <c>null</c> or empty.</exception>
        public void Set(HistoryType historyType, IDictionary <string, object> values, string displayName)
        {
            if (values == null || !values.Any())
            {
                throw new ArgumentNullException("values");
            }

            if (string.IsNullOrEmpty(displayName))
            {
                throw new ArgumentNullException("displayName");
            }

            var key = new KeyModel("History").Add(historyType);

            values.ForEach(v => key.Add(v.Key.ToLower()).Add(v.Value));

            var model = new HistoryModel
            {
                HistoryType  = historyType,
                Values       = values,
                DisplayName  = displayName,
                DateAccessed = UserService.DateTime,
                IsPinned     = false,
                Username     = UserService.Username
            };

            UserService.Session.Set(key, model);
        }
Esempio n. 19
0
        private void SaveHistory(HistoryType ht, Vendor v, string uid)
        {
            History h = new History();

            h.ObjectTypeName = this.GetType().ToString();
            h.ChangeType     = ht;
            h.Active         = true;
            h.OrganizationID = OrganizationID;
            switch (ht)
            {
            case HistoryType.ADD:
                h.Identifier  = VendorID;
                h.OriginalXML = null;
                h.UpdatedXML  = Serialize(this);
                break;

            case HistoryType.UPDATE:
                h.Identifier  = VendorID;
                h.OriginalXML = v.Serialize(this);
                h.UpdatedXML  = Serialize(this);
                break;

            case HistoryType.DELETE:
                h.Identifier  = VendorID;
                h.OriginalXML = Serialize(this);
                h.UpdatedXML  = null;
                break;
            }

            h.Save(uid);
        }
Esempio n. 20
0
        private void DeleteTable(SQLiteConnection connection, HistoryType historyType)
        {
            string tableName = string.Empty;

            switch (historyType)
            {
            case HistoryType.TwoHour:
                tableName = TwoHourHistoryTable;
                break;

            case HistoryType.Day:
                tableName = DayHistoryTable;
                break;

            case HistoryType.Month:
                tableName = MonthHistoryTable;
                break;
            }

            using (SQLiteCommand command = new SQLiteCommand(connection))
            {
                command.CommandText = "DELETE FROM " + tableName + ";";
                command.ExecuteNonQuery();
            }
        }
Esempio n. 21
0
 public History(HistoryType historytype, FileData filedata, string date, bool sync)
 {
     this.Type = historytype;
     this.Data = filedata;
     this.Sync = sync;
     this.Date = date;
 }
Esempio n. 22
0
        public async Task <IHttpActionResult> Search(HistoryType historyType = HistoryType.PulseServer, string machineId = "", DateTime?date = null, int skip = 0, int take = 10)
        {
            var searchResult = await _service.SearchAsync(h => h.HistoryType == historyType &&
                                                          (!date.HasValue  ? DbFunctions.TruncateTime(h.CreatedDate) == DateTime.Today : DbFunctions.TruncateTime(h.CreatedDate) == DbFunctions.TruncateTime(date.Value)) && (string.IsNullOrEmpty(machineId) ? true : h.MachineId.ToLower().Equals(machineId.ToLower())), skip, take);

            return(Ok(searchResult));
        }
        public void SetsHistoryTypeOfSuperState(HistoryType historyType)
        {
            this.testee.WithHistoryType(historyType);

            this.superState.HistoryType
            .Should().Be(historyType);
        }
Esempio n. 24
0
 public History(IUser user, string message, HistoryType type, DateTime actionDateTime)
 {
     _userName = user.Username;
     _transaction = message;
     _category = type;
     _actionDateTime = actionDateTime;
 }
Esempio n. 25
0
        public void SaveHistory(Campus originalCampus, HistoryType hType, string userName)
        {
            History h = new History();

            h.ChangeType     = hType;
            h.ObjectTypeName = this.GetType().ToString();
            h.OrganizationID = 1;
            h.Identifier     = Id;

            switch (hType)
            {
            case HistoryType.ADD:
                h.OriginalXML = null;
                h.UpdatedXML  = this.Serialize();
                break;

            case HistoryType.UPDATE:
                h.OriginalXML = originalCampus.Serialize();
                h.UpdatedXML  = this.Serialize();
                break;

            case HistoryType.DELETE:
                h.OriginalXML = this.Serialize();
                h.UpdatedXML  = null;
                break;
            }

            h.Save(userName);
        }
Esempio n. 26
0
        public static string GetIconClass(this HistoryType type)
        {
            string result = null;

            switch (type)
            {
            case HistoryType.Activity:
                result = "fa-trophy";
                break;

            case HistoryType.Contract:
                result = "fa-calendar";
                break;

            case HistoryType.Employer:
                result = "fa-users";
                break;

            case HistoryType.JobSeeker:
                result = "fa-user";
                break;

            case HistoryType.Vacancy:
                result = "fa-flag";
                break;

            default:
                result = "fa-history";
                break;
            }
            return(result);
        }
Esempio n. 27
0
 public History(HistoryType historytype, FileData filedata, String oldpath, string date, bool sync)
 {
     this.Type = historytype;
     this.Data = filedata;
     this.OldPath = oldpath;
     this.Sync = sync;
     this.Date = date;
 }
Esempio n. 28
0
        /// <summary>
        /// Gets the recent history item for a specified history type and object ID
        /// </summary>
        /// <param name="historyType">The history type.</param>
        /// <param name="values">The values necessary for loading the object as a dictionary of key value pairs.</param>
        /// <returns>Returns <see cref="IEnumerable{HistoryModel}"/> for a single matching recent history record. If no matching record found returns null.</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="values"/> is <c>null</c> or empty.</exception>
        public HistoryModel Get(HistoryType historyType, IDictionary <string, object> values)
        {
            if (values == null || !values.Any())
            {
                throw new ArgumentNullException("values");
            }

            var          queryStringValues = values.ToQueryString(true);
            var          key = new KeyModel(CacheType.User, "History").Add("Single").Add(historyType).Add(queryStringValues);
            HistoryModel data;

            if (!CacheService.TryGet(key, out data))
            {
                var sqlParameters = new List <SqlParameter>();

                sqlParameters.Add(new SqlParameter {
                    ParameterName = "@return_value", SqlDbType = SqlDbType.Int, Direction = ParameterDirection.ReturnValue
                });
                sqlParameters.Add(new SqlParameter {
                    ParameterName = "@HistoryType_RHC", SqlDbType = SqlDbType.VarChar, Value = historyType.ToString()
                });
                sqlParameters.Add(new SqlParameter {
                    ParameterName = "@ObjectValues", SqlDbType = SqlDbType.VarChar, Value = queryStringValues
                });
                sqlParameters.Add(new SqlParameter {
                    ParameterName = "@UserID", SqlDbType = SqlDbType.VarChar, Value = UserService.Username
                });

                data = SqlService.Execute <HistoryModel>(connectionName, "RecentHistoryGetSingle", sqlParameters,
                                                         reader =>
                {
                    var model         = new HistoryModel();
                    model.HistoryType = historyType;
                    string vals       = (reader[2] as string);
                    if (!string.IsNullOrEmpty(vals) && vals.IndexOf('=') >= 0)
                    {
                        model.Values = new Dictionary <string, object>();
                        var split    = vals.Split(new char[] { '=' }, StringSplitOptions.None);
                        model.Values.Add(split[0], split[1]);
                    }
                    model.DisplayName  = reader[3] as string;
                    model.IsPinned     = reader.GetBoolean(4);
                    model.DateAccessed = reader.GetDateTime(5);
                    model.Username     = reader[6] as string;
                    return(model);
                }
                                                         ).FirstOrDefault();

                if (data != null)
                {
                    // Successful so store in cache
                    CacheService.Set(key, data);
                }
            }

            return(data);
        }
Esempio n. 29
0
        /// <summary>
        /// LOG Type에 따라 디스플레이 레이아웃 설정
        /// </summary>
        /// <param name="type"></param>
        public void subInitForm(HistoryType type)
        {
            try
            {
                this.enmCurHistoryType = type;

                switch (this.enmCurHistoryType)
                {
                case HistoryType.Cleaner_DV:
                    pstrLogFileName = "\\DV.Log";
                    subSetForDV();
                    break;

                case HistoryType.NONE:
                    pstrLogFileName = "\\";
                    // 화면에 설정 잘못된거 알려주면 되나?
                    break;
                }

                if (enmCurHistoryType == HistoryType.Cleaner_DV)
                {
                    cbSubType.Items.Clear();
                    cbSubType.Items.Add("ALL");
                    cbSubType.Items.Add("U01");
                    cbSubType.Items.Add("U02");
                    cbSubType.Items.Add("U03");

                    cbSubType.Text = "ALL";

                    lblUnitID.Visible = true;
                    lblGLSID.Visible  = true;
                    cbSubType.Visible = true;
                    txtGLSID.Visible  = true;
                    btnSearch.Visible = true;
                }
                else
                {
                    lblUnitID.Visible = false;
                    lblGLSID.Visible  = false;
                    cbSubType.Visible = false;
                    txtGLSID.Visible  = false;
                    btnSearch.Visible = false;
                }



                this.tvDate.Visible = true;
            }
            catch (Exception ex)
            {
                if (this.PInfo != null)
                {
                    this.PInfo.subLog_Set(clsInfo.LogType.CIM, ex.ToString());
                }
            }
        }
Esempio n. 30
0
        public HistoryItem(HistoryType type, string text, HistoryLook look)
        {
            #if DEBUG
            if (look == null) throw new ArgumentNullException();
            #endif

            _type = type;
            _text = text;
            _look = look;
        }
Esempio n. 31
0
        /// <summary>
        /// Creates a StateRow based on the specified name, initial state, and
        /// history type and adds it to the StateRowCollection.
        /// </summary>
        /// <param name="name">
        /// The state name.
        /// </param>
        /// <param name="initialState">
        /// The state's initial state.
        /// </param>
        /// <param name="historyType">
        /// The state's history type.
        /// </param>
        /// <returns>
        /// The position into which the StateRow was inserted into the
        /// StareRowCollection.
        /// </returns>
        public int Add(string name, string initialState, HistoryType historyType)
        {
            StateRow newRow = new StateRow();

            newRow.Name         = name;
            newRow.InitialState = initialState;
            newRow.HistoryType  = historyType;

            return(Add(newRow));
        }
Esempio n. 32
0
        public static void AddEntry(string username, HistoryType Type, string text)
        {
            History Entry = new History();

            Entry.Type             = Type;
            Entry.Date             = DateTime.Now;
            Entry.IsRead           = false;
            Entry.AssignedUsername = username;
            Entry.Text             = text;
            Entry.Save();
        }
Esempio n. 33
0
        /// <summary>
        /// Info about historization type
        /// </summary>
        /// <param name="type"></param>
        /// <param name="parentTableIdName">Name of the column in parent table</param>
        /// <param name="entityName">Required only if history type is SeparateTable</param>
        public HistoryAttribute(HistoryType type, string entityName = null, string parentTableIdName = null)
        {
            HistoryType       = type;
            EntityName        = entityName;
            ParentTableIdName = parentTableIdName;

            if (type == HistoryType.SeparateTable && string.IsNullOrWhiteSpace(entityName))
            {
                throw  new ApplicationException("For HistoryType.SeparateTable, entity name is required");
            }
        }
Esempio n. 34
0
        /// <summary>
        /// Gets the list of recent history records for the current user and a specified record type.
        /// </summary>
        /// <param name="historyType">The history type.</param>
        /// <returns>Returns <see cref="IEnumerable{HistoryModel}"/> for matching recent history records.</returns>
        public IEnumerable <HistoryModel> Get(HistoryType historyType)
        {
            IEnumerable <HistoryModel> model;

            if (UserService.Session.TryGet("History", out model))
            {
                return(model.Where(m => m.HistoryType == historyType).OrderByDescending(m => m.DateAccessed).GroupBy(m => m.IsPinned).OrderByDescending(g => g.Key).SelectMany(m => m));
            }

            return(Enumerable.Empty <HistoryModel>());
        }
Esempio n. 35
0
        public HistoryFragment(HistoryType type, String LastHistoryItemDate,
                               NetworkStatusMonitor Network,
                               List <UserListItem> users)
        {
            this.type                = type;
            this.Network             = Network;
            this.LastHistoryItemDate = LastHistoryItemDate;
            this.users               = users;

            historyList = new HistoryList(type);
        }
Esempio n. 36
0
        public HistoryFluentBuilder <TOuterBuilder> SetType(HistoryType type)
        {
            if (type < HistoryType.Shallow || type > HistoryType.Deep)
            {
                throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(HistoryType));
            }

            _builder.SetType(type);

            return(this);
        }
Esempio n. 37
0
 public HistoryLook(HistoryType type, bool custom)
 {
     _type = type;
     _custom = custom;
     _font = SystemFonts.DefaultFont;
     _textColor = SystemColors.WindowText;
     _textAlign = TextFormatFlags.Left;
     _marginLeft = 2;
     _marginTop = 2;
     _marginRight = 2;
     _marginBottom = 2;
     _backgroundColor1 = k_defaultBackgroundColor;
     _backgroundColor2 = k_defaultBackgroundColor;
 }
Esempio n. 38
0
        private void SetupLook(bool saveCurrent)
        {
            try
            {
                if (saveCurrent) SaveCurrentLook();

                HistoryType type = (HistoryType)Enum.Parse(typeof(HistoryType), lstLook.Text);
                HistoryLook look = _looks[type];
                _currentLook = type;

                SetupLookFont(look.Font);
                clrLookColor.Color = look.TextColor;

                switch (look.TextAlign)
                {
                    case TextFormatFlags.Right: lstLookAlign.SelectedIndex = k_lookAlignRight; break;
                    case TextFormatFlags.HorizontalCenter: lstLookAlign.SelectedIndex = k_lookAlignCenter; break;
                    default: lstLookAlign.SelectedIndex = k_lookAlignLeft; break;
                }

                txtLookMarginLeft.Text = look.MarginLeft.ToString();
                txtLookMarginTop.Text = look.MarginTop.ToString();
                txtLookMarginRight.Text = look.MarginRight.ToString();
                txtLookMarginBottom.Text = look.MarginBottom.ToString();

                clrLookBkgnd1.Color = look.BackgroundColor1;
                clrLookBkgnd2.Color = look.BackgroundColor2;

                _lookIsSetup = true;
            }
            catch(Exception ex)
            {
                MessageBox.Show("Error when setting up the appearance record: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                _lookIsSetup = false;
            }
        }
 public static GenericPagedResult<ReturnsRefundsWeb> SearchReturnsRefundsPaged(DateTime? from, DateTime? to, ReturnsRefundsSearchDateType dateType, String searchField, Boolean exactMatch, String searchTerm, Int32 pageNum, Int32 numEntriesPerPage, HistoryType historyType, String ApiToken, String ApiServer)
 {
     return Newtonsoft.Json.JsonConvert.DeserializeObject<GenericPagedResult<ReturnsRefundsWeb>>(Factory.GetResponse("ReturnsRefunds/SearchReturnsRefundsPaged", "from=" + Newtonsoft.Json.JsonConvert.SerializeObject(from) + "&to=" + Newtonsoft.Json.JsonConvert.SerializeObject(to) + "&dateType=" + Newtonsoft.Json.JsonConvert.SerializeObject(dateType) + "&searchField=" + searchField + "&exactMatch=" + exactMatch + "&searchTerm=" + searchTerm + "&pageNum=" + pageNum + "&numEntriesPerPage=" + numEntriesPerPage + "&historyType=" + Newtonsoft.Json.JsonConvert.SerializeObject(historyType) + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
 }
 public static List<SearchField> GetSearchTypes(HistoryType historyType, String ApiToken, String ApiServer)
 {
     return Newtonsoft.Json.JsonConvert.DeserializeObject<List<SearchField>>(Factory.GetResponse("ReturnsRefunds/GetSearchTypes", "historyType=" + Newtonsoft.Json.JsonConvert.SerializeObject(historyType) + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
 }
 public static String CreateReturnsRefundsCSV(DateTime? from, DateTime? to, ReturnsRefundsSearchDateType dateType, String searchField, Boolean exactMatch, String searchTerm, String sortColumn, Boolean sortDirection, HistoryType historyType, String ApiToken, String ApiServer)
 {
     return Newtonsoft.Json.JsonConvert.DeserializeObject<String>(Factory.GetResponse("ReturnsRefunds/CreateReturnsRefundsCSV", "from=" + Newtonsoft.Json.JsonConvert.SerializeObject(from) + "&to=" + Newtonsoft.Json.JsonConvert.SerializeObject(to) + "&dateType=" + Newtonsoft.Json.JsonConvert.SerializeObject(dateType) + "&searchField=" + searchField + "&exactMatch=" + exactMatch + "&searchTerm=" + searchTerm + "&sortColumn=" + sortColumn + "&sortDirection=" + sortDirection + "&historyType=" + Newtonsoft.Json.JsonConvert.SerializeObject(historyType) + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
 }
Esempio n. 42
0
 private void ApplyLook(HistoryType type)
 {
     HistoryLook look = _looks[type];
     if (look.Custom) _historyView.GetHistoryLook(type).Copy(look);
 }
        public void SetsHistoryTypeOfSuperState(HistoryType historyType)
        {
            this.testee.WithHistoryType(historyType);

            A.CallTo(() => this.superState.SetHistoryType(historyType)).MustHaveHappened();
        }
Esempio n. 44
0
 //增加历史记录
 public void AddHistory(HistoryType type)
 {
     if (type == HistoryType.Action)
     {
         if (form_MA.form_MTimeLine != null && form_MA.form_MTimeLine.currentTimeLineHoder != null && preValue_Action != null)
         {
             HistoryItem_Action item = new HistoryItem_Action(this);
             item.setValue(preValue_Action, getHistoryValue_Action());
             AddItem(item);
         }
     }
     if (type == HistoryType.Actor)
     {
         if (form_MA.form_MActorList != null && form_MA.form_MActorList.actorsManager != null && preValue_Actor!=null)
         {
             HistoryItem_Actor item = new HistoryItem_Actor(this);
             item.setValue(preValue_Actor, getHistoryValue_Actor());
             AddItem(item);
         }
     }
     if (type == HistoryType.Clips)
     {
         if (form_MA.form_MImgsList != null && form_MA.form_MImgsList.MClipsManager != null && preValue_Clips!=null)
         {
             HistoryItem_Clips item = new HistoryItem_Clips(this);
             item.setValue(preValue_Clips, getHistoryValue_Clips());
             AddItem(item);
         }
     }
     if (type == HistoryType.Imgs)
     {
         if (form_MA.form_MImgsList != null && form_MA.form_MImgsList.mImgsManager != null && preValue_Imgs != null)
         {
             HistoryItem_Imgs item = new HistoryItem_Imgs(this);
             item.setValue(preValue_Imgs, getHistoryValue_Imgs());
             AddItem(item);
         }
     }
     form_MA.refreshHistoryButtons();
     ReadyHistory(type);
 }
Esempio n. 45
0
 public void History(HistoryType Type)
 {
     Thread tSeed = new Thread(new ParameterizedThreadStart(Emit));
     tSeed.Start(string.Format("5:::{{\"name\":\"history\",\"args\":[\"{0}\",\"{1}\"]}}", csrf, Type.ToString()));
 }
Esempio n. 46
0
 private HistoryValue_ImgProp preValue_ImgProp= null;     //图片属性
 //准备历史记录
 public void ReadyHistory(HistoryType type)
 {
     if (type == HistoryType.Action)
     {
         if (form_MA.form_MTimeLine != null && form_MA.form_MTimeLine.currentTimeLineHoder != null)
         {
             preValue_Action = getHistoryValue_Action();
         }
     }
     if (type == HistoryType.Actor)
     {
         if (form_MA.form_MActorList != null && form_MA.form_MActorList.actorsManager != null)
         {
             preValue_Actor = getHistoryValue_Actor();
         }
     }
     if (type == HistoryType.Clips)
     {
         if (form_MA.form_MImgsList != null && form_MA.form_MImgsList.MClipsManager != null)
         {
             preValue_Clips = getHistoryValue_Clips();
         }
     }
     if (type == HistoryType.Imgs)
     {
         if (form_MA.form_MImgsList != null && form_MA.form_MImgsList.mImgsManager != null)
         {
             preValue_Imgs = getHistoryValue_Imgs();
         }
     }
 }
Esempio n. 47
0
        public Fail2banProcessor(ProcessorElement config, Service service)
            : base(config, service)
        {
            // default values
            stateFile = null;
            findtime = 600;
            ipv4_prefix = 32;
            ipv6_prefix = 64;
            cleanup = 300;

            history = HistoryType.ALL;
            history_fixed_count = 10;
            history_fixed_decay = 1.0;
            history_rrd_count = 2;
            history_rrd_repeat = 2;

            tresholds = new List<Fail2banProcessor.Treshold>();

            // set values from config file
            if (config.Options["state"] != null)
            {
                stateFile = config.Options["state"].Value;
            }

            if (config.Options["findtime"] != null)
            {
                findtime = long.Parse(config.Options["findtime"].Value);
            }
            if (config.Options["ipv4_prefix"] != null)
            {
                ipv4_prefix = int.Parse(config.Options["ipv4_prefix"].Value);
                if (ipv4_prefix < 128 - 32)
                {
                    ipv4_prefix += (128 - 32);
                }
            }
            if (config.Options["ipv6_prefix"] != null)
            {
                ipv6_prefix = int.Parse(config.Options["ipv6_prefix"].Value);
            }
            if (config.Options["cleanup"] != null)
            {
                cleanup = int.Parse(config.Options["cleanup"].Value);
            }

            if (config.Options["history"] != null)
            {
                switch (config.Options["history"].Value.ToLower())
                {
                    case "all": history = HistoryType.ALL; break;
                    case "one": history = HistoryType.ONE; break;
                    case "fixed": history = HistoryType.FIXED; break;
                    case "rrd": history = HistoryType.RRD; break;
                    default:
                        throw new ArgumentException("Unknown history type: "
                   + config.Options["history"].Value.ToLower());
                }
            }
            if (config.Options["history.fixed.count"] != null)
            {
                history_fixed_count = int.Parse(config.Options["history.fixed.count"].Value);
            }
            if (config.Options["history.fixed.decay"] != null)
            {
                history_fixed_decay = double.Parse(config.Options["history.fixed.decay"].Value);
            }
            if (config.Options["history.rrd.count"] != null)
            {
                history_rrd_count = int.Parse(config.Options["history.rrd.count"].Value);
            }
            if (config.Options["history.rrd.repeat"] != null)
            {
                history_rrd_repeat = int.Parse(config.Options["history.rrd.repeat"].Value);
            }

            if (config.Options["tresholds"].Value != null)
            {
                foreach (string treshold in config.Options["tresholds"].Value.Split(','))
                {
                    tresholds.Add(new Treshold(config, treshold));
                }
            }

            data = new Dictionary<IPAddress, IFail>();
            // create timer to periodically cleanup expired data
            if (cleanup > 0)
            {
                cleanup_timer = new Timer(cleanup * 1000);
                cleanup_timer.Elapsed += Cleanup;
                cleanup_timer.Enabled = true;
            }

            clockskew = 0;
        }
Esempio n. 48
0
 public void WriteLine(HistoryType type, string str)
 {
     historyView.Add(type, str);
     historyView.SelectNone(false);
     historyView.ScrollToBottom();
 }