private void SetPublisherData()
        {
            // Set publishers' data

            _pd = new CRA.ModelLayer.MetadataTypes.PublisherData();
            _pd.Add("Creator", "*****@*****.**");
            _pd.Add("Date", "7/26/2018");
            _pd.Add("Publisher", "INRA");
        }
Beispiel #2
0
        private void SetPublisherData()
        {
            // Set publishers' data

            _pd = new CRA.ModelLayer.MetadataTypes.PublisherData();
            _pd.Add("Creator", "*****@*****.**");
            _pd.Add("Date", "03/02/2018");
            _pd.Add("Publisher", "INRA");
        }
Beispiel #3
0
        private void SetPublisherData()
        {
            // Set publishers' data

            _pd = new CRA.ModelLayer.MetadataTypes.PublisherData();
            _pd.Add("Creator", "*****@*****.**");
            _pd.Add("Date", "3/29/2018");
            _pd.Add("Publisher", "Inra");
        }
 public IActionResult CreatePublisher([FromBody] PublisherData pdata)
 {
     if (ModelState.IsValid)
     {
         Publisher p = pdata.Publisher;
         context.Add(p);
         context.SaveChanges();
         return(Ok(p.PublisherId));
     }
     else
     {
         return(BadRequest(ModelState));
     }
 }
 public IActionResult ReplacePublisher(long id,
                                       [FromBody] PublisherData sdata)
 {
     if (ModelState.IsValid)
     {
         Publisher p = sdata.Publisher;
         p.PublisherId = id;
         context.Update(p);
         context.SaveChanges();
         return(Ok());
     }
     else
     {
         return(BadRequest(ModelState));
     }
 }
Beispiel #6
0
        private void EnsureMandatoryValuesAreProvided(PublisherData publisherData)
        {
            var publisherDataErrors = new StringBuilder();

            if (publisherData == null)
            {
                publisherDataErrors.Append("\n- No publisher data present in the test data");
            }
            else
            {
                if (string.IsNullOrWhiteSpace(publisherData.Name))
                {
                    publisherDataErrors.Append("\n- Publisher Name not set");
                }

                if (string.IsNullOrWhiteSpace(publisherData.Address))
                {
                    publisherDataErrors.Append("\n- Publisher Address not set");
                }

                if (string.IsNullOrWhiteSpace(publisherData.Country))
                {
                    publisherDataErrors.Append("\n- Publisher Country not set");
                }

                if (string.IsNullOrWhiteSpace(publisherData.AgencyVendorCommission))
                {
                    publisherDataErrors.Append("\n- Publisher Agency/Vendor Commission not set");
                }

                if (string.IsNullOrWhiteSpace(publisherData.ContactName))
                {
                    publisherDataErrors.Append("\n- Publisher Contact Name not set");
                }

                if (string.IsNullOrWhiteSpace(publisherData.ContactEmail))
                {
                    publisherDataErrors.Append("\n- Publisher Contact Email not set");
                }
            }

            if (!string.IsNullOrEmpty(publisherDataErrors.ToString()))
            {
                throw new ArgumentException($"The feature file {FeatureContext.FeatureInfo.Title} has the following data issues:\n {publisherDataErrors}");
            }
        }
        public void Update()
        {
            if (Status != Status.Connected)
            {
                PublisherData.Clear();
                SubscriberData.Clear();

                while (Actions.TryDequeue(out var action))
                {
                }
            }

            foreach (var pub in PublisherData)
            {
                if (pub.ElapsedTime >= 1 && pub.Count > pub.StartCount)
                {
                    pub.Frequency   = (pub.Count - pub.StartCount) / pub.ElapsedTime;
                    pub.StartCount  = pub.Count;
                    pub.ElapsedTime = 0f;
                }
                else
                {
                    pub.ElapsedTime += Time.unscaledDeltaTime;
                }
            }

            foreach (var sub in SubscriberData)
            {
                if (sub.ElapsedTime >= 1 && sub.Count > sub.StartCount)
                {
                    sub.Frequency   = (sub.Count - sub.StartCount) / sub.ElapsedTime;
                    sub.StartCount  = sub.Count;
                    sub.ElapsedTime = 0f;
                }
                else
                {
                    sub.ElapsedTime += Time.unscaledDeltaTime;
                }
            }

            while (Actions.TryDequeue(out var action))
            {
                action();
            }
        }
Beispiel #8
0
 public static List <PublisherData> getAllPublisher()
 {
     using (Book_Sale_ManagerEntities context = new Book_Sale_ManagerEntities())
     {
         List <Publisher>     publishers = context.Publishers.ToList();
         List <PublisherData> result     = new List <PublisherData>();
         foreach (var item in publishers)
         {
             PublisherData p = new PublisherData()
             {
                 ID   = item.ID,
                 name = item.name
             };
             result.Add(p);
         }
         return(result);
     }
 }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (readyAddNew == false)
            {
                readyAddNew = true;
                txtID.Text  = "";
                txtName.Focus();
                txtName.Text = "";
                btnAdd.Text  = "Save Publisher";
                btnAdd.FlatAppearance.BorderSize  = 2;
                btnAdd.FlatAppearance.BorderColor = Color.Green;
                lblMessage.Text = "Enter new Publisher";
            }
            else
            {
                if (validate() == true)
                {
                    PublisherData p = new PublisherData()
                    {
                        name = txtName.Text.Trim()
                    };
                    bool re = proxy.AddPublisher(p);
                    if (re == true)
                    {
                        txtName.Focus();
                        txtName.Text = "";

                        MessageBox.Show("Add new Publisher is successful.");
                        // int lastInt = int.Parse(datatable.Rows[datatable.Rows.Count - 1]["ID"].ToString());
                        //datatable.Rows.Add(lastInt + 2, txtName.Text.Trim());
                        refeshForm();
                    }
                    else
                    {
                        MessageBox.Show("Add new Publisher is fail");
                    }
                }
                else
                {
                    return;
                }
            }
        }
