private void button1_Click(object sender, EventArgs e) { TrackingWebHYIP tracweb = new TrackingWebHYIP(); TrackingWebHYIPDatabase trackwebdata = new TrackingWebHYIPDatabase(); BUS_TrackingWebHYIP buss = new BUS_TrackingWebHYIP(); BUS_TrackingWebHYIPDatabase bussdata = new BUS_TrackingWebHYIPDatabase(); //Id web vua add vao co so du lieu tracweb.GetInformationAuto = 0; tracweb.Addrress = textBox_addrress.Text; tracweb.Good = 1; int ID = buss.InsertTrackingWebHYIP(tracweb); //lay dep va with trang web string timenow = DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss.fff"); trackwebdata.MaWeb = ID; trackwebdata.Deposit = float.Parse(textBox_deposit.Text, CultureInfo.InvariantCulture.NumberFormat); trackwebdata.WithDraw = float.Parse(textBox_withdraw.Text, CultureInfo.InvariantCulture.NumberFormat); trackwebdata.Today = timenow; //insert TrackingWebHYIPDatabase int result = bussdata.InsertTrackingWebHYIPDatabase(trackwebdata); if (result != 0) { MessageBox.Show("OK"); this.Close(); p_frm.LoadDataTracking(); } }
private void dataGridView2_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (dataGridView2.Columns[e.ColumnIndex].Name != "") { DataGridViewRow selectedRow = dataGridView2.Rows[e.RowIndex]; string Name = selectedRow.Cells["name"].Value.ToString(); if (Name != "") { bool checkname = CheckNameExits(Name, dataGridView2); if (checkname) { MessageBox.Show("Name Exits"); selectedRow.Cells["name"].Value = ""; } else { //insert vo TrackingWebHYIP BUS_TrackingWebHYIP buss = new BUS_TrackingWebHYIP(); BUS_TrackingWebHYIPDatabase bussdata = new BUS_TrackingWebHYIPDatabase(); TrackingWebHYIP tracweb = new TrackingWebHYIP(); TrackingWebHYIPDatabase trackwebdata = new TrackingWebHYIPDatabase(); tracweb.Addrress = Name; GetDataWeb getdt = new GetDataWeb(); Tuple <string, string> info = getdt.GetDepositAndWithdraw(Name); if (info.Item1.ToString() == "cloudfare") { DialogResult result = MessageBox.Show("This webste use Cloudfare . Add manual"); if (result == DialogResult.OK) { AddWebTracking frm = new AddWebTracking(this); frm.ShowDialog(); } } else if (info.Item1.ToString() == "Something Wrong" || info.Item1.ToString() == "" || info.Item2.ToString() == "") { DialogResult result = MessageBox.Show("Something wrong.Add manual"); if (result == DialogResult.OK) { AddWebTracking frm = new AddWebTracking(this); frm.ShowDialog(); } } else { //Id web vua add vao co so du lieu tracweb.GetInformationAuto = 1; tracweb.Good = 1; int ID = buss.InsertTrackingWebHYIP(tracweb); //lay dep va with trang web string timenow = DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss.fff"); trackwebdata.MaWeb = ID; trackwebdata.Deposit = float.Parse(info.Item1.ToString(), CultureInfo.InvariantCulture.NumberFormat); trackwebdata.WithDraw = float.Parse(info.Item2.ToString(), CultureInfo.InvariantCulture.NumberFormat); trackwebdata.Today = timenow; //insert TrackingWebHYIPDatabase int result = bussdata.InsertTrackingWebHYIPDatabase(trackwebdata); if (result != 0) { LoadDataTracking(); } } } } } }