public FirstPageForm() { InitializeComponent(); catogeryChart.Visible = false; //RateMe.ReadCategory() is defined as static class so it is easier and reuse of the code catogeryList.DataSource = RateMe.ReadCategory(); ratedata(); rateMe_Enter(); ratedDatagridview2(); }
private void rateBtn_Click(object sender, EventArgs e) { RateMe xml = new RateMe(); List <string> rate = new List <string>(); try { foreach (DataGridViewRow row in dataGridView1.Rows) { foreach (DataGridViewColumn column in dataGridView1.Columns) { if (column.Index != 0 && column.Index != 5) { bool a = Convert.ToBoolean(row.Cells[column.Index].Value); if (a) { string criteria = Convert.ToString(row.Cells[0].Value); string header = dataGridView1.Columns[column.Index].HeaderText; rate.Add(criteria); rate.Add(header); } } } } //Console.WriteLine(rate); //Checking if the xml file is present or not bool exist = File.Exists("../../../rates.xml"); if (!exist) { MessageBox.Show("No xml file"); //creating a xml file if it does not exist. xml.CreateXML(); } else { MessageBox.Show("Rating Completed, Xml file present"); } xml.updateXML(rate, now.ToString()); FirstPageForm fr = new FirstPageForm(); fr.Show(); this.Hide(); } catch { MessageBox.Show("Please rate all the criteria"); } }
private void ratedDatagridview2() { DataTable table2 = new DataTable(); table2.Columns.Add("Criteria", typeof(string)); table2.Columns.Add("Rating", typeof(int)); Dictionary <string, int> dict = RateMe.getTotal(); foreach (KeyValuePair <string, int> rate in dict) { table2.Rows.Add(rate.Key, rate.Value); } dataGridView2.DataSource = table2; }
private void catogeryAddition_Click(object sender, EventArgs e) { if (catogeryAddTxt.Text == "") { MessageBox.Show("Please add Something"); } else { CatogeryAdditionAdmin category = new CatogeryAdditionAdmin(catogeryAddTxt.Text); //RateMe.ReadCategory() is defined as static class so it is easier and reuse of the code catogeryList.DataSource = RateMe.ReadCategory(); catogeryAddTxt.Text = ""; MessageBox.Show("Success"); //ratedata(); //rateMe_Enter(); FirstPageForm fr = new FirstPageForm(); fr.Show(); this.Hide(); } }
private void reset_Click(object sender, EventArgs e) { Reset(); //RateMe.ReadCategory() is defined as static class so it is easier and reuse of the code catogeryList.DataSource = RateMe.ReadCategory(); }
private void generateReport_Click(object sender, EventArgs e) { Dictionary <string, int> dict = RateMe.getTotal(); GenerateReport.ToCSV(dict); }