private void button1_Click(object sender, EventArgs e) { BAL.DP_Form Land = new BAL.DP_Form(); decimal flBalance = 0; string strNumber = ""; flBalance = Convert.ToDecimal(Land.GetDataTable(IDText.Text.ToString()).Rows[0][1]); strNumber = Convert.ToString(Land.GetDataTable(IDText.Text.ToString()).Rows[0][0]); if (flBalance >= 5) { if (Land.UpdataSQL_Land(RowIndex + 1, strNumber, NameText.Text.ToString(), IDText.Text.ToString(), flBalance) == true) { MessageBox.Show("成功"); charg ChargForm = (charg)this.Owner; ChargForm.SourceBind(RowIndex); ChargForm.SettingTime(); } else { MessageBox.Show("不成功"); } } else { if (flBalance <= 0) { MessageBox.Show("余额剩余为 0" + "元,请及时充值"); } else { MessageBox.Show("余额剩余不到 " + flBalance + "元,请及时充值"); if (Land.UpdataSQL_Land(RowIndex + 1, strNumber, NameText.Text.ToString(), IDText.Text.ToString(), flBalance) == true) { MessageBox.Show("成功"); charg ChargForm = (charg)this.Owner; ChargForm.SourceBind(RowIndex); ChargForm.SettingTime(); } else { MessageBox.Show("不成功"); } } } }
private void RefreshTimer_Tick(object sender, EventArgs e) { BAL.DP_Form Getdata = new BAL.DP_Form(); Getdata.UPdataSQL_Timer(); int RowIndex = GridView.CurrentRow.Index; this.SourceBind(RowIndex); SettingTime(); }
public charg() { InitializeComponent(); timer1.Start(); RefreshTimer.Start(); //GridSetting(); BAL.DP_Form Getdata = new BAL.DP_Form(); Getdata.UPdataSQL_Timer(); SourceBind(0); SettingTime(); }
public void SourceBind(int RowIndex) { BAL.DP_Form Getdata = new BAL.DP_Form(); GridView.DataSource = Getdata.GetDataSet().Tables[0].DefaultView; //不允许用户点击列名自动排序 for (int Intcount = 0; Intcount < GridView.Columns.Count; Intcount++) { GridView.Columns[Intcount].SortMode = DataGridViewColumnSortMode.NotSortable; } GridView.ClearSelection(); GridView.Rows[RowIndex].Selected = true; GridView.CurrentCell = GridView.Rows[RowIndex].Cells[1]; GridView.CurrentRow.Selected = true; }
private void 机ToolStripMenuItem_Click(object sender, EventArgs e) { BAL.DP_Form UpdateSQL = new BAL.DP_Form(); int RowIndex = GridView.CurrentRow.Index; if (UpdateSQL.UpdataSQL_LogOut(RowIndex + 1) == true) { MessageBox.Show("下机成功"); } else { MessageBox.Show("下机失败"); } //重新刷新Grid this.SourceBind(RowIndex); this.SettingTime(); }