Пример #1
0
        private Dictionary <string, string> GetInsertedColumns(List <ColumnAndField> columns)
        {
            var matchedColumns = new Dictionary <string, string>();

            foreach (var list in columns)
            {
                var match = matchedColumns.FirstOrDefault(t => t.Key == list.ColumnName);
                if (match.Key != null || list.Value == null)
                {
                    continue;
                }
                if (list.DataType.Equals(Metadata.Business.DataAnnotations.DataType.Password))
                {
                    var password = new Password();
                    password.DigestPassword(list.Value.ToString());
                    matchedColumns.Add("[" + list.DataType + "Hash]", Convert.ToBase64String(password.PasswordHash));
                    matchedColumns.Add("[" + list.DataType + "Salt]", Convert.ToBase64String(password.PasswordSalt));
                }
                else
                {
                    string value = list.DataType.ToString().ToLower().Equals("datetime") ? HelperUtility.ConvertDateToUTC(list.Value.ToString()) : list.Value.ToString();
                    if (string.IsNullOrEmpty(value))
                    {
                        continue;
                    }
                    matchedColumns.Add(list.ColumnName, value);
                }
            }
            return(matchedColumns);
        }