private void btnUpdate_Click(object sender, EventArgs e) { db = new db_MiletecDataContext(); db.sp_update_stock_price(double.Parse(txtPrice.Text), txtProductID.Text); db.SubmitChanges(); dgvviewstocks.DataSource = clsrepository.dissock(); }
private void btnSave_Click(object sender, EventArgs e) { //Saves into the database db = new db_MiletecDataContext(); if (dgvProductDetails.SelectedColumns.ToString() != null && txtcusID.Text != "") { db.sp_update_DeliveryCustomer(txtDeliveryNo.Text, DateTime.Parse(txtdatetodeliver.Text), txttimetodeliver.Text); db.SubmitChanges(); MessageBox.Show("Successfuly saved!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); if (dgvProductDetails.Rows.Count == 0) { db.sp_update_CustomerDeilveryStatus(txttransactionid.Text, "Pending..."); dgvDeliverditems.Rows.Clear(); txttransactionid.Text = "Transaction ID"; txtDateOrdered.Text = "Date Ordered"; txtcusID.Text = "Customer ID"; txtPreparedBy.Text = "Prepared By"; txtdatetodeliver.Text = "Date to Deliver"; GendelID(txtDeliveryNo); } } else { MessageBox.Show("You must fill up everything!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnsave_Click(object sender, EventArgs e) { string user; //if all fields are filled if (txtcustomername.Text != "Customer Name" && txtaddress.Text != "Address" && txtcontactno1.Text != "Contactno.1" && txtcontactno2.Text != "Contactno.1") { db = new db_MiletecDataContext(); user = Form1.UserID.ToString(); db.sp_insert_customerdetails(user, txtcustomerid.Text, txtcustomername.Text, txtaddress.Text, txtcontactno1.Text, txtcontactno2.Text); db.SubmitChanges(); MessageBox.Show("Save Successfuly!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); dgvcustomerdetails.DataSource = clsrepository.customer(); txtcustomername.Text = "Customer Name"; txtaddress.Text = "Address"; txtcontactno1.Text = "Contactno.1"; txtcontactno2.Text = "Contactno.2"; GencusID(txtcustomerid); } //if some fields are empty else { MessageBox.Show("Please fill up everything!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnadd_Click(object sender, EventArgs e) { db = new db_MiletecDataContext(); if (txtQuantityOrder.Text != "Quantity Order" && txtShowSupplier.Text != "Supplier ID" && cmbProductID.Text != "" && txtProductName.Text != "Product Name") { if (int.Parse(txtQuantityOrder.Text) <= 0) { MessageBox.Show("fill up quantity first!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Successfully Added!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); dgvOrderDetails.Rows.Add(cmbProductID.Text, txtProductName.Text, int.Parse(txtQuantityOrder.Text)); db.sp_OrderDetails(txtOrderID.Text, cmbProductID.Text, txtProductName.Text, int.Parse(txtQuantityOrder.Text), "To Deliver"); db.sp_Products(txtSupplierID.Text, cmbProductID.Text, txtProductName.Text, int.Parse(txtQuantityOrder.Text)); db.SubmitChanges(); cmbProductID.SelectedItem = null; lblproductid.Text = "Product ID"; txtProductName.Text = "Product Name"; txtQuantityOrder.Text = "Quantity Order"; btnPurchase.Enabled = true; } } else { MessageBox.Show("Please fill up everything!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSave_Click(object sender, EventArgs e) { string user; if (txtSupplierName.Text != "" && txtAddress.Text != "" && txtContact1.Text != "" && txtContact2.Text != "" && txtContactPerson.Text != "") { db = new db_MiletecDataContext(); user = Form1.UserID.ToString(); db.sp_SupplierDetails(user, txtSupplierID.Text, txtSupplierName.Text, txtAddress.Text, int.Parse(txtContact1.Text), int.Parse(txtContact2.Text), txtContactPerson.Text); db.SubmitChanges(); MessageBox.Show("Successfully Save!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); dgvsupplierdetails.DataSource = clsrepository.displaysupdetails(); if (dgvsupplierdetails.Rows.Count == 0) { btnProceed.Enabled = false; } else { btnProceed.Enabled = true; } } else { MessageBox.Show("Please fill up everything first!!"); } }
private void btnSave_Click(object sender, EventArgs e) { string user; if (txtSupplierName.Text != "Supplier Name" && txtAddress.Text != "Address" && txtContact1.Text != "Contact No.1" && txtContact2.Text != "Contact No.2" && txtContactPerson.Text != "Contact Person") { db = new db_MiletecDataContext(); user = Form1.UserID.ToString(); db.sp_SupplierDetails(user, txtSupplierID.Text, txtSupplierName.Text, txtAddress.Text, int.Parse(txtContact1.Text), int.Parse(txtContact2.Text), txtContactPerson.Text); db.SubmitChanges(); MessageBox.Show("Successfully Save!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); GenID(txtSupplierID); Display(); txtSupplierName.Text = "Supplier Name"; txtAddress.Text = "Address"; txtContact1.Text = "Contact No.1"; txtContact2.Text = "Contact No.2"; txtContactPerson.Text = "Contact Person"; } else { MessageBox.Show("Please fill up everything first.", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnreset_Click(object sender, EventArgs e) { db = new db_MiletecDataContext(); if (txtpasswordreset.Text != "Password") { db.sp_resetUserPass(txtusernamereset.Text); db.SubmitChanges(); MessageBox.Show("Reset Succesful!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnSubmit_Click(object sender, EventArgs e) { int counter = 0; db = new db_MiletecDataContext(); if (txtUsername.Text != "Username" && txtNewPassword.Text != "" && txtConfirm.Text != "" && cmbSecretQuestion.Text != null && txtSecretAnswer.Text != "Secret_Answer") { if (counter == 0) { var result = (from row in db.tblUsers where row.Username == txtUsername.Text.ToString() select row).ToList(); if (result.Count() != 0) { MessageBox.Show("Username already existed!!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else if (txtConfirm.Text != txtNewPassword.Text) { MessageBox.Show("Password do not match!!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { db.sp_Update_User(Form1.UserID.ToString(), txtUsername.Text, txtNewPassword.Text, cmbSecretQuestion.Text, txtSecretAnswer.Text); db.SubmitChanges(); MessageBox.Show("Succesfuly Updated!"); this.Close(); if (Form1.Status.ToString() == "Administrator") { wndw_Main_Admin admin = new wndw_Main_Admin(); admin.Show(); } else { wndw_Main_Staff staff = new wndw_Main_Staff(); staff.Show(); } } } } else { MessageBox.Show("Please fill up everything!!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btnedit_Click(object sender, EventArgs e) { //edit customer details db = new db_MiletecDataContext(); //checked if all fields are filled during the process if (txtcustomername.Text != "Customer Name" && txtaddress.Text != "Address" && txtcontactno1.Text != "Contactno.1" && txtcontactno2.Text != "Contactno.2") { db.sp_updatecustomerdetails(txtcustomerid.Text, txtcustomername.Text, txtaddress.Text, txtcontactno1.Text, txtcontactno2.Text); db.SubmitChanges(); dgvcustomerdetails.DataSource = clsrepository.customer(); MessageBox.Show("Successfuly update!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtcustomername.Text = "Customer Name"; txtaddress.Text = "Address"; txtcontactno1.Text = "Contactno.1"; txtcontactno2.Text = "Contactno.2"; btnsave.Enabled = true; GencusID(txtcustomerid); } //if some fields are empty, do not allow the user to update the custommer upadte else { MessageBox.Show("please choose what you want to update!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSave_Click(object sender, EventArgs e) { db = new db_MiletecDataContext(); if (lblreceivedby.Text != "." && txtDeliveredBy.Text != "Delivered By") { db.sp_update_tblDeliverySupplier(txtDeliveryNo.Text, txtDeliveredBy.Text); //db.sp_DeliverySupplier(txtDeliveryNo.Text, txtOrderID.Text, DateTime.Now, txtPreparedBy.Text, txtDeliveredBy.Text); db.SubmitChanges(); dgvDeliverditems.Rows.Clear(); txtDeliveredBy.Clear(); MessageBox.Show("Successfully Save!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtOrderID.Text = "Order No."; txtDateOrdered.Text = "Date Ordered"; txtPreparedBy.Text = "Prepared By"; GenDelID(txtDeliveryNo); if (dgvProductDetails.Rows.Count == 0) { db.sp_update_tblOrders(txtOrderID.Text, "Delivered"); } } else { MessageBox.Show("Please choose you want to deliver!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSave_Click(object sender, EventArgs e) { db = new db_MiletecDataContext(); //staff registration if (cmbUser.Text == "Staff") { if (txtLastName.Text != string.Empty && txtFirstName.Text != string.Empty && txtMiddleName.Text != string.Empty && txtUserName.Text != string.Empty && txtPassword.Text != string.Empty) { if (count == 0) { if (txtFirstName.Text == "Firstname" && txtLastName.Text == "Lastname" && txtMiddleName.Text == "Middle Name") { MessageBox.Show("Please fill up everything!!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else if (txtUserName.Text == "Username" || txtPassword.Text == "Password") { MessageBox.Show("Generate Username and Password first!!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { db.sp_insert_User(txtUserStaffID.Text, txtLastName.Text, txtFirstName.Text, txtMiddleName.Text, txtUserName.Text, txtPassword.Text, "Active", null, null, cmbUser.Text); db.SubmitChanges(); MessageBox.Show("Registered Successfully!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtFirstName.Text = "Firstname"; txtLastName.Text = "Lastname"; txtMiddleName.Text = "Middle Name"; txtUserName.Text = "Username"; txtPassword.Text = "Password"; } } } else { MessageBox.Show("Please fill up everything!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (cmbUser.Text == "Administrator") { db = new db_MiletecDataContext(); if (count == 0) { if (txtFirstName.Text == "Firstname" && txtLastName.Text == "Lastname" && txtMiddleName.Text == "Middle Name") { MessageBox.Show("Please fill up everything!!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else if (txtUserName.Text == "Username" || txtPassword.Text == "Password") { MessageBox.Show("Generate Username and Password first!!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { db.sp_insert_User(txtUserStaffID.Text, txtLastName.Text, txtFirstName.Text, txtMiddleName.Text, txtUserName.Text, txtPassword.Text, "Active", null, null, cmbUser.Text); db.SubmitChanges(); MessageBox.Show("Registered Successfully!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtFirstName.Text = "Firstname"; txtLastName.Text = "Lastname"; txtMiddleName.Text = "Middle Name"; txtUserName.Text = "Username"; txtPassword.Text = "Password"; } } } else { MessageBox.Show("Please Fill up everything!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } GenerateUserID(txtUserStaffID); }