public async Task Create(RecordsList recordsList)
        {
            if (recordsList == null)
            {
                throw new ArgumentNullException(nameof(recordsList));
            }

            await using var conn = new SqlConnection(ConnectionString);
            await conn.ExecuteAsync(CreateRecordsListSql, new { recordsList.Title, recordsList.Source }).ConfigureAwait(false);
        }
예제 #2
0
 public void AddRecord(int _score, string _name)
 {
     LoadRecords();
     if (recordsList == null)
     {
         recordsList         = new RecordsList();
         recordsList.records = new List <Record>();
     }
     recordsList.records.Add(new Record(_score, _name));
     SaveRecords();
 }
예제 #3
0
        public ActionResult About(string mainEntityName)
        {
            if (mainEntityName != null)
            {
                //Guid entityGuid = mainEntityId.;
                EntityName = mainEntityName;
                OrganizationServiceProxy serviceProxy = ConnectHelper.CrmService;
                var service = (IOrganizationService)serviceProxy;
                try
                {
                    var queryExpression = new QueryExpression()
                    {
                        Distinct   = false,
                        EntityName = mainEntityName,
                        ColumnSet  = new ColumnSet(true)
                    };
                    var mainEntity = service.RetrieveMultiple(queryExpression);
                    EntityRecords = mainEntity;
                    if (EntityRecords == null)
                    {
                        return(null);
                    }
                    string[] names   = new string[20];
                    var      records = new List <Records>();
                    for (int i = 0; i < mainEntity.Entities.Count; i++)
                    {
                        var name = mainEntity[i].GetAttributeValue <string>("new_name");  //http://localhost:51304/Home/About?mainEntityName=new_task12main
                        names[i] = name;
                        records.Insert(i, new Records {
                            ID = i, RecordsName = names[i], IsSelected = false
                        });
                    }
                    RecordsList relist = new RecordsList();
                    relist.recordss = records;
                    return(View(relist));
                }
                catch (Exception e)
                {
                    ViewBag.Message = "There is no Invoice with Name:" + mainEntityName;
                }
            }
            else
            {
                ViewBag.Message = "Enter MainEntity name as parameter";
                return(null);
            }
            ViewBag.Message = "Your application description page.";

            return(View());
        }
예제 #4
0
        public void ExtractUriQuery()
        {
            var link = "http://api.vzaar.com/api/v2/ingest_recipes?page=1&per_page=2";

            var list = new RecordsList("endpoint");

            var query = list.ExtractUriQuery(link);

            string value;

            Assert.IsTrue(query.TryGetValue("page", out value));
            Assert.AreEqual("1", value);

            Assert.IsTrue(query.TryGetValue("per_page", out value));
            Assert.AreEqual("2", value);
        }
