コード例 #1
0
ファイル: Withdraw.cs プロジェクト: lephuocdien/HYIP
        private void button1_Click(object sender, EventArgs e)
        {
            RUNNING rn = new RUNNING();

            rn.ID = Convert.ToInt32(textBox_id.Text);
            float   hasWithdraw  = (float)_paid + float.Parse(textBox_withdraw.Text);
            decimal decimalValue = Math.Round((decimal)hasWithdraw, 2);

            rn.Withdraw = (float)decimalValue;
            int percent = (int)((hasWithdraw / _deposit) * 100);

            rn.Percent = percent;

            //
            BUS_RUNNING buss   = new BUS_RUNNING();
            int         result = buss.UpdateRUNNING(rn);

            if (result != 0)
            {
                //insert to WithdrawHistory
                WithdrawHistoryMODEL with = new WithdrawHistoryMODEL();
                with.ID           = rn.ID;
                with.WithDraw     = float.Parse(textBox_withdraw.Text);
                with.DateWithdraw = DateTime.Now.ToString();
                //
                BUS_WithdrawHistory busswith = new BUS_WithdrawHistory();
                int errorcode = busswith.InsertWithdrawHistory(with);
                if (errorcode != 0)
                {
                    MessageBox.Show("Success!");
                    this.Close();
                    _p_form.LoadData("PAYING");
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: lephuocdien/HYIP
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                if (dataGridView1.Columns[e.ColumnIndex].Name == "dailyprofit")
                {
                    int selectedrowindex = dataGridView1.SelectedCells[0].RowIndex;

                    DataGridViewRow selectedRow = dataGridView1.Rows[selectedrowindex];
                    string          Name        = selectedRow.Cells[3].Value.ToString();
                    string          ID          = selectedRow.Cells[2].Value.ToString();
                    float           paid        = float.Parse((selectedRow.Cells[9].Value.ToString()));
                    int             dep         = Convert.ToInt32(selectedRow.Cells[4].Value);
                    string          stt         = selectedRow.Cells[10].Value.ToString();
                    if (stt == "PAYING")
                    {
                        Withdraw frm = new Withdraw(this, Name, ID, paid, dep);
                        frm.ShowDialog();
                    }
                    else if (stt == "NOT JOIN")
                    {
                        MessageBox.Show("NOT JOIN");
                    }
                    else
                    {
                        MessageBox.Show("SCAM");
                    }
                }
                else if (dataGridView1.Columns[e.ColumnIndex].Name == "updatestatus")
                {
                    int selectedrowindex = dataGridView1.SelectedCells[0].RowIndex;

                    DataGridViewRow selectedRow = dataGridView1.Rows[selectedrowindex];
                    string          Name        = selectedRow.Cells[3].Value.ToString();
                    int             ID          = Convert.ToInt32(selectedRow.Cells[2].Value.ToString());
                    StatusUpdate    frm         = new StatusUpdate(this, Name, ID);
                    frm.ShowDialog();
                }
            }
            if (dataGridView1.Columns[e.ColumnIndex].Name == "TotalEarn")
            {
                //
                richTextBox1.Clear();
                String template = "DateWithdraw:{0}  Amount:{1} \n";

                BUS_WithdrawHistory buswithdrawHis = new BUS_WithdrawHistory();
                int selectedrowindex = dataGridView1.SelectedCells[0].RowIndex;

                DataGridViewRow selectedRow = dataGridView1.Rows[selectedrowindex];
                SqlDataReader   rdr         = buswithdrawHis.GetWithdrawHistory(Convert.ToInt32(selectedRow.Cells[2].Value.ToString()));

                while (rdr.Read())
                {
                    string daywi  = rdr["DayWithdraw"].ToString();
                    float  amount = float.Parse(rdr["Amount"].ToString());

                    richTextBox1.Text += String.Format(template, daywi, amount);
                }//
            }
        }