Beispiel #10
0
        public void EditPublisher(PublisherData publisherData)
        {
            EnsureMandatoryValuesAreProvided(publisherData);

            ClearInputAndTypeValue(_txtName, publisherData.Name);
            ClearInputAndTypeValueIfRequired(_txtSecondaryLanguageName, publisherData.SecondaryLanguageName);
            ClearInputAndTypeValue(_txtAddress, publisherData.Address);
            SelectWebformDropdownValueByText(_ddlCountry, publisherData.Country);
            SelectWebformDropdownValueIfRequired(_ddlStatus, publisherData.Status);
            SetWebformCheckBoxState(_chkSubscriber, publisherData.IsSubscriber);

            SetWebformCheckBoxState(_chkRestrictAgencyAccess, publisherData.IsRestrictAgencyAccess);
            if (publisherData.IsRestrictAgencyAccess)
            {
                SelectAgencyAccessFrame _selectAgencyAccessFrame = new SelectAgencyAccessFrame(driver, FeatureContext);
                if (publisherData.RestrictAgencyAccessList == null || !publisherData.RestrictAgencyAccessList.Any())
                {
                    return;
                }

                foreach (var agencyAccess in publisherData.RestrictAgencyAccessList)
                {
                    ScrollAndClickElement(_lnkManageAgencyAccess);
                    SwitchToFrame(SELECT_AGENCY_ACCESS_FRAME);
                    _selectAgencyAccessFrame.SelectAgencyAccess(agencyAccess, publisherData.Name);
                    WaitForLoaderSpinnerToDisappear();
                }
            }

            ClearInputAndTypeValueIfRequired(_txtTaxNumber, publisherData.TaxNumber);
            ClearInputAndTypeValue(_txtAgencyCommission, publisherData.AgencyVendorCommission);
            TypeValueIfRequired(_flLogoUpload, publisherData.LogoFilePath);
            SelectWebformDropdownValueIfRequired(_ddlLanguage, publisherData.Language);
            SetWebformCheckBoxState(_chkEnablePublisherOverride, publisherData.EnablePublisherOverride);
            ClearInputAndTypeValue(_txtContactName, publisherData.ContactName);
            ClearInputAndTypeValue(_txtContactEmail, publisherData.ContactEmail);
            ClearInputAndTypeValueIfRequired(_txtContactTelephone, publisherData.ContactTelephone);
            ClearInputAndTypeValueIfRequired(_txtContactFax, publisherData.ContactFax);
            SetWebformCheckBoxState(_chkTaxMedia, publisherData.TaxMedia);

            ClickElement(_btnSave);
        }
        public void CreatePublisher(PublisherData publisherData)
        {
            EnsureMandatoryValuesAreProvided(publisherData);

            ClearInputAndTypeValue(_txtName, publisherData.Name);
            ClearInputAndTypeValueIfRequired(_txtSecondaryLanguageName, publisherData.SecondaryLanguageName);
            ClearInputAndTypeValue(_txtAddress, publisherData.Address);
            SelectWebformDropdownValueByText(_ddlCountry, publisherData.Country);
            SelectWebformDropdownValueIfRequired(_ddlStatus, publisherData.Status);
            SetWebformCheckBoxState(_chkSubscriber, publisherData.IsSubscriber);
            SetWebformCheckBoxState(_chkRestrictAgencyAccess, publisherData.IsRestrictAgencyAccess);
            ClearInputAndTypeValueIfRequired(_txtTaxNumber, publisherData.TaxNumber);
            ClearInputAndTypeValue(_txtAgencyCommission, publisherData.AgencyVendorCommission);
            TypeValueIfRequired(_flLogoUpload, publisherData.LogoFilePath);
            SelectWebformDropdownValueIfRequired(_ddlLanguage, publisherData.Language);
            SetWebformCheckBoxState(_chkEnablePublisherOverride, publisherData.EnablePublisherOverride);
            ClearInputAndTypeValue(_txtContactName, publisherData.ContactName);
            ClearInputAndTypeValue(_txtContactEmail, publisherData.ContactEmail);
            ClearInputAndTypeValueIfRequired(_txtContactTelephone, publisherData.ContactTelephone);
            ClearInputAndTypeValueIfRequired(_txtContactFax, publisherData.ContactFax);
            SetWebformCheckBoxState(_chkTaxMedia, publisherData.TaxMedia);

            ClickElement(_btnSave);
        }
        private void ShowPublisherRecord(object sender, EventArgs e)
        {
            PublisherData Data = new PublisherData("Book Publisher", TheUser);

            EntityForm = new EntityForm(this, Data);
        }
Beispiel #13
0
        public override void Notify(PublisherData data)
        {
            PublisherDataTest dt = (PublisherDataTest)data;

            Console.WriteLine(dt.Text() + "; type=" + dt.Type());
        }
Beispiel #14
0
 public virtual void Notify(PublisherData data)
 {
 }