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(); } }
public int InsertTableTrackingWebHYIP(TrackingWebHYIP w) { try { string sql = " insert into TrackingWebHYIP values('" + w.Addrress + "'," + w.GetInformationAuto + "," + w.Good + ") SELECT SCOPE_IDENTITY()"; cmd = new SqlCommand(sql); cmd.Connection = conn; this.openConnection(); int result = Convert.ToInt32(cmd.ExecuteScalar()); this.closeConnection(); return(result); } catch (Exception ex) { throw ex; } }
public int InsertTrackingWebHYIP(TrackingWebHYIP tracking) { return(conector.InsertTableTrackingWebHYIP(tracking)); }
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(); } } } } } }