private void btnCategoryAdd_Click(object sender, EventArgs e) { //Getting data from UI categoryBLL.title = txtBoxCategoryTitle.Text; categoryBLL.description = txtBoxCategoryDescription.Text; categoryBLL.added_date = DateTime.Now; string logged_in_user = fLogin.logged_in; userBLL user = userDAl.GetIDFromUsername(logged_in_user); categoryBLL.added_by = user.username; //Inserting data into database bool success = categoryDAL.Insert(categoryBLL); //If data is succesfully insertted then the value of sucess will be true if (success == true) { //Data successfully inserted MessageBox.Show("Danh mục được thêm vào thành công"); clear(); } else { //Failed MessageBox.Show("Thêm danh mục thất bại"); } //refreshing data grid view DataTable dataTable = categoryDAL.Select(); dgvCategory.DataSource = dataTable; }
private void btnAdd_Click(object sender, EventArgs e) { //get the values from product form p.name = txtName.Text; p.category = cmbCategory.Text; p.Sub_Category = cmbSubCategory.Text; p.description = txtDescription.Text; p.rate = decimal.Parse(txtRate.Text); p.qty = 0; p.added_date = DateTime.Now; //getting id in added by field string loggedUser = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUser); //passing the idof logged in user in added by field p.added_by = usr.id; //creating boolean method to insert data into database bool success = pdal.Insert(p); if (success == true) { MessageBox.Show("Product Added Successfully."); Clear(); //refresh data grid view DataTable dt = pdal.Select(); dgvProducts.DataSource = dt; } else { MessageBox.Show("Failed to Add New Product."); } }
private void btnAdd_Click(object sender, EventArgs e) { //Get All the Values from Product Form p.name = txtName.Text; p.category = cmbCategory.Text; p.description = txtDescription.Text; p.rate = decimal.Parse(txtRate.Text); p.qty = 0; p.added_date = DateTime.Now; //Getting username of logged in user String loggedUsr = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUsr); p.added_by = usr.id; //Create Boolean variable to check if the product is added successfully or not bool success = pdal.Insert(p); //if the product is added successfully then the value of success will be true else it will be false if (success == true) { //Product Inserted Successfully MessageBox.Show("Product Added Successfully"); //Calling the Clear Method Clear(); //Refreshing DAta Grid View DataTable dt = pdal.Select(); dgvProducts.DataSource = dt; } else { //Failed to Add New product MessageBox.Show("Failed to Add New Product"); } }
private void btn_add_Click(object sender, EventArgs e) { string loggeddUsr = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggeddUsr); dc.type = cmbType.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; dc.added_by = usr.id; bool success = dcDal.Insert(dc); if (success) { Clear(); DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { MessageBox.Show("Failed to insert new dealer/customer"); } }
private void btnADD_Click(object sender, EventArgs e) { //Get the values from Categroy Form c.title = txtTitle.Text; c.description = txtDescription.Text; c.added_date = DateTime.Now; //Getting ID in Added by field string loggedUser = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUser); //Passign the id of Logged in User in added by field c.added_by = usr.id; //Creating Boolean Method To insert data into database bool success = dal.Insert(c); //If the category is inserted successfully then the value of the success will be true else it will be false if (success == true) { //NewCAtegory Inserted Successfully MessageBox.Show("New Category Inserted Successfully."); Clear(); //Refresh Data Grid View DataTable dt = dal.Select(); dgvCategories.DataSource = dt; } else { //FAiled to Insert New Category MessageBox.Show("Failed to Insert New CAtegory."); } }
private void btnAdd_Click(object sender, EventArgs e) { //Get the Values from Form dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; //Getting the ID to Logged in user and passign its value in dealer or cutomer module string loggedUsr = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggedUsr); dc.added_by = usr.id; //Creating boolean variable to check whether the dealer or cutomer is added or not bool success = dcDal.Insert(dc); if (success == true) { //Dealer or Cutomer inserted successfully MessageBox.Show("Dealer or Customer Added Successfully"); Clear(); //Refresh Data Grid View DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { //failed to insert dealer or customer } }
private void btnAdd_Click(object sender, EventArgs e) { //get the values from form dc.type = cmbType.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; //Getting ID in Added by field string loggedUser = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggedUser); //passing the id of logged in user in added by field dc.added_by = usr.id; //Creating Boolean Method To insert data into database bool success = dcDal.Insert(dc); if (success == true) { //new category inserted successfull MessageBox.Show("Dealer or Customer Added Sucessfully."); Clear(); //Refresh Data grid view DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { //failed to insert MessageBox.Show("Dealer or Customer Failed ."); } }
private void btnAdd_Click(object sender, EventArgs e) { //get the values form category form c.title = txtTitle.Text; c.description = txtDescription.Text; c.added_date = DateTime.Now; //Getting ID in Added by field string loggedUser = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUser); //passing the id of logged in user in added by field c.added_by = usr.id; //Creating Boolean Method To insert data into database bool success = dal.Insert(c); if (success == true) { //new category inserted successfull MessageBox.Show("New Category Inserted successful."); Clear(); //Refresh Data grid view DataTable dt = dal.Select(); dgvCategories.DataSource = dt; } else { //failed to insert MessageBox.Show("New category Inserted Failed."); } }
private void btnADD_Click(object sender, EventArgs e) { //รับค่าจากตาราง Categories c.title = txtTitle.Text; c.description = txtDescription.Text; c.added_date = DateTime.Now; //iy[ ID ในช่อง Added by string loggedUser = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUser); //ส่งค่า id ของผู้ใช้ที่ล็อกอินในช่อง added by c.added_by = usr.id; //สร้าง Boolean เพื่อแทรกข้อมูลไปสู้ดาต้าเบส bool success = dal.Insert(c); //หากแทรก Categories สำเร็จแล้ว ค่าของ Success จะเป็นจริง if (success == true) { //ทำการแทรกข้อมูลใหม่ลงใน categories แล้ว MessageBox.Show("ได้ทำการเพิ่ม Category ใหม่ เรียบร้อยแล้ว"); Clear(); //ทำการรีเฟรชข้อมูลให้ใหม่ DataTable dt = dal.Select(); dgvCategories.DataSource = dt; } else { //เมื่อไม่สามารถแทรกข้อมูลลงไปใน categories ได้ MessageBox.Show("ไม่สามารถทำการเพิ่ม Category ใหม่ได้! กรุณาลองอีกครั้ง"); } }
private void btnAdd_Click(object sender, EventArgs e) { p.name = txtName.Text; p.category = cmbCategory.Text; p.description = txtDescription.Text; p.rate = decimal.Parse(txtRate.Text); p.qty = 0; p.added_date = DateTime.Now; String loggedUsr = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUsr); p.added_by = usr.id; bool success = pdal.Insert(p); if (success == true) { MessageBox.Show("ทำการเพิ่มสินค้าเรียบร้อยแล้ว"); Clear(); DataTable dt = pdal.Select(); dgvProducts.DataSource = dt; } else { MessageBox.Show("ไม่สามารถเพิ่มสินค้าได้! กรุณาลองใหม่อีกครั้ง"); } }
private void btnAdd_Click(object sender, EventArgs e) { //get the values from the UI DLR Cstmr dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; //getting the id in usr and passing its value in dlr custmr module string loggedUser = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggedUser); dc.added_by = usr.id; //creating boolean variable to check wheather the dealer or customer is added or not bool isSuccess = dcdal.Insert(dc); if (isSuccess == true) { //Dealer or customer value inserted successfully MessageBox.Show("Dealer or Customer Added Successfully"); Clear(); //To refresh datagridviewS DataTable dt = dcdal.Select(); dgvDeaCust.DataSource = dt; } else { //Failed to Insert MessageBox.Show("Failed to Add Dealer or Customer"); } }
private void btnAdd_Click(object sender, EventArgs e) { //Get the values from the category form c.title = txtTitle.Text; c.description = txtDescription.Text; c.added_date = DateTime.Now; // Getting ID in Added by field string loggedUser = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUser); // passing the id of loggedin user in added by field c.added_by = usr.id; //creating Boolean Method to insert data to database bool success = dal.Insert(c); // if the category is inserted successfully then the value of success will be true ,false otherwise if (success == true) { //newCategory inserted successfully MessageBox.Show("New category inserted successfully."); clear(); // refresh data grid view DataTable dt = dal.Select(); dgvCategories.DataSource = dt; } else { // failed to insert new category MessageBox.Show("Failed to Insert new category"); } }
private void btn_add_Click(object sender, EventArgs e) { string loggedUsr = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUsr); p.name = txtName.Text; p.category = cmbCategory.Text; p.description = txtDecription.Text; p.rate = decimal.Parse(txtRate.Text); p.qty = 0; p.added_date = DateTime.Now; p.added_by = usr.id; bool success = pdal.Insert(p); if (success) { clear(); DataTable dt = pdal.Select(); dgvProducts.DataSource = dt; } else { MessageBox.Show("Failed to add new product."); } }
private void button1_Click(object sender, EventArgs e) { //Getting all value form form dc.type = cmbType.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; //Getting the Id of the logged in User string loggedUser = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUser); dc.added_by = usr.id; //creating a boolean variable to check if desler and customer is added or not bool success = dcdal.Insert(dc); if (success == true) { //dealer or customer Added successfull MessageBox.Show("Dealer or Customer added successfully"); Clear(); //Refreshing the Data Grid view DataTable dt = dcdal.select(); dgvDeaCust.DataSource = dt; } else { //Failed to add Dealer or customer MessageBox.Show("Failed to add Dealer or Customer"); } }
private void btnAdd_Click(object sender, EventArgs e) { c.title = txtTitle.Text; c.description = txtDescription.Text; c.added_date = DateTime.Now; String loggedInUser = Login.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedInUser); c.added_by = usr.id; bool success = dal.Insert(c); if (success == true) { MessageBox.Show("New Category Inserted Successfully."); Clear(); DataTable dt = dal.Select(); dgvCategories.DataSource = dt; } else { MessageBox.Show("Failed to Insert new Category!!"); } }
private void btnADD_Click(object sender, EventArgs e) { //get the values from category form c.Category = txtCategory.Text; c.Sub_Category = txtSubCategory.Text; c.description = txtDescription.Text; c.added_date = DateTime.Now; //getting id in added by field string loggedUser = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUser); //passing the idof logged in user in added by field c.added_by = usr.id; //creating boolean method to insert data into database bool success = dal.Insert(c); if (success == true) { MessageBox.Show("New Category Inserted Successfully."); Clear(); //refresh data grid view DataTable dt = dal.Select(); dgvCategories.DataSource = dt; } else { MessageBox.Show("Failed to Inserted New Category."); } }
private void btnAdd_Click(object sender, EventArgs e) { //get the values from form dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; //getting the ID of logged in user and passing its value to Dealer or Customer module string loggedUsr = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUsr); dc.added_by = usr.id; //Creating a Boolean Variable to check the dealer or customer is added or not bool success = dcDal.INSERT(dc); if (success == true) { MessageBox.Show("Dealer or Customer Added Successfully."); Clear(); //Refresh Data Grid View DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { MessageBox.Show("Failed to Add Dealer or Customer."); } error(); }
} // This Eevent is for My Picture Box private void btnAdd_Click(object sender, EventArgs e) { //Get the Values from Category Form c.title = txtTitle.Text; c.description = txtDescription.Text; c.added_date = DateTime.Now; //Getting ID in Added by field string loggedUser = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUser); //PAssing the id of logged in User in added by field c.added_by = usr.id; //Creating Boolean Method to Insert data into database bool success = dal.Insert(c); //If the value is inserted sucessfully then the value of success will be true else value will be false if (success == true) { //New Categories Inserted Sucessfully MessageBox.Show("New Category Inserted Sucessfully"); Clear(); // this clear() clears all thae data after it is inserted sucessfully //Refresh the Data Grid View after inserted sucessfully -------------Acually it is not refreshed but after inserting it agains shows data grid view from begin or loads data grid view again which makes us feel like it is refreshed--------- DataTable dt = dal.Select(); dgvCategories.DataSource = dt; } else { //Failed to Insert New Category MessageBox.Show("Failed to Insert to Add New Category"); } } // This Event os for my Add Button
private void btnAdd_Click(object sender, EventArgs e) { dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; string loggedUsr = frmLogin.loggedIn; userBLL usr = uDAL.GetIDFromUsername(loggedUsr); dc.added_by = usr.id; bool success = dcDal.Insert(dc); if (success == true) { MessageBox.Show("Dealer or Customer Added Successfully"); Clear(); DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { } }
private void btnAdd_Click(object sender, EventArgs e) { //Getting all the value from products form p.name = txtName.Text; p.category = cmbCategory.Text; p.description = txtDescription.Text; p.rate = decimal.Parse(txtRate.Text); p.qty = 0; p.added_date = DateTime.Now; //Getting the Usernae of logged in user string loggeduser = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggeduser); p.added_by = usr.id; //Create a boolean variable to check if the products is added successfully or NOT bool success = pdal.Insert(p); //If the products is added successfully the value of success will be true else it will be false. if (success == true) { //products added successfully MessageBox.Show("Products added successfully"); //Calling the Clear Method Clear(); //Refreshing the Data Grid view DataTable dt = pdal.select(); dgvProducts.DataSource = dt; } else { //Fail to Add products MessageBox.Show("Fail to add new product try again"); } }
private void btnAdd_Click(object sender, EventArgs e) { //get the Values FROM CATEGORY from catbll.title = txtTitle.Text; catbll.description = txtDescription.Text; catbll.addedDate = DateTime.Now; //Getting id in the added by field string LoggedUser = frmLogin.LoggedInUserName; UserBll usr = userdal.GetIDFromUsername(LoggedUser); catbll.added_by = usr.id; bool success = catdal.InsertCategory(catbll); if (success == true) { MessageBox.Show("Adding Category SUCCESSFULLY"); Clear(); // Refresh The DataGRID vieww DataTable dt = catdal.SelectCategory(); dataGridView1.DataSource = dt; } else { MessageBox.Show("Failed!!!! ADDING Category"); } }
private void buttonCadastrar_Click(object sender, EventArgs e) { p.name = txtProductName.Text; p.category = cmbCategoria.Text; p.description = txtDescricaoProducts.Text; p.rate = decimal.Parse(txtValorProducts.Text); p.qty = 0; p.added_date = DateTime.Now; string loggedUsr = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUsr); p.added_by = usr.id; bool Success = pdal.Insert(p); if (Success == true) { MessageBox.Show("PRODUTO CADASTRADO COM SUCESSO!"); Limpar(); DataTable dt = pdal.Select(); dgvProducts.DataSource = dt; } else { MessageBox.Show("NÃO FOI POSSÍVEL CADASTRAR PRODUTO!"); } }
private void btnAdd_Click(object sender, EventArgs e) { p.name = txtName.Text; p.category = cmbCategory.Text; p.description = txtDescription.Text; p.rate = decimal.Parse(txtRate.Text); p.quantity = 0; p.added_date = DateTime.Now; String loggedInUser = Login.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedInUser); p.added_by = usr.id; bool success = pdal.Insert(p); if (success == true) { MessageBox.Show("New Product Inserted Successfully."); Clear(); DataTable dt = pdal.Select(); dgvProducts.DataSource = dt; } else { MessageBox.Show("Failed to Insert new Product!!"); } }
private void btnAdd_Click(object sender, EventArgs e) { // get the values from form dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; // getting the loggedin user id and passing its value to deal or customer module string loggedUsr = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggedUsr); dc.added_by = usr.id; // boolean variable to check if the dealer/customer is added or not bool success = dcDal.Insert(dc); if (success == true) { //dealer/customer is inserted successfully MessageBox.Show("Dealer or customer added Successfully"); Clear(); // refresh data grid view DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { //Failed to insert dealer /customer MessageBox.Show(""); } }
private void btnAdd_Click(object sender, EventArgs e) { productBLL.name = txtBoxProductName.Text; productBLL.category = cmbProductCategory.Text; productBLL.description = txtBoxDescription.Text; productBLL.size = cmbProductSize.Text; productBLL.rate = Convert.ToInt32(txtBoxProductRate.Text); productBLL.qty = 0; productBLL.added_date = DateTime.Now; String logged_in_user = fLogin.logged_in; userBLL user = userDAL.GetIDFromUsername(logged_in_user); productBLL.added_by = user.username; bool success = productDAL.Insert(productBLL); if (success == true) { //Data successfully inserted MessageBox.Show("Món được thêm vào thành công"); clear(); } else { //Failed MessageBox.Show("Không thể thêm vào món này"); } //refreshing data grid view DataTable dataTable = productDAL.Select(); dgvProduct.DataSource = dataTable; }
private void btnAdd_Click(object sender, EventArgs e) { //Get All values from Product Form proBll.name = txtName.Text; proBll.category = cmbCategory.Text; proBll.description = txtDescription.Text; proBll.rate = decimal.Parse(txtRate.Text); proBll.qty = 0; proBll.added_date = DateTime.Now; //Getting hte UserName of logged in user string loggedUsr = frmLogin.LoggedInUserName; UserBll usrBll = useDal.GetIDFromUsername(loggedUsr); proBll.added_by = usrBll.id; bool success = proDal.InsertProduct(proBll); if (success == true) { MessageBox.Show("Adding Product SUCCESSFULLY"); Clear(); // Refresh The DataGRID vieww DataTable dt = proDal.SelectProduct(); dGVProducts.DataSource = dt; } else { MessageBox.Show("Failed!!!! ADDING Product"); } }
private void btnAdd_Click(object sender, EventArgs e) { //Getting data from UI customerBLL.name = txtBoxCustomerName.Text; customerBLL.email = txtBoxCustomerEmail.Text; customerBLL.contact = txtBoxCustomerContact.Text; customerBLL.address = txtBoxCustomerAddress.Text; customerBLL.added_date = DateTime.Now; string logged_in_user = fLogin.logged_in; userBLL user = userDAL.GetIDFromUsername(logged_in_user); customerBLL.added_by = user.username; //Inserting data into database bool success = customerDAL.Insert(customerBLL); //If data is succesfully insertted then the value of sucess will be true if (success == true) { //Data successfully inserted MessageBox.Show("Khách hàng được thêm vào thành công."); clear(); } else { //Failed MessageBox.Show("Không thể thêm khách hàng."); } //refreshing data grid view DataTable dataTable = customerDAL.Select(); dgvCustomer.DataSource = dataTable; }
private void btnAdd_Click(object sender, EventArgs e) { //geting value form Category form c.title = txtTitle.Text; c.description = txtDescription.Text; c.added_date = DateTime.Now; // Getting ID in added_by field; string loggedUser = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUser); //passing id of logged in user added by field c.adde_by = usr.id; //creating a boolean method to insert data into database. bool success = dal.Insert(c); //If the category is Inserted SuccessFully the the value of success will be true else it will be false; if (success == true) { //New category inserted Successfully MessageBox.Show("New category Inserted Successfully."); Clear(); //Refreshing the Data Grid view DataTable dt = dal.select(); dgvCategories.DataSource = dt; } else { //Failed to Insert new Category MessageBox.Show("Failed to Insert New category"); Clear(); } }
private void btnAdd_Click(object sender, EventArgs e) { dc.type = cmbType.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; //getting id in added by field string loggedUser = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggedUser); //passing the id of logged in user in added by field dc.added_by = usr.id; //creating boolean method to insert data into database bool success = dcdal.Insert(dc); if (success == true) { MessageBox.Show("Dealer or Customer Added Successfully."); Clear(); //refresh data grid view DataTable dt = dcdal.Select(); dgvDeaCust.DataSource = dt; } else { MessageBox.Show("Failed to Add New Dealer or customer."); } }
private void buttonCadastrar_Click(object sender, EventArgs e) { //pegando o valor dos campos dor form e enviando para o bd c.titlie = txtTitulo.Text; c.description = txtdescricao.Text; c.added_date = DateTime.Now; //pegando o valor do id do usuario logado string loggedUser = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUser); c.added_by = usr.id; bool success = dal.Insert(c); //inserindo os dados no bd if (success == true) { MessageBox.Show("PRODUTO CADASTRADO COM SUCESSO!"); Limpar(); //REALIZA ATUALIZAÇÃO NA TABELA AO INSERIR UM NOVO DADO DataTable dt = dal.Select(); dgvCategoria.DataSource = dt; } else { MessageBox.Show("NÃO FOI POSSÍVEL CADASTRAR PRODUTO!"); } }