private void btnTest_Click(object sender, EventArgs e) { if (cbWebSite.SelectedItem == null || txtURL.Text == "" || WebSiteContext.GetModel(((WebSiteModel)cbWebSite.SelectedItem).Id) == null) { MessageBox.Show("Lutfen gerekli alanlari oldurun!", "Uyari", MessageBoxButtons.OK); return; } if (DataContext.IsSearchPointExist(txtURL.Text)) { MessageBox.Show("Ilan hali hazirlda kayitli!", "Uyari", MessageBoxButtons.OK); return; } WebSiteModel site = (WebSiteModel)cbWebSite.SelectedItem; switch (site.Id) { case 1: Rec = SC.HPScanAd(txtURL.Text); break; case 2: Rec = SC.N11ScanAd(txtURL.Text); break; default: break; } if (Rec == null) { lblTestStatus.ForeColor = Color.Red; lblTestStatus.Text = "Operation failed!"; btnAdd.Enabled = false; } else { if (txtName.Text != "") { string tempText = txtName.Text; FillForm(); txtName.Text = tempText; Rec.Name = tempText; } else { FillForm(); } lblTestStatus.ForeColor = Color.Green; lblTestStatus.Text = "Operation succecful!"; btnAdd.Enabled = true; } }
private void FillForm() { lblId.Text = Rec.Id.ToString(); txtName.Text = Rec.Name; txtURL.Text = Rec.UrlParameters; cbWebSite.SelectedItem = WebSiteContext.GetModel(Rec.WebSite); lblCheckDate.Text = String.Format("{0:dd/MM/yyyy hh:mm:ss tt}", Rec.CheckDate); txtPrice.Text = String.Format("{0:00}", Rec.Price); lblCurrency.Text = WebSiteContext.GetCurrencyCode(Rec.WebSite); cbWebSite.Enabled = false; }