Example #1
0
 public string StringForWrite()
 {
     return(DateTimeBackup.ToString() + Environment.NewLine +
            ChangeType.ToString() + Environment.NewLine +
            SourceFileName + Environment.NewLine +
            (ChangeType == WatcherChangeTypes.Renamed ? RenameFileName : newBackupFileName) +
            Environment.NewLine + Environment.NewLine);
 }
Example #2
0
 internal void ToXml(XmlWriter writer, string element)
 {
     Console.WriteLine("WARNING: Change.ToXml not verified yet!");
     writer.WriteStartElement(element);
     writer.WriteElementString("ChangeType", ChangeType.ToString());
     writer.WriteElementString("Item", Item.ToString());
     writer.WriteEndElement();
 }
        public override string ToString()
        {
            string line = "<" + Path + "><" + DateTime.ToString(dtFormat) + "><" + ChangeType.ToString() + ">";

            if (AuxInfo != null)
            {
                line += ("<" + AuxInfo + ">");
            }
            return(line);
        }
Example #4
0
        public static bool Send(ceDomainConfigEx domain, ChangeType changeType, out string error)
        {
            bool          success       = true;
            StringBuilder errorMessages = new StringBuilder();

            try
            {
                if (!string.IsNullOrWhiteSpace(domain.GameListChangedNotificationUrl))
                {
                    List <string> urls = domain.GameListChangedNotificationUrl
                                         .Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries)
                                         .Where(u => u.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase) || u.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase)
                                                ).ToList();

                    foreach (string url in urls)
                    {
                        string urlWithParam = string.Format("{0}{1}ChangeType={2}"
                                                            , url
                                                            , url.IndexOf("?") > 0 ? "&" : "?"
                                                            , changeType.ToString()
                                                            );
                        try
                        {
                            using (WebClient webClient = new WebClient())
                            {
                                webClient.DownloadData(urlWithParam);
                            }
                        }
                        catch (HttpException hex)
                        {
                            errorMessages.AppendFormat("ERROR {0} - {1}\n", hex.ErrorCode, hex.Message);
                            success = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                success = false;
                Logger.Exception(ex);
            }

            if (success)
            {
                error = "SUCCEED";
            }
            else
            {
                error = errorMessages.ToString();
            }
            return(success);
        }
Example #5
0
        public async Task <ChangeList> GetChangeListAsync(ChangeType type, string end_date = null, string start_date = null, int page = 1, string apiKey = null)
        {
            var restRequest = _requestHandler
                              .CreateRequest()
                              .AddUrlSegment(type.ToString().ToLower())
                              .AddUrlSegment($"changes")
                              .AddPage(page)
                              .AddApiKey(apiKey)
                              .AddStartDate(start_date)
                              .AddEndDate(end_date);

            return(await _requestHandler.ExecuteAsync <ChangeList>(restRequest));
        }
Example #6
0
        internal void SerializeWriteRawXml(XmlWriter writer)
        {
            writer.WriteStartElement("Group");
            writer.WriteAttributeString("Name", _name);
            writer.WriteAttributeString("Change", _change.ToString());

            writer.WriteStartElement("Assemblies");
            foreach (AssemblyDetail ad in _assemblies)
            {
                ad.SerializeWriteRawXml(writer);
            }
            writer.WriteEndElement();
            writer.WriteEndElement();
        }
        private void LoadCollectionData(int ID, ChangeType ctype = ChangeType.None)
        {
            //var conn = new SqlConnection(
            //  "Data Source =127.0.0.1; Initial Catalog = Test; User ID = sa; Password =3113; ; MultipleActiveResultSets = true;");
            using (var sqlConnection = new SqlConnection(_connectionString))
            {
                sqlConnection.Open();
                using (var sqlCommand = sqlConnection.CreateCommand())
                {
                    // WHERE OBJECTID = {0}", ID
                    sqlCommand.CommandText = string.Format("SELECT * FROM [LVPL_BUSBAR] WHERE OBJECTID = {0}", ID);
                    using (var sqlDataReader = sqlCommand.ExecuteReader())
                    {
                        var tmp_json = new Dictionary <string, string> {
                        };
                        var t_dict   = new Dictionary <string, string>();
                        var tmp_dict = new Dictionary <string, string>();

                        List <Dictionary <string, string> > foo = new List <Dictionary <string, string> >();

                        Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
                        tmp_dict.Add(ctype.ToString(), unixTimestamp.ToString());

                        foo.Add(tmp_dict);

                        while (sqlDataReader.Read())
                        {
                            t_dict.Clear();

                            for (int i = 0; i < sqlDataReader.FieldCount; i++)
                            {
                                string key   = sqlDataReader.GetName(i).ToString();
                                string value = sqlDataReader.GetValue(i).ToString();
                                //Console.Write(key);
                                //Console.Write(string.Format("[{0}]: ", i));
                                //Console.WriteLine(value);
                                t_dict.Add(key, value);
                            }
                            foo.Add(t_dict);
                            data_list.Add(foo);
                        }

                        var Result = JsonConvert.SerializeObject(data_list, Formatting.Indented);
                        System.IO.File.WriteAllText("./data.txt", Result);
                    }
                }
            }
        }
