using System;
          using System.Collections.Generic;
          using System.ComponentModel;
          using System.Data;
          using System.Drawing;
          using System.Linq;
          using System.Text;
          using System.Windows.Forms;
          using System.Threading;
          using System.Collections;
          namespace CheckDomain
          {
              public partial class autoDomain : Form
              {
                  ServiceHelper.Service1SoapClient hw = new CheckDomain.ServiceHelper.Service1SoapClient();
                  Common.Dba.DbSqlLiteData dba = null;
                  Thread thread = null;
                
                  public autoDomain()
                  {
                      InitializeComponent();
                  }

                  private void checkBox1_CheckedChanged(object sender, EventArgs e)
                  {
                      for (int i = 0; i < this.dataGridView1.Rows.Count - 1; i++)
                      {
                          if(((CheckBox)sender).Checked)
                          this.dataGridView1.Rows[i].Cells[0].Value = "True";
                          else
                              this.dataGridView1.Rows[i].Cells[0].Value = "False";
                      }
                  }
                  public void BindData()
                  {
                      dba = new Common.Dba.DbSqlLiteData("data source=" + Application.StartupPath + "/" + System.Configuration.ConfigurationManager.AppSettings["datasource"]);
                      // dba.ConnectionString =
                      DataTable tempDT = new DataTable();
                      tempDT = dba.GetTable("select domain from domain");

                      //tempDT.Columns.Add("Domain");
                      //DataRow tr = tempDT.NewRow();
                      //tr["Domain"] = "goudiannao.com";
                      //tempDT.Rows.Add(tr);
                      this.dataGridView1.DataSource = tempDT;
                  }
                  public void BindMyData()
                  {
                      //dba = new Common.Dba.DbSqlLiteData("data source=" + Application.StartupPath + "/" + System.Configuration.ConfigurationManager.AppSettings["datasource"]);
                      // dba.ConnectionString =
                      DataTable tempDT = new DataTable();
                      tempDT = dba.GetTable("select DomainName as domain from Mydomain");

                      //tempDT.Columns.Add("Domain");
                      //DataRow tr = tempDT.NewRow();
                      //tr["Domain"] = "goudiannao.com";
                      //tempDT.Rows.Add(tr);
                      this.dataGridView2.DataSource = tempDT;
                  }
                  public void SetStatus(DataGridViewRow dr, DomainStatus ds)
                  {
                      bool status = ds.Status;
                      if (status)
                      {
                          if (ds.Expiration_Date < DateTime.Now)
                          {
                              dr.Cells[1].Value = "已過期";
                          }
                          else
                          {
                              dr.Cells[1].Value = "已注冊";
                          }

                      }
                      else
                      {
                          dr.Cells[1].Value = "未注冊";
                      }

                      dr.Cells[2].Value = ds.Create_Date;
                      dr.Cells[3].Value = ds.Updated_Date;
                      dr.Cells[4].Value = ds.Expiration_Date;
                  }

                  public void SetStatusEx(DataGridViewRow dr, DomainStatus ds)
                  {
                      bool status = ds.Status;
                      if (status)
                      {
                          if (ds.Expiration_Date < DateTime.Now)
                          {
                              dr.Cells[1].Value = "已過期";
                              dr.Cells[2].Value = ds.Create_Date;
                              dr.Cells[3].Value = ds.Updated_Date;
                              dr.Cells[4].Value = ds.Expiration_Date;
                          }
                          else
                          {
                              dr.Cells[1].Value = "已注冊";
                          }

                      }
                      else
                      {
                          dr.Cells[1].Value = "未注冊";
                          dr.Cells[2].Value = ds.Create_Date;
                          dr.Cells[3].Value = ds.Updated_Date;
                          dr.Cells[4].Value = ds.Expiration_Date;
                      }

               
                  }
                  public void SetStatusSoonEx(DataGridViewRow dr, DomainStatus ds)
                  {
                      bool status = ds.Status;
                      if (status)
                      {
                        
                          if (ds.Expiration_Date < DateTime.Now)
                          {
                              dr.Cells[1].Value = "已過期";
                              dr.Cells[2].Value = ds.Create_Date;
                              dr.Cells[3].Value = ds.Updated_Date;
                              dr.Cells[4].Value = ds.Expiration_Date;
                          }
                          else
                          {
                              TimeSpan ts = DateTime.Now - ds.Expiration_Date;
                              if (ts.TotalDays < 30)
                              {

                                  dr.Cells[1].Value = "即將過期一個月內";
                              }
                              else
                              {

                                  dr.Cells[1].Value = "已注冊";
                              }
                          }

                      }
                      else
                      {
                          dr.Cells[1].Value = "未注冊";
                          dr.Cells[2].Value = ds.Create_Date;
                          dr.Cells[3].Value = ds.Updated_Date;
                          dr.Cells[4].Value = ds.Expiration_Date;
                      }


                  }

                  private void BtCheck_Click(object sender, EventArgs e)
                  {

                      //MessageBox.Show(this.dataGridView1.Rows[0].Cells[0].Value.ToString());
                      //int tempRowsCount = dataGridView1.Rows.Count-1;
                      //DataGridViewRow[] dgrvs = new DataGridViewRow[tempRowsCount];
                      //int i = 0;
                      ArrayList al = new ArrayList();
                      foreach (DataGridViewRow di in dataGridView1.Rows)
                      {
                          string temp = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column1"].Value)) ? ("") : (Convert.ToString(di.Cells["Column1"].Value));
                          string tempDomain = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column2"].Value)) ? ("") : (Convert.ToString(di.Cells["Column2"].Value));
                       
                          if (temp == "True" && tempDomain.Length>0)
                              al.Add(di);
                      }
                      ThreadWithData twd = new ThreadWithData(al, new CallBack(SetStatus));
                      thread = new Thread(new ThreadStart(twd.Run));
                      thread.Start();
                      //if (thread == null) {
                      //    thread = new Thread(new ThreadStart(twd.Run));
                      //}
                      //if (thread.ThreadState == System.Threading.ThreadState.Stopped)
                      //{
                      //    thread.Start();
                      //}
                      //else
                      //{
                      //    thread = new Thread(new ThreadStart(twd.Run));
                      //    thread.Start();
                      //}
                     
                  }

                  private void tabPage1_Click(object sender, EventArgs e)
                  {

                  }

                  private void autoDomain_Load(object sender, EventArgs e)
                  {
                      BindData();
                  }

                  private void button1_Click(object sender, EventArgs e)
                  {
                      BindData();
                  }

                  private void button2_Click(object sender, EventArgs e)
                  {
                      foreach (DataGridViewRow di in dataGridView1.Rows)
                      {
                          string temp = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column1"].Value)) ? ("") : (Convert.ToString(di.Cells["Column1"].Value));
                          string tempDomain = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column2"].Value)) ? ("") : (Convert.ToString(di.Cells["Column2"].Value));
                          string tempInsertSql = "";
                          if (temp == "True" && tempDomain.Length > 0)
                          {
                              if (dba.GetOne("select count(1) from MyDomain where domainname='" + tempDomain + "'")=="0")
                              tempInsertSql = string.Format("insert into MyDomain(uid,domainname) values(1,'{0}')", tempDomain);
                              dba.GetState(tempInsertSql);
                          }

                      }
                      MessageBox.Show("成功添加管住的域名!");
                  }

                  private void checkBox2_Click(object sender, EventArgs e)
                  {
                      for (int i = 0; i < this.dataGridView2.Rows.Count-1; i++)
                      {
                          if (((CheckBox)sender).Checked)
                              this.dataGridView2.Rows[i].Cells[0].Value = "True";
                          else
                              this.dataGridView2.Rows[i].Cells[0].Value = "False";
                      }
                  }

                  private void 關于我們ToolStripMenuItem_Click(object sender, EventArgs e)
                  {
                      new about().ShowDialog();
                  }

                  private void tabControl1_TabIndexChanged(object sender, EventArgs e)
                  {
                      //if(((TabPage)(sender)).c)
                      int tempIndex = this.tabControl1.SelectedIndex ;
                      if (tempIndex == 1)
                      {
                          BindMyData();
                      }

                  }

                  private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
                  {
                      int tempIndex = this.tabControl1.SelectedIndex;
                      if (tempIndex == 1)
                      {
                          BindMyData();
                      }
                  }

                  private void button8_Click(object sender, EventArgs e)
                  {
                      ArrayList tempAl = new ArrayList();
                      foreach (DataGridViewRow di in dataGridView2.Rows)
                      {
                          string temp = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column11"].Value)) ? ("") : (Convert.ToString(di.Cells["Column11"].Value));
                          string tempDomain = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column12"].Value)) ? ("") : (Convert.ToString(di.Cells["Column12"].Value));
                          if (temp == "True" && tempDomain.Length > 0)
                              tempAl.Add("delete from mydomain where DomainName='" + tempDomain + "'");
                      }
                      bool tempStatus = this.dba.GetTranState(tempAl);
                      if (tempStatus)
                      {
                          MessageBox.Show("刪除陳功");
                          this.BindMyData();
                      }
                      else
                      {
                          MessageBox.Show("刪除失敗請聯系作者");
                      }
                  }

                  private void button9_Click(object sender, EventArgs e)
                  {
                      ArrayList tempAl = new ArrayList();
                      foreach (DataGridViewRow di in dataGridView1.Rows)
                      {
                          string temp = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column1"].Value)) ? ("") : (Convert.ToString(di.Cells["Column1"].Value));
                          string tempDomain = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column2"].Value)) ? ("") : (Convert.ToString(di.Cells["Column2"].Value));
                          if (temp == "True" && tempDomain.Length > 0)
                              tempAl.Add("delete from domain where domain='" + tempDomain + "'");
                      }
                      bool tempStatus = this.dba.GetTranState(tempAl);
                      if (tempStatus)
                      {
                          MessageBox.Show("刪除陳功");
                          this.BindData();
                      }
                      else
                      {
                          MessageBox.Show("刪除失敗請聯系作者");
                      }

                  }

                  private void button3_Click(object sender, EventArgs e)
                  {
                     EditDomain edForm =  new EditDomain();
                     edForm.TableName="1";
                     edForm.ShowDialog();
                  }

                  private void button10_Click(object sender, EventArgs e)
                  {

                  }

                  private void button10_Click_1(object sender, EventArgs e)
                  {
                      ArrayList tempAl = new ArrayList();
                      foreach (DataGridViewRow di in dataGridView1.Rows)
                      {
                          string temp = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column1"].Value)) ? ("") : (Convert.ToString(di.Cells["Column1"].Value));
                          string tempDomain = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column2"].Value)) ? ("") : (Convert.ToString(di.Cells["Column2"].Value));
                          string tempInsertSql = "";
                          if (temp == "True" && tempDomain.Length > 0)
                          {
                              tempAl.Add(di);
                          }
                      }
                      ThreadWithData twd = new ThreadWithData(tempAl, new CallBack(SetStatusEx));
                      thread = new Thread(new ThreadStart(twd.Run));
                      thread.Start();

                  }

                  private void button11_Click(object sender, EventArgs e)
                  {
                      ArrayList tempAl = new ArrayList();
                      foreach (DataGridViewRow di in dataGridView1.Rows)
                      {
                          string temp = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column1"].Value)) ? ("") : (Convert.ToString(di.Cells["Column1"].Value));
                          string tempDomain = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column2"].Value)) ? ("") : (Convert.ToString(di.Cells["Column2"].Value));
                          string tempInsertSql = "";
                          if (temp == "True" && tempDomain.Length > 0)
                          {
                              tempAl.Add(di);
                          }
                      }
                      ThreadWithData twd = new ThreadWithData(tempAl, new CallBack(SetStatusSoonEx));
                      thread = new Thread(new ThreadStart(twd.Run));
                      thread.Start();
                  }

                  private void button7_Click(object sender, EventArgs e)
                  {

                     
                  

                      //wdr.
                      //int tempRowsCount = dataGridView1.Rows.Count-1;
                      //DataGridViewRow[] dgrvs = new DataGridViewRow[tempRowsCount];
                      //int i = 0;
                      ArrayList al = new ArrayList();
                      foreach (DataGridViewRow di in dataGridView2.Rows)
                      {
                          string temp = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column11"].Value)) ? ("") : (Convert.ToString(di.Cells["Column11"].Value));
                          string tempDomain = string.IsNullOrEmpty(Convert.ToString(di.Cells["Column12"].Value)) ? ("") : (Convert.ToString(di.Cells["Column12"].Value));
                       
                       
                          if (temp == "True" && tempDomain.Length > 0)
                              al.Add(di);
                      }
                      ThreadWithData twd = new ThreadWithData(al, new CallBack(SetStatus));
                      thread = new Thread(new ThreadStart(twd.RunMy));
                      thread.Start();
                  }

                  private void button6_Click(object sender, EventArgs e)
                  {
                      BindMyData();
                  }

                  private void button4_Click(object sender, EventArgs e)
                  {
                      EditDomain edForm = new EditDomain();
                      edForm.TableName = "2";
                      edForm.ShowDialog();
                  }

                  private void button5_Click(object sender, EventArgs e)
                  {
                      string domain = this.TbDomain.Text;
                      string tempContent = "";
                      try
                      {
                          tempContent = new UrlCheck().GetHttpData("            }
                      catch (Exception ex)
                      {
                          tempContent = "";

                      }
                      this.richTextBox1.Text = tempContent;
                  }
              }
          }


          只有注冊用戶登錄后才能發表評論。


          網站導航:
          博客園   IT新聞   Chat2DB   C++博客   博問  
           

          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 虹口区| 黑水县| 德江县| 武强县| 元朗区| 宣武区| 神农架林区| 区。| 娱乐| 岐山县| 澜沧| 城步| 永和县| 柳林县| 甘孜| 九龙城区| 海淀区| 大姚县| 白玉县| 民权县| 新蔡县| 彭泽县| 顺平县| 营口市| 扎兰屯市| 徐州市| 陇川县| 黎川县| 肥乡县| 赞皇县| 兴海县| 会昌县| 阿勒泰市| 蓬溪县| 元氏县| 富民县| 门源| 乌兰浩特市| 扎赉特旗| 垣曲县| 鸡东县|