예제 #5
0
    public async Task PostValidListWhenDatabaseIsEmpty()
    {
        var db  = new FakeDatabase();
        var sut = new RecordsListController(db);

        var dto = new RecordsListDto
        {
            Title  = "Best of Year List",
            Source = "https://alllists.com"
        };

        await sut.Post(dto);

        var expected = new RecordsList(dto.Title, dto.Source);

        Assert.Contains(expected, db);
    }
        /// <summary>
        /// Initializes a new instance of the <see cref="DnsDomainConfiguration"/> class with
        /// the specified values.
        /// </summary>
        /// <remarks>
        /// <note type="inherit">
        /// Derived types may use this constructor to create a configuration with class derived from
        /// <see cref="RecordsList"/> or <see cref="SubdomainsList"/> should a server change or extension
        /// require additional information be passed in the body of the request.
        /// </note>
        /// </remarks>
        /// <param name="name">The fully-qualified domain name.</param>
        /// <param name="timeToLive">The time-to-live for the domain.</param>
        /// <param name="emailAddress">The email address associated with the domain.</param>
        /// <param name="comment">An optional comment associated with the domain.</param>
        /// <param name="records">A <see cref="RecordsList"/> object containing the initial DNS records to associate with the domain.</param>
        /// <param name="subdomains">A <see cref="SubdomainsList"/> object containing the initial subdomains to create with the domain.</param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="name"/> is <see langword="null"/>.
        /// <para>-or-</para>
        /// <para>If <paramref name="emailAddress"/> is <see langword="null"/>.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="records"/> is <see langword="null"/>.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="subdomains"/> is <see langword="null"/>.</para>
        /// </exception>
        /// <exception cref="ArgumentException">If <paramref name="name"/> is empty.</exception>
        /// <exception cref="ArgumentOutOfRangeException">If <paramref name="timeToLive"/> is negative or <see cref="TimeSpan.Zero"/>.</exception>
        protected DnsDomainConfiguration(string name, TimeSpan?timeToLive, string emailAddress, string comment, RecordsList records, SubdomainsList subdomains)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (emailAddress == null)
            {
                throw new ArgumentNullException("emailAddress");
            }
            if (records == null)
            {
                throw new ArgumentNullException("records");
            }
            if (subdomains == null)
            {
                throw new ArgumentNullException("subdomains");
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("name cannot be empty");
            }
            if (string.IsNullOrEmpty(emailAddress))
            {
                throw new ArgumentException("emailAddress cannot be empty");
            }
            if (timeToLive <= TimeSpan.Zero)
            {
                throw new ArgumentOutOfRangeException("timeToLive cannot be negative or zero");
            }

            _name         = name;
            _emailAddress = emailAddress;
            _comment      = comment;
            if (timeToLive.HasValue)
            {
                _timeToLive = (int)timeToLive.Value.TotalSeconds;
            }

            _recordsList = records;
            _subdomains  = subdomains;
        }