Example #8
0
        public async Task SetNewContentAsync(Stream content, CancellationToken token)
        {
            if (Item.ContentMetadata == null)
            {
                throw new InvalidOperationException(string.Format("ItemChange for {0} of type {1} must have metadata",
                                                                  Item.Path, ChangeType.ToString()));
            }

            if (Item.ContentMetadata.IsBinary)
            {
                NewContent = await CreateItemContentFromBinaryStreamAsync(content, token);
            }
            else
            {
                NewContent = await CreateItemContentFromTextStreamAsync(content, Item.ContentMetadata.Encoding);
            }
        }
Example #9
0
        private static List <KeyValuePair <string, string> > GetSubPiecesInfo(DiffPiece line, bool isOld)
        {
            var details = new List <KeyValuePair <string, string> >();

            foreach (var ele in line.SubPieces)
            {
                if (string.IsNullOrEmpty(ele?.Text))
                {
                    continue;
                }
                ChangeType subType = ChangeType.Imaginary;
                switch (ele.Type)
                {
                case ChangeType.Modified:
                    subType = isOld ? ChangeType.Deleted : ChangeType.Inserted;
                    break;

                case ChangeType.Inserted:
                    subType = ChangeType.Inserted;
                    break;

                case ChangeType.Deleted:
                    subType = ChangeType.Deleted;
                    break;

                case ChangeType.Unchanged:
                    subType = ChangeType.Unchanged;
                    break;
                }
                var subTypeStr = subType != ChangeType.Imaginary ? subType.ToString() : null;
                if (details.Count > 0)
                {
                    var last = details[details.Count - 1];
                    if (string.Equals(last.Value, subTypeStr, StringComparison.InvariantCulture))
                    {
                        details[details.Count - 1] = new KeyValuePair <string, string>(last.Key + ele.Text, subTypeStr);
                        continue;
                    }
                }

                details.Add(new KeyValuePair <string, string>(ele.Text, subTypeStr));
            }

            return(details);
        }
Example #10
0
        public Stream CreateContentStream()
        {
            if (NewContent == null)
            {
                throw new InvalidOperationException(string.Format("ItemChange for {0} of type {1} must have content",
                                                                  Item.Path, ChangeType.ToString()));
            }
            if (Item.ContentMetadata == null)
            {
                throw new InvalidOperationException(string.Format("ItemChange for {0} of type {1} must have metadata",
                                                                  Item.Path, ChangeType.ToString()));
            }

            var newContentStream = new MemoryStream();

            NewContent.WriteToStream(newContentStream, Item.ContentMetadata.Encoding);
            newContentStream.Position = 0;
            return(newContentStream);
        }
Example #11
0
        public override IEnumerable <Argument> GetArguments()
        {
            List <Argument> args = new List <Argument>();

            args.Add(ArgumentHelper.ArgumentFactory(nameof(Response), Response));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(Treatment), Treatment));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(Significance), Significance));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(ControlGroup), ControlGroup));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(ChangeType), ChangeType.ToString()));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(PercentChange), PercentChange));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(AbsoluteChange), AbsoluteChange));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(PlottingRangeType), PlottingRangeType.ToString()));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(SampleSizeFrom), SampleSizeFrom));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(SampleSizeTo), SampleSizeTo));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(PowerFrom), PowerFrom));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(PowerTo), PowerTo));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(GraphTitle), GraphTitle));

            return(args);
        }
