Пример #1
0
        private void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
        {
            List <int> ClientData;

            ClientData = FundStateManager.getFundState();
            if (ClientData == null || ClientData.Count == 0)
            {
                for (int i = 0; i < dataGridView1.RowCount; i++)
                {
                    dataGridView1.Rows[i].Cells["CheckFund"].Value = true;
                }
            }
            else
            {
                int i = 0;
                foreach (DataRow row in DatabaseHandler.getClients().Rows)
                {
                    if (ClientData.Contains(Convert.ToInt32(row[0])))
                    {
                        dataGridView1.Rows[i].Cells["CheckFund"].Value = true;
                    }
                    i++;
                }
            }
        }
Пример #2
0
        private void btn_saveFunds_click(object sender, EventArgs e)
        {
            List <int>    fundState         = new List <int>();
            List <Int32>  ClientToBeWatched = new List <Int32>();
            StringBuilder reportTypreIDs    = new StringBuilder("(");

            reportTypreIDs = reportTypreIDs.Append(comboBoxReportType.SelectedValue.ToString());
            reportTypreIDs = reportTypreIDs.Append(")");

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                if (Convert.ToBoolean(dataGridView1.Rows[i].Cells["CheckFund"].Value))
                {
                    ClientToBeWatched.Add(Convert.ToInt32(dataGridView1.Rows[i].Cells["ClientId"].Value));
                    fundState.Add(Convert.ToInt32(dataGridView1.Rows[i].Cells["ClientId"].Value));
                }
            }



            // get all reports of above selected clients;
            DatabaseHandler.getClientReports(ClientToBeWatched, reportTypreIDs.ToString());

            // Saving Fund class State to xml file
            if (FundStateManager.saveFundState(fundState))
            {
                showResultStatus.Text = "Funds Saved.";
            }
            else
            {
                showResultStatus.Text = "Funds saving failed";
            }
            btn_saveFunds.Enabled    = false;
            dataGridView1.ReadOnly   = true;
            btn_Selecte_All.Enabled  = false;
            btn_Unselect_All.Enabled = false;
        }