예제 #7
0
        public void LoadRecords()
        {
            if (DB != null)
            {
                DB.Dispose();
            }

            //вариант1
            //DB = new DBFORAZUREEntities();
            //DB.Records.Load();
            //RecordsList = DB.Records.Local.ToBindingList();
            //if (RecordsList.Count > 0) SelectedRecord = RecordsList.First();
            try
            {
                //user id=AxisG;password=POLIapplehouse93;
                var connectionstring    = ConfigurationManager.ConnectionStrings["TestDBEntitiesWithoutPwd"].ConnectionString;
                var entityStringBuilder = new EntityConnectionStringBuilder(connectionstring);
                var factory             = DbProviderFactories.GetFactory(entityStringBuilder.Provider);
                var providerBuilder     = factory.CreateConnectionStringBuilder();

                providerBuilder.ConnectionString = entityStringBuilder.ProviderConnectionString;
                //providerBuilder.Add("user id", "AxisG");
                //providerBuilder.Add("password", "POLIapplehouse93");
                providerBuilder.Add("user id", "TestUser");
                providerBuilder.Add("password", "TestPassword_1");
                entityStringBuilder.ProviderConnectionString = providerBuilder.ToString();

                DB = new TestDBEntities(entityStringBuilder.ToString());
                //DB = new TestDBEntities();
                DB.TestTables.Load();
                RecordsList = DB.TestTables.Local.ToBindingList();
                if (RecordsList.Count > 0)
                {
                    SelectedRecord = RecordsList.First();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #8
0
        public ActionResult About(RecordsList rec)
        {
            OrganizationServiceProxy serviceProxy = ConnectHelper.CrmService;
            var    service = (IOrganizationService)serviceProxy;
            string PPath   = Server.MapPath("~/Uploads/");

            if (!Directory.Exists(PPath))
            {
                Directory.CreateDirectory(PPath);
            }
            string fileName = Path.GetFileName(rec.PostedFile.FileName);

            rec.PostedFile.SaveAs(PPath + fileName);
            //string FilePath = Path.GetFullPath(rec.PostedFile.FileName);
            string FilePath = PPath + fileName;

            foreach (var item in rec.recordss)
            {
                if (item.IsSelected)
                {
                    string path = FilePath;
                    fileName = Path.GetFileName(path);
                    ColumnSet attributes = new ColumnSet(new string[] { "annotationid", "filename", "documentbody", "isdocument", "mimetype" });
                    Entity    annotation = new Entity("annotation");
                    annotation["objectid"]       = new EntityReference(EntityName, EntityRecords[item.ID].Id); //and attach to a record, e.g. contact
                    annotation["objecttypecode"] = EntityName;
                    annotation["subject"]        = fileName;

                    annotation["filename"]     = fileName; //the annotation has fields which contain the attachment information
                    annotation["mimetype"]     = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
                    annotation["documentbody"] = Convert.ToBase64String(System.IO.File.ReadAllBytes(path));
                    service.Create(annotation);
                }
            }
            return(View(rec));
        }
예제 #9
0
 public DeleteCommandFactory(Booknote booknote, RecordsList rl)
 {
     _booknote = booknote;
     _rl       = rl;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DnsDomainConfiguration"/> class with
        /// the specified values.
        /// </summary>
        /// <remarks>
        /// <note type="inherit">
        /// Derived types may use this constructor to create a configuration with class derived from
        /// <see cref="RecordsList"/> or <see cref="SubdomainsList"/> should a server change or extension
        /// require additional information be passed in the body of the request.
        /// </note>
        /// </remarks>
        /// <param name="name">The fully-qualified domain name.</param>
        /// <param name="timeToLive">The time-to-live for the domain.</param>
        /// <param name="emailAddress">The email address associated with the domain.</param>
        /// <param name="comment">An optional comment associated with the domain.</param>
        /// <param name="records">A <see cref="RecordsList"/> object containing the initial DNS records to associate with the domain.</param>
        /// <param name="subdomains">A <see cref="SubdomainsList"/> object containing the initial subdomains to create with the domain.</param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="name"/> is <c>null</c>.
        /// <para>-or-</para>
        /// <para>If <paramref name="emailAddress"/> is <c>null</c>.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="records"/> is <c>null</c>.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="subdomains"/> is <c>null</c>.</para>
        /// </exception>
        /// <exception cref="ArgumentException">If <paramref name="name"/> is empty.</exception>
        /// <exception cref="ArgumentOutOfRangeException">If <paramref name="timeToLive"/> is negative or <see cref="TimeSpan.Zero"/>.</exception>
        protected DnsDomainConfiguration(string name, TimeSpan? timeToLive, string emailAddress, string comment, RecordsList records, SubdomainsList subdomains)
        {
            if (name == null)
                throw new ArgumentNullException("name");
            if (emailAddress == null)
                throw new ArgumentNullException("emailAddress");
            if (records == null)
                throw new ArgumentNullException("records");
            if (subdomains == null)
                throw new ArgumentNullException("subdomains");
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException("name cannot be empty");
            if (string.IsNullOrEmpty(emailAddress))
                throw new ArgumentException("emailAddress cannot be empty");
            if (timeToLive <= TimeSpan.Zero)
                throw new ArgumentOutOfRangeException("timeToLive cannot be negative or zero");

            _name = name;
            _emailAddress = emailAddress;
            _comment = comment;
            if (timeToLive.HasValue)
                _timeToLive = (int)timeToLive.Value.TotalSeconds;

            _recordsList = records;
            _subdomains = subdomains;
        }
예제 #11
0
 public Task Create(RecordsList recordsList)
 {
     return(Task.CompletedTask);
 }
예제 #12
0
 public void LoadRecords()
 {
     recordsList = JsonUtility.FromJson <RecordsList>(PlayerPrefs.GetString("RecordsSaveString"));
 }
예제 #13
0
 public IReadOnlyList <UsageRecord> RecordsOf(string message)
 {
     return(RecordsList.Where(r => r.Message.Contains(message)).ToList());
 }
예제 #14
0
 public IReadOnlyList <UsageRecord> RecordsOf(UsageType type)
 {
     return(RecordsList.Where(r => r.Type == type).ToList());
 }
예제 #15
0
 public IReadOnlyList <UsageRecord> RecordsOf(User op)
 {
     return(RecordsList.Where(r => r.Operator == op).ToList());
 }