Example #12
0
        private static string getChangeTypeStr(ChangeType ct, int countB, EntryStatus entryStatus, string lang)
        {
            string changeMsg;

            if (ct == ChangeType.New)
            {
                changeMsg = TextProvider.Instance.GetString(lang, "history.changeNewEntry");
            }
            else if (ct == ChangeType.Edit)
            {
                changeMsg = TextProvider.Instance.GetString(lang, "history.changeEdited");
            }
            else if (ct == ChangeType.Note)
            {
                changeMsg = TextProvider.Instance.GetString(lang, "history.changeCommented");
            }
            else if (ct == ChangeType.BulkImport)
            {
                changeMsg = TextProvider.Instance.GetString(lang, "history.changeBulkImport");
            }
            else if (ct == ChangeType.StatusChange)
            {
                if (entryStatus == EntryStatus.Approved)
                {
                    changeMsg = TextProvider.Instance.GetString(lang, "history.changeApproved");
                }
                else if (entryStatus == EntryStatus.Flagged)
                {
                    changeMsg = TextProvider.Instance.GetString(lang, "history.changeFlagged");
                }
                else
                {
                    changeMsg = TextProvider.Instance.GetString(lang, "history.changeStatusNeutral");
                }
            }
            else
            {
                changeMsg = ct.ToString();
            }
            return(changeMsg);
        }
Example #13
0
        public override IEnumerable <Argument> GetArguments()
        {
            List <Argument> args = new List <Argument>();

            args.Add(ArgumentHelper.ArgumentFactory(nameof(GroupMean), GroupMean));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(DeviationType), DeviationType.ToString()));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(StandardDeviation), StandardDeviation));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(Variance), Variance));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(Significance), Significance));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(ChangeType), ChangeType.ToString()));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(PercentChange), PercentChange));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(AbsoluteChange), AbsoluteChange));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(PlottingRangeType), PlottingRangeType.ToString()));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(SampleSizeFrom), SampleSizeFrom));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(SampleSizeTo), SampleSizeTo));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(PowerFrom), PowerFrom));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(PowerTo), PowerTo));
            args.Add(ArgumentHelper.ArgumentFactory(nameof(GraphTitle), GraphTitle));

            return(args);
        }
Example #14
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("GetOperation instance ");
            sb.Append(GetHashCode());

            sb.Append("\n	 type: ");
            sb.Append(ItemType.ToString());

            sb.Append("\n	 itemid: ");
            sb.Append(ItemId);

            sb.Append("\n	 slocal: ");
            sb.Append(this.SourceLocalItem);

            sb.Append("\n	 tlocal: ");
            sb.Append(this.TargetLocalItem);

            sb.Append("\n	 titem: ");
            sb.Append(this.TargetServerItem);

            sb.Append("\n	 sver: ");
            sb.Append(this.VersionServer);

            sb.Append("\n	 lver: ");
            sb.Append(this.VersionLocal);

            sb.Append("\n	 did: ");
            sb.Append(this.DeletionId);

            sb.Append("\n	 ArtifactUri: ");
            sb.Append(this.ArtifactUri);

            sb.Append("\n	 ChangeType: ");
            sb.Append(ChangeType.ToString());

            return(sb.ToString());
        }
Example #15
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("GetOperation instance ");
            sb.Append(GetHashCode());

            sb.Append("\n	 type: ");
            sb.Append(ItemType.ToString());

            sb.Append("\n	 itemid: ");
            sb.Append(ItemId);

            sb.Append("\n	 slocal: ");
            sb.Append(slocal);

            sb.Append("\n	 tlocal: ");
            sb.Append(tlocal);

            sb.Append("\n	 titem: ");
            sb.Append(titem);

            sb.Append("\n	 sver: ");
            sb.Append(sver);

            sb.Append("\n	 lver: ");
            sb.Append(lver);

            sb.Append("\n	 did: ");
            sb.Append(DeletionId);

            sb.Append("\n	 ArtifactUri: ");
            sb.Append(artifactUri);

            sb.Append("\n	 ChangeType: ");
            sb.Append(ChangeType.ToString());

            return(sb.ToString());
        }
 private bool IsInOriginal(ChangeType changeType)
 {
     switch (changeType)
     {
         case ChangeType.None:
         case ChangeType.Deletion:
         case ChangeType.MoveSource:
         case ChangeType.FormatChange:
         case ChangeType.Match:
         case ChangeType.StyleChangeText:
         case ChangeType.DeletedComment:
         case ChangeType.Comment:
             return true;
         case ChangeType.MoveDestination:
         case ChangeType.Insertion:
         case ChangeType.ChangeNumber:
         case ChangeType.Delimiter:
         case ChangeType.MovedDeletion:
         case ChangeType.StyleChangedLabel:
         case ChangeType.InsertedComment:
             return false;
         case ChangeType.CellInserted:
         case ChangeType.CellDeleted:
         case ChangeType.CellMerged:
         case ChangeType.CellIsPadding:
         case ChangeType.ChangedText:
         case ChangeType.ChangedComment:
         default:
             throw new InvalidOperationException("Unexpected change type in summary : " + changeType.ToString());
     }
 }
Example #17
0
 public void Change(EvalContext context, ChangeType type)
 {
     Debug.Log($"Changed to {type.ToString()}!");
 }
Example #18
0
        private static RecordChangedEventArgs <TestModel> CreateRecordChangedEventArgsNotification(ChangeType changeType)
        {
            var schemaName = "dbo";
            var entityName = nameof(TestModel);
            var guid       = "aef4d1af-ac7d-42d6-95dc-5034dafac81e";

            var messagesBag = CreateMessagesBag(null, new List <string> {
                $"{schemaName}_{entityName}_{guid}/{nameof(TestModel.Id)}"
            });

            messagesBag.AddMessage(new Message($"{schemaName}_{entityName}_{guid}/StartMessage/{changeType.ToString()}", null));

            var modelToTableMapper = new ModelToTableMapper <TestModel>();

            modelToTableMapper.AddMapping(c => c.Id, nameof(TestModel.Id));

            var recordChangedEventArgsNotification = new RecordChangedEventArgs <TestModel>(messagesBag: messagesBag,
                                                                                            mapper: modelToTableMapper,
                                                                                            userInterestedColumns: new List <TableColumnInfo>
            {
                new TableColumnInfo(nameof(TestModel.Id), "int"),
                new TableColumnInfo(nameof(TestModel.Name), "nvarchar", "256")
            },
                                                                                            server: "dbName",
                                                                                            database: @"localhost\SQLEXPRESS",
                                                                                            sender: $"{schemaName}_{entityName}_{guid}",
                                                                                            cultureInfo: new CultureInfo("en-US"));

            return(recordChangedEventArgsNotification);
        }
Example #19
0
 public override string ToString()
 {
     return(ChangeType.ToString());
 }
 /// <inheritdoc/>
 protected override string OnComputeId()
 {
     return($"{GetType().Name}[{ChangeType?.ToString() + ": " + ItemsProperty?.ToString()}]");
 }
Example #21
0
        private HighlightStyle GetHighlight(ChangeType changeType)
        {
            switch (changeType)
            {
                case ChangeType.SearchResult:
                    return SearchHighlight;
                case ChangeType.None:
                case ChangeType.Match:
                    return null;
                case ChangeType.Deletion:
                    return m_opts.DeleteStyle;
                case ChangeType.MoveSource:
                    return m_opts.MoveSourceStyle;
                case ChangeType.MoveDestination:
                    return m_opts.MoveDestStyle;
                case ChangeType.Insertion:
                    return m_opts.InsertStyle;
                case ChangeType.FormatChange:
                    return m_opts.FormatChangeStyle;
                case ChangeType.MovedDeletion:
                    return m_opts.MovedDeletionStyle;
                case ChangeType.StyleChangeText:
                    return m_opts.StyleChangeTextStyle;
                case ChangeType.StyleChangedLabel:
                    return m_opts.StyleChangeLabelStlye;
                case ChangeType.InsertedComment:
                    return m_opts.InsertedCommentStyle;
                case ChangeType.DeletedComment:
                    return m_opts.DeletedCommentStyle;
                case ChangeType.Comment:
                    return m_opts.CommentStyle;



                case ChangeType.CellInserted:
                case ChangeType.CellDeleted:
                case ChangeType.CellMerged:
                case ChangeType.CellIsPadding:
                case ChangeType.ChangeNumber:
                case ChangeType.Delimiter:
                case ChangeType.ChangedText:
                case ChangeType.ChangedComment:
                default:
                    throw new InvalidOperationException("Unexpected change type in summary : " + changeType.ToString());
            }
        }
Example #22
0
 public override string ToString()
 {
     return(ChangeType.ToString() + "-" + HeightOrBackstep);
 }
        public override void ProcessServer()
        {
            string message = string.Format("invalid {1} modifier: {0}", Type, ValueType.ToString().ToLowerInvariant());
            List <MyTuple <ModifierType, float> > list = null;

            if (ValueType == ChangeType.Base)
            {
                list = FTLAdmin.Configuration.BaseValues;
            }
            else if (ValueType == ChangeType.Upgrade)
            {
                list = FTLAdmin.Configuration.Upgrades;
            }

            if (Reset)
            {
                MyTuple <ModifierType, float>?val = null;
                foreach (var entry in list)
                {
                    if (entry.Item1 == Type)
                    {
                        val = entry;
                        break;
                    }
                }
                if (val == null)
                {
                    message = string.Format("{1} modifier {0} already default", Type, ValueType.ToString().ToLowerInvariant());
                }
                else
                {
                    list.Remove(val.Value);
                    message = string.Format("{1} modifier {0} reset to default", Type, ValueType.ToString().ToLowerInvariant());
                }
            }
            else
            {
                bool found = false;
                for (int x = 0; x < list.Count; x++)
                {
                    if (list[x].Item1 == Type)
                    {
                        var item = list[x];
                        item.Item2 = Modifier;
                        list[x]    = item;
                        found      = true;
                    }
                }

                if (!found)
                {
                    list.Add(new MyTuple <ModifierType, float>(Type, Modifier));
                }

                message = string.Format("{2} modifier {0} set to {1}", Type, Modifier, ValueType.ToString().ToLowerInvariant());
            }

            // Force reload all FTL data
            Globals.Reload();
            FTLData.ReloadAll();
            FTLInhibitor.ReloadAll();

            MessageUtils.SendMessageToPlayer(SenderSteamId, new MessageChat()
            {
                Sender = Globals.ModName, MessageText = message
            });
        }
Example #24
0
 public override string ToString()
 {
     return(string.Format("{0} {1}", ChangeType.ToString(), Item.Path));
 }
 public override string ToString()
 {
     return($"{ChangeType.ToString()} {Value.ToString()}");
 }
Example #26
0
 static public string GetLocalizedStringForChangeType(ChangeType changeType)
 {
     return(changeType.ToString());
 }
 static public string GetLocalizedStringForChangeType(ChangeType changeType)
 {
     return changeType.ToString();
 }
Example #28
0
        public static string SendToAll(ChangeType changeType, long domainID = 0)
        {
            StringBuilder errorMessages = new StringBuilder();

            string outputError;
            Dictionary <long, string> dict = new Dictionary <long, string>();

            List <ceDomainConfigEx> domains = DomainManager.GetDomains();

            if (domainID == 0 || domainID == Constant.SystemDomainID)
            {
                if (DomainManager.CurrentDomainID != Constant.SystemDomainID)
                {
                    domains = domains.Where(d => d.DomainID == DomainManager.CurrentDomainID).ToList();
                }

                foreach (ceDomainConfigEx domain in domains)
                {
                    dict.Add(domain.DomainID, changeType.ToString());
                    if (!Send(domain, changeType, out outputError))
                    {
                        errorMessages.AppendLine(outputError);
                    }
                }
            }
            else
            {
                if (domains.Exists(d => d.DomainID == domainID))
                {
                    dict.Add(domainID, changeType.ToString());
                    if (!Send(domains.FirstOrDefault(d => d.DomainID == domainID), changeType, out outputError))
                    {
                        errorMessages.AppendLine(outputError);
                    }
                }
            }
            string json = JsonConvert.SerializeObject(dict);

            NameValueCollection gameListChangedNotificationUrls = ConfigurationManager.GetSection("gameListChangedNotificationUrls") as NameValueCollection;

            if (gameListChangedNotificationUrls == null || gameListChangedNotificationUrls.Count == 0)
            {
                throw new Exception("Error, can not find the notification configration.");
            }

            foreach (string key in gameListChangedNotificationUrls.Keys)
            {
                string url = gameListChangedNotificationUrls[key];

                HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest;
                request.KeepAlive              = false;
                request.Method                 = "POST";
                request.ProtocolVersion        = Version.Parse("1.0");
                request.ContentLength          = json.Length;
                request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
                request.Accept                 = "text/plain";

                using (Stream stream = request.GetRequestStream())
                    using (StreamWriter writer = new StreamWriter(stream))
                    {
                        writer.Write(json);
                        writer.Flush();
                    }

                HttpWebResponse response = request.GetResponse() as HttpWebResponse;
                string          respText = null;
                using (Stream stream = response.GetResponseStream())
                {
                    using (StreamReader sr = new StreamReader(stream))
                    {
                        respText = sr.ReadToEnd();
                    }
                }
                response.Close();

                bool success = string.Compare(respText, "OK", true) == 0;
                if (!success)
                {
                    errorMessages.AppendLine(respText);
                }
            }

            return(errorMessages.Length == 0 ? "SUCCESS" : errorMessages.ToString());
        }
Example #29
0
    public void LoadCollectionData(string table_name, int ID = 0, ChangeType ctype = ChangeType.None)
    {
        //  bool flag;
        string queryString = "";

        if (ID == 0 || ctype == ChangeType.None)
        {
            flag        = true;
            queryString = string.Format("SELECT * FROM [{0}]", table_name);
        }
        else
        {
            flag        = false;
            queryString = string.Format("SELECT * FROM [{0}] WHERE OBJECTID = {1}", table_name, ID);
            Console.WriteLine(queryString);
        }

        using (SqlConnection sqlConnection = new SqlConnection(_connectionString))
        {
            try
            {
                SqlCommand sqlCommand = new SqlCommand(queryString, sqlConnection);

                sqlConnection.Open();

                using (SqlDataReader sql_data_reader = sqlCommand.ExecuteReader())
                {
                    var   Table_List    = new List <object>();
                    Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;

                    if (ctype == ChangeType.Delete)
                    {
                        var Changed_Data     = new Dictionary <string, object>();
                        var Table_Attributes = new Dictionary <string, object>();

                        Table_Attributes.Add("Change_type", ctype.ToString());
                        Table_Attributes.Add("TimeStamp", unixTimestamp);
                        if (table_name != "Domain")
                        {
                            Changed_Data.Add("OBJECTID", ID);
                        }
                        else
                        {
                            Changed_Data.Add("Layer", Domain_values[0]);
                            Changed_Data.Add("Field", Domain_values[1]);
                            Changed_Data.Add("Code", Domain_values[2]);
                            Changed_Data.Add("Value", Domain_values[3]);
                        }
                        Table_Attributes.Add("Data", Changed_Data);
                        Table_List.Add(Table_Attributes);
                    }
                    else
                    {
                        while (sql_data_reader.Read())
                        {
                            var Changed_Data     = new Dictionary <string, object>();
                            var Table_Attributes = new Dictionary <string, object>();

                            for (int i = 0; i < sql_data_reader.FieldCount; i++)
                            {
                                string key = sql_data_reader.GetName(i).ToString();

                                if (key != "created_user" &&
                                    key != "created_date" &&
                                    key != "last_edited_user" &&
                                    key != "last_edited_date")
                                {
                                    var value = sql_data_reader.GetValue(i);
                                    Changed_Data.Add(key, value);
                                }
                            }

                            Table_Attributes.Add("Change_type", ctype.ToString());
                            Table_Attributes.Add("TimeStamp", unixTimestamp);
                            if (Changed_Data.ContainsKey("SHAPE"))
                            {
                                Changed_Data["SHAPE"] = Changed_Data["SHAPE"].ToString();
                            }

                            Table_Attributes.Add("Data", Changed_Data);
                            Table_List.Add(Table_Attributes);
                        }
                    }

                    if (Main_List.ContainsKey(table_name))
                    {
                        if (!flag)
                        {
                            foreach (var item in Table_List)
                            {
                                Main_List[table_name].Add(item);
                            }

                            List_counter++;
                        }
                        else
                        {
                            Main_List[table_name].Add(Table_List);
                        }
                    }
                    else
                    {
                        if (!flag)
                        {
                            List_counter++;
                        }
                        Main_List.Add(table_name, Table_List);
                    }
                    // PushOnBus();
                    if (!flag)
                    {
                        if (List_counter > 500)
                        {
                            List_counter = 0;
                            flag         = true;
                        }
                    }
                    if (flag)
                    {
                        PushOnBus();
                    }
                }
                sqlConnection.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Logger.Error("Command Execution" + e.ToString());
            }
            finally
            {
                sqlConnection.Close();
            }
        }
    }
Example #30
0
 public static string Name(this ChangeType c)
 {
     return(BLL.Reward.List[c.ToString()].RewardName);
 }
Example #31
0
 public override int GetHashCode()
 {
     return((OldFullPath + FullPath + ChangeType.ToString()).GetHashCode());
 }
Example #32
0
        public static void Trigger <J> (String table, ChangeType mod, J value)
        {
            var hub = GlobalHost.ConnectionManager.GetHubContext <DataHub>();

            hub.Clients.All.tableChanged(table, mod.ToString(), value);
        }
Example #33
0
 public string GetChangeType()
 {
     return(changeType.ToString());
 }