private void AddItemUsrCtrl_Load(object sender, EventArgs e) { CategoryDAO categoryDAORef = new CategoryDAOImpl(); List <Category> categoryRef = categoryDAORef.getcategoryList(null); foreach (Category c in categoryRef) { categoryTxt.Items.Add(c.categoryName); } }
private void submitBtn_Click(object sender, EventArgs e) { // string constStr= ConfigurationManager.ConnectionStrings["connectionstr"].ToString(); if (categorynameTxt.Text == "" || categorynDescTxt.Text == "") { MessageBox.Show("pls enter all the values", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { CategoryDAO categoryDAORef = new CategoryDAOImpl(); Category categoryRef = new Category(); categoryRef.categoryName = categorynameTxt.Text; categoryRef.categoryDesc = categorynDescTxt.Text; categoryDAORef.insertCatelog(categoryRef); clearFields(); } }
private void searchCategorynameBtn_Click(object sender, EventArgs e) { flag = 1; Category categoryRef1 = new Category(); categoryRef1.categoryName = categorynameTxt.Text; CategoryDAO categoryDAORef = new CategoryDAOImpl(); List <Category> categoryRef = new List <Category>(); categoryRef = categoryDAORef.getcategoryList(categoryRef1); Console.WriteLine("size of List :{0}", categoryRef); /* foreach (Category catgry in categoryRef) * Console.WriteLine("category name:{0} \n category value:{1}", categoryRef.); */ dataGridViewTest.DataSource = categoryRef; // dataGridViewTest.SelectedCells[0].ReadOnly = true; }
private void dataGridViewTest_CellValueChanged(object sender, DataGridViewCellEventArgs e) { var row = dataGridViewTest.Rows[e.RowIndex]; var changedValue = (string)row.Cells[e.ColumnIndex].Value; Console.WriteLine(" *******************************Row value :{0} \n", row.Cells["categoryName"].Value); Console.WriteLine(" ^^^^^^^^^^^^^^^^^^Row value :{0} \n", Convert.ToString(row.Cells["categoryName"].Value)); Category categoryRef1 = new Category(); categoryRef1.categoryName = Convert.ToString(row.Cells["categoryName"].Value); categoryRef1.categoryDesc = changedValue; CategoryDAO categoryDAORef = new CategoryDAOImpl(); categoryDAORef.updateCategory(categoryRef1); dataGridViewTest.Update(); dataGridViewTest.Refresh(); }
private void deleteBtn_Click(object sender, EventArgs e) { int rowIndex = dataGridViewTest.CurrentCell.RowIndex; var row = dataGridViewTest.Rows[rowIndex]; var changedValue = (string)row.Cells[rowIndex].Value; Console.WriteLine("$$$$$$$$$$$$$$$$$ values:{0}", (string)row.Cells[rowIndex].Value); // dataGridViewTest.Rows.RemoveAt(rowIndex); Category categoryRef1 = new Category(); categoryRef1.categoryName = Convert.ToString(row.Cells["categoryName"].Value); categoryRef1.categoryDesc = changedValue; CategoryDAO categoryDAORef = new CategoryDAOImpl(); categoryDAORef.deleteCategory(categoryRef1); dataGridViewTest.Update(); dataGridViewTest.Refresh(); }
private void PlaceOrderUsrCtrl_Load(object sender, EventArgs e) { loginPage loginPageRef = new loginPage(); username = loginPageRef.username; mobileNo = loginPageRef.mobileNo; EmailId = loginPageRef.EmailId; CategoryDAO categoryDAORef = new CategoryDAOImpl(); List <Category> categoryRef = categoryDAORef.getcategoryList(null); foreach (Category c in categoryRef) { categorynameCmb.Items.Add(c.categoryName); } //OrderCredentials orderCredentialsRef = new OrderCredentials(billNo++, dateTime); //OrderCredentialsDAO orderCrDAORef = new OrderCredentialsDAOImpl(); //orderCrDAORef.insertOrderCredentials(orderCredentialsRef); }
private void testBtn_Click(object sender, EventArgs e) { flag = 1; CategoryDAO categoryDAORef = new CategoryDAOImpl(); List <Category> categoryRef = new List <Category>(); categoryRef = categoryDAORef.getcategoryList(null); Console.WriteLine("size of List :{0}", categoryRef); /* foreach (Category catgry in categoryRef) * Console.WriteLine("category name:{0} \n category value:{1}", categoryRef.); */ dataGridViewTest.DataSource = categoryRef; dataGridViewTest.SelectedCells[0].ReadOnly = true; // Console.WriteLine("selected cell :{0}", dataGridViewTest.SelectedCells[0].ReadOnly); // categoryDAORef.deleteCategory(); deleteBtn.Visible = true; }