private void matDuplicateCheck() { string fName = ""; sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[CheckMtrlDup_MML] '" + metroTextBox3.Text + "'", sqlcon.con); SqlDataReader dr = cmd.ExecuteReader(); int user = 0; while (dr.Read()) { user += 1; fName = dr["MaterialName"].ToString(); } userConnect.dbOut(); if (fName.ToUpper() == metroTextBox3.Text.ToUpper()) { metroButton1.Enabled = false; DesktopAlert.Show("Material already Exist"); metroLabel6.Text = ""; } else { metroButton1.Enabled = true; } }
private void uploadwithImage() { string Con = Properties.Settings.Default.Database.ToString() + ".[dbo].Final_Sold_Goods "; string con3 = Con.Replace(" ", ""); sqlcon userConnect1 = new sqlcon(); userConnect1.dbIn(); SqlCommand soldFinishGood = new SqlCommand("[receivedGoods]", sqlcon.calc); soldFinishGood.CommandType = System.Data.CommandType.StoredProcedure; soldFinishGood.Parameters.AddWithValue("@userID", globalVar.x.ToString()); soldFinishGood.Parameters.AddWithValue("@emp2", globalVar.name.ToString()); soldFinishGood.Parameters.AddWithValue("@emp", metroLabel13.Text); soldFinishGood.Parameters.AddWithValue("@fGcode", metroLabel6.Text); soldFinishGood.ExecuteNonQuery(); userConnect1.dbOut(); sqlcon userConnect = new sqlcon(); userConnect.dbIn(); //SqlCommand cmd = new SqlCommand("[userIDdetect] '" + metroTextBox1.Text + "'", sqlcon.con); SqlCommand cmd = new SqlCommand("UPDATE " + con3.ToString() + " SET [image] = (SELECT BulkColumn FROM Openrowset( Bulk '" + imgloc.ToString() + "', Single_Blob) as img) WHERE FGCode = '" + metroLabel6.Text + "'", sqlcon.calc); SqlDataReader dr = cmd.ExecuteReader(); userConnect.dbOut(); displayReports(); slidePanel1.IsOpen = false; DesktopAlert.Show("Item has been sold"); metroTabControl1.Enabled = true; pictureBox1.Image = null; }
private void addNewMaterial() { try { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand newMat = new SqlCommand("[addItemMMML]", sqlcon.calc); newMat.CommandType = System.Data.CommandType.StoredProcedure; newMat.Parameters.AddWithValue("@matID", metroLabel6.Text); newMat.Parameters.AddWithValue("@matName", metroTextBox3.Text); newMat.Parameters.AddWithValue("@matDesc", metroTextBox4.Text); newMat.Parameters.AddWithValue("@minStock", metroTextBox5.Text); newMat.Parameters.AddWithValue("@employe", globalVar.name.ToString()); newMat.Parameters.AddWithValue("@price", metroTextBox1.Text); newMat.Parameters.AddWithValue("@userID", globalVar.x.ToString()); newMat.ExecuteNonQuery(); userConnect.dbOut(); DesktopAlert.Show("New material has been added."); Form1 updateList = new Form1(); updateList.notifDsply(); updateList.notifIcon(); metroTextBox1.Text = ""; metroTextBox3.Text = ""; metroTextBox4.Text = ""; metroTextBox5.Text = ""; metroLabel6.Text = ""; displayMaterialView(); } catch { DesktopAlert.Show("Please check your Inputs!"); } }
private void pinCheck() { int user = 0; sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[resetPasswords2] '" + metroLabel2.Text + "'", sqlcon.con); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { user += 1; globalVar.pinCode = dr["pinCode"].ToString(); } userConnect.dbOut(); if (globalVar.pinCode == metroTextBox1.Text) { slidePanel2.IsOpen = true; slidePanel1.IsOpen = false; } else { DesktopAlert.Show("PIN code does not match"); } }
public void soldFinishGood() { try { foreach (DataGridViewRow item in metroGrid2.Rows) { if (bool.Parse(item.Cells[0].Value.ToString())) { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand soldFinishGood = new SqlCommand("[materialOut]", sqlcon.calc); soldFinishGood.CommandType = System.Data.CommandType.StoredProcedure; soldFinishGood.Parameters.AddWithValue("@userID", item.Cells[5].Value.ToString()); soldFinishGood.Parameters.AddWithValue("@fGcode", item.Cells[1].Value.ToString()); soldFinishGood.Parameters.AddWithValue("@addBy", globalVar.name.ToString()); soldFinishGood.ExecuteNonQuery(); userConnect.dbOut(); metroTextBox1.Text = ""; } } } catch { return; } recentSolds(); reloadChkBox(); }
private void productExistCheck() //Check for product existence.... { string pName = ""; sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[chkFGProductsDup] '" + metroTextBox2.Text + "'", sqlcon.calc); SqlDataReader dr = cmd.ExecuteReader(); int user = 0; while (dr.Read()) { user += 1; pName = dr["productName"].ToString(); } userConnect.dbOut(); if (pName.ToUpper() == metroTextBox2.Text.ToUpper() && metroTextBox2.Text != string.Empty) { metroButton1.Enabled = false; DesktopAlert.Show("Already Exist"); } else { metroButton1.Enabled = true; } }
private void metroButton2_Click(object sender, EventArgs e) { try { foreach (DataGridViewRow item in metroGrid2.Rows) { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand material = new SqlCommand("[voidClient]", sqlcon.calc); material.CommandType = System.Data.CommandType.StoredProcedure; material.Parameters.AddWithValue("@name", item.Cells[1].Value.ToString()); if (item.Cells[0].Value.Equals("Enable")) { material.Parameters.AddWithValue("@void", "N"); } else if (item.Cells[0].Value.Equals("Disable")) { material.Parameters.AddWithValue("@void", "Y"); } material.ExecuteNonQuery(); userConnect.dbOut(); } } catch { return; } displayClients(); statusCheck(); }
private void listOfProduct() { try { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlDataAdapter da = new SqlDataAdapter("exec [productList]", sqlcon.con); DataTable dt = new DataTable(); da.Fill(dt); metroComboBox4.DataSource = dt; //metroComboBox3.DisplayMember = "ClientName"; dt.Columns.Add("ID", typeof(int)); metroComboBox4.DisplayMember = "Products"; metroComboBox4.ValueMember = "ID"; metroComboBox4.DataSource = dt; DataRow dr = dt.NewRow(); dr["Products"] = "All"; dt.Rows.InsertAt(dr, 0); metroComboBox4.SelectedIndex = 0; userConnect.dbOut(); } catch { } }
private void searchUser() //Display User details in textboxes..in slidepanel { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[findUser] '" + metroLabel12.Text + "'", sqlcon.con); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { metroTextBox11.Text = dr["FirstName"].ToString(); metroTextBox10.Text = dr["LastName"].ToString(); metroTextBox9.Text = dr["passkey"].ToString(); metroComboBox6.Text = dr["position"].ToString(); metroComboBox5.Text = dr["Gender"].ToString(); if (dr["Employeestatus"].ToString() == "Activated") { metroCheckBox1.CheckState = CheckState.Checked; } else { metroCheckBox1.CheckState = CheckState.Unchecked; } } userConnect.dbOut(); }
private void modifyAcct() { string stat = ""; if (metroCheckBox1.CheckState == CheckState.Checked) { stat = "Activated"; } else { stat = "Deactivated"; } sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand modify = new SqlCommand("modifyAcct", sqlcon.con); modify.CommandType = System.Data.CommandType.StoredProcedure; modify.Parameters.AddWithValue("@FirstName", metroTextBox11.Text); modify.Parameters.AddWithValue("@LastName", metroTextBox10.Text); modify.Parameters.AddWithValue("@passkey", metroTextBox9.Text); modify.Parameters.AddWithValue("@position", metroComboBox6.Text); modify.Parameters.AddWithValue("@Gender", metroComboBox5.Text); modify.Parameters.AddWithValue("@status", stat); modify.Parameters.AddWithValue("@userID", metroLabel12.Text); modify.ExecuteNonQuery(); userConnect.dbOut(); }
private void todayEvent() { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[todaysEvent]", sqlcon.con); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { metroLabel20.Text = "Php. " + dr["sales"].ToString(); metroLabel19.Text = "Php. " + dr["Purchases"].ToString(); metroLabel16.Text = "Php. " + dr["equals"].ToString(); } userConnect.dbOut(); sqlcon userConnect2 = new sqlcon(); userConnect2.dbIn(); SqlCommand cmd2 = new SqlCommand("[weekEvent]", sqlcon.con); SqlDataReader dr2 = cmd2.ExecuteReader(); while (dr2.Read()) { metroLabel6.Text = "Php. " + dr2["sales"].ToString(); metroLabel3.Text = "Php. " + dr2["Purchases"].ToString(); metroLabel7.Text = "Php. " + dr2["equals"].ToString(); } userConnect2.dbOut(); }
private void userExistCheck() //Check for user existence.... { string fName = ""; string lName = ""; sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[CheckDuplicates] '" + metroTextBox1.Text + "'", sqlcon.con); SqlDataReader dr = cmd.ExecuteReader(); int user = 0; while (dr.Read()) { user += 1; fName = dr["FirstName"].ToString(); lName = dr["LastName"].ToString(); } userConnect.dbOut(); if (fName.ToUpper() == metroTextBox1.Text.ToUpper() && lName.ToUpper() == metroTextBox2.Text.ToUpper() && metroTextBox1.Text != string.Empty && metroTextBox2.Text != string.Empty) { metroButton1.Enabled = false; DesktopAlert.Show("Already Exist"); } else { metroButton1.Enabled = true; } }
private void metroGrid1_CellClick(object sender, DataGridViewCellEventArgs e) { var rowsCount = metroGrid1.SelectedRows.Count; if (rowsCount == 0 || rowsCount > 1) { return; } metroLabel1.Text = metroGrid1.SelectedCells[0].Value.ToString(); sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[imageReceipt] '" + metroLabel1.Text + "'", sqlcon.con); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { byte[] img = (byte[])(dr[0]); MemoryStream ms = new MemoryStream(img); pictureBox1.Image = Image.FromStream(ms); } userConnect.dbOut(); }
private void metroTextButton1_Click(object sender, EventArgs e) { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand addClient = new SqlCommand("[modifyClient]", sqlcon.con); addClient.CommandType = System.Data.CommandType.StoredProcedure; addClient.Parameters.AddWithValue("@clientName", metroLabel11.Text); addClient.Parameters.AddWithValue("@newClientName", metroTextBox10.Text); addClient.Parameters.AddWithValue("@description", metroTextBox9.Text); addClient.Parameters.AddWithValue("@Fname", metroTextBox16.Text); addClient.Parameters.AddWithValue("@Mname", metroTextBox15.Text); addClient.Parameters.AddWithValue("@Lname", metroTextBox14.Text); addClient.Parameters.AddWithValue("@address", metroTextBox1.Text); addClient.Parameters.AddWithValue("@contactNumber", metroTextBox8.Text); addClient.Parameters.AddWithValue("@emailAddress", metroTextBox2.Text); addClient.Parameters.AddWithValue("@user", globalVar.name.ToString()); addClient.ExecuteNonQuery(); userConnect.dbOut(); displayClients(); slidePanel2.SlideSide = eSlideSide.Right; slidePanel2.IsOpen = false; metroGrid2.Enabled = true; }
private void metroButton2_Click(object sender, EventArgs e) { try { DialogResult dialogResult = MetroMessageBox.Show(this, "Materials Received?", "Purchased Material", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { foreach (DataGridViewRow item2 in metroGrid1.Rows) { if (bool.Parse(item2.Cells[0].Value.ToString())) { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand material = new SqlCommand("[materialINChckBox]", sqlcon.calc); material.CommandType = System.Data.CommandType.StoredProcedure; material.Parameters.AddWithValue("@employee", globalVar.name.ToString()); material.Parameters.AddWithValue("@id", item2.Cells[1].Value.ToString()); material.ExecuteNonQuery(); userConnect.dbOut(); } } } } catch { return; } tempTableOrderIN(); reloadChkBox(); }
private void metroTextButton1_Click(object sender, EventArgs e) { try { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand material = new SqlCommand("[modifyFormulaDetails]", sqlcon.calc); material.CommandType = System.Data.CommandType.StoredProcedure; material.Parameters.AddWithValue("@matName", metroTextBox5.Text); material.Parameters.AddWithValue("@DESC", metroTextBox6.Text); material.Parameters.AddWithValue("@amt", metroTextBox7.Text); material.Parameters.AddWithValue("@PKG", metroTextBox8.Text); material.Parameters.AddWithValue("@user", globalVar.name.ToString()); material.Parameters.AddWithValue("@fglook", metroLabel6.Text); material.ExecuteNonQuery(); userConnect.dbOut(); displayFormula(); DesktopAlert.AutoCloseTimeOut = 3; textBoxX1.Text = null; metroTextBox11.Text = null; DesktopAlert.Show("Details has been updated!"); } catch { DesktopAlert.Show("Please check your inputs!"); } }
private void metroButton3_Click(object sender, EventArgs e) { try { foreach (DataGridViewRow item in metroGrid1.Rows) { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand material = new SqlCommand("[voidFormula]", sqlcon.calc); material.CommandType = System.Data.CommandType.StoredProcedure; material.Parameters.AddWithValue("@name", item.Cells[1].Value.ToString()); if (bool.Parse(item.Cells[0].Value.ToString())) { material.Parameters.AddWithValue("@void", "Y"); } else { material.Parameters.AddWithValue("@void", "N"); } material.ExecuteNonQuery(); userConnect.dbOut(); } } catch { return; } displayFormula(); reloadChkBox(); }
private void matExistCheck() //Check for material existence.... { string matMame = ""; string formula = ""; sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[CheckMtrlDup_formula] '" + textBoxX1.Text + "','" + metroLabel6.Text + "'", sqlcon.con); SqlDataReader dr = cmd.ExecuteReader(); int user = 0; while (dr.Read()) { user += 1; matMame = dr["Material"].ToString(); formula = dr["formulaName"].ToString(); } userConnect.dbOut(); if (user >= 1) { metroTextButton2.Enabled = false; DesktopAlert.Show("Already Exist"); } else { metroTextButton2.Enabled = true; } }
private void metroButton5_Click(object sender, EventArgs e) { try { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); foreach (DataGridViewRow item in metroGrid3.Rows) { if (bool.Parse(item.Cells[0].Value.ToString())) { SqlCommand material = new SqlCommand("[deletePosition]", sqlcon.calc); material.CommandType = System.Data.CommandType.StoredProcedure; material.Parameters.AddWithValue("@position", item.Cells[1].Value.ToString()); material.Parameters.AddWithValue("@stat", "Y"); material.Parameters.AddWithValue("@addBy", globalVar.name.ToString()); material.ExecuteNonQuery(); } //else //{ // SqlCommand material = new SqlCommand("[deletePosition]", sqlcon.calc); // material.CommandType = System.Data.CommandType.StoredProcedure; // material.Parameters.AddWithValue("@position", item.Cells[1].Value.ToString()); // material.Parameters.AddWithValue("@stat", "N"); // material.ExecuteNonQuery(); //} } userConnect.dbOut(); } catch { return; } displayUsers2(); reloadChkBox(); DesktopAlert.Show("Position has been updated!"); }
private void BAndR() { try { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlDataAdapter da = new SqlDataAdapter("exec [DBBASE]", sqlcon.con); DataTable dt = new DataTable(); da.Fill(dt); metroComboBox1.DataSource = dt; metroComboBox1.DisplayMember = "name"; DataTable mod = new DataTable(); userConnect.dbOut(); metroButton3.Enabled = true; metroComboBox1.Enabled = true; } catch (Exception ex) { //MessageBox.Show(ex.Message); DesktopAlert.Show(ex.Message); } }
private void listOfUser() //provide the client list for combobox { try { metroComboBox2.Items.Insert(0, "all"); metroComboBox2.Items.Add("All"); sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlDataAdapter da = new SqlDataAdapter("exec [userList]", sqlcon.con); DataTable dt = new DataTable(); da.Fill(dt); dt.Columns.Add("ID", typeof(int)); metroComboBox2.DisplayMember = "NAMES"; metroComboBox2.ValueMember = "ID"; metroComboBox2.DataSource = dt; DataRow dr = dt.NewRow(); dr["NAMES"] = "All"; dr["ID"] = 0; dt.Rows.InsertAt(dr, 0); metroComboBox2.SelectedIndex = 0; userConnect.dbOut(); } catch { } }
public void listOfClients() //provide the client list for combobox { try { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlDataAdapter da = new SqlDataAdapter("exec [clientList]", sqlcon.con); DataTable dt = new DataTable(); da.Fill(dt); metroComboBox3.DataSource = dt; //metroComboBox3.DisplayMember = "ClientName"; dt.Columns.Add("ID", typeof(int)); metroComboBox3.DisplayMember = "ClientName"; metroComboBox3.ValueMember = "ID"; metroComboBox3.DataSource = dt; DataRow dr = dt.NewRow(); dr["ClientName"] = "All"; dr["ID"] = 0; dt.Rows.InsertAt(dr, 0); metroComboBox3.SelectedIndex = 0; userConnect.dbOut(); } catch { } }
private void autoSuggest() { AutoCompleteStringCollection namesCollection = new AutoCompleteStringCollection(); SqlDataReader dReader; sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[materialsListCombo]", sqlcon.calc); cmd.CommandType = CommandType.Text; userConnect.dbIn(); dReader = cmd.ExecuteReader(); if (dReader.HasRows == true) { while (dReader.Read()) { namesCollection.Add(dReader["MaterialName"].ToString()); } } else { DesktopAlert.Show("Data not found"); } dReader.Close(); userConnect.dbOut(); textBoxX1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; textBoxX1.AutoCompleteSource = AutoCompleteSource.CustomSource; textBoxX1.AutoCompleteCustomSource = namesCollection; }
private void metroButton3_Click_1(object sender, EventArgs e) { //bool.Parse(item.Cells[0].Value.ToString()) == true try { foreach (DataGridViewRow item in metroGrid1.Rows) { if (bool.Parse(item.Cells[0].Value.ToString())) { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand material = new SqlCommand("[delTempMaterials]", sqlcon.calc); material.CommandType = System.Data.CommandType.StoredProcedure; material.Parameters.AddWithValue("@id", item.Cells[2].Value.ToString()); material.ExecuteNonQuery(); userConnect.dbOut(); } } } catch { return; } tempTableOrderIN(); reloadChkBox(); }
private void tempsoldFinishGood() { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand soldFinishGood = new SqlCommand("[TEMPmaterialOut]", sqlcon.calc); soldFinishGood.CommandType = System.Data.CommandType.StoredProcedure; soldFinishGood.Parameters.AddWithValue("@recipe", metroComboBox2.Text); soldFinishGood.Parameters.AddWithValue("@client", metroComboBox1.Text); soldFinishGood.Parameters.AddWithValue("@amount", metroTextBox1.Text); soldFinishGood.Parameters.AddWithValue("@employe", globalVar.name.ToString()); soldFinishGood.Parameters.AddWithValue("@pricePerBag", metroLabel3.Text); soldFinishGood.Parameters.AddWithValue("@bagging", metroLabel12.Text); soldFinishGood.Parameters.AddWithValue("@userID", globalVar.x.ToString()); soldFinishGood.Parameters.AddWithValue("@fGcode", metroLabel18.Text); //string result = ""; //if (stat == "N") { result = "Pending"; } //else {result = "Proceed"; } //soldFinishGood.Parameters.AddWithValue("@stat", result.ToString()); soldFinishGood.ExecuteNonQuery(); userConnect.dbOut(); metroTextBox1.Text = ""; DesktopAlert.AlertColor = eDesktopAlertColor.Green; DesktopAlert.Show("Item Has been added!"); DesktopAlert.AutoCloseTimeOut = 3; reloadChkBox(); }
private void modifyFormula() { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand material = new SqlCommand("[modifyFormula] '" + metroLabel19.Text + "','" + metroLabel6.Text + "','" + metroTextBox12.Text + "','" + globalVar.name + "'", sqlcon.calc); SqlDataReader dr = material.ExecuteReader(); userConnect.dbOut(); displayFormula2(); formulaTotalCheck(); }
private void uploadToDB() { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand material = new SqlCommand("[materialIN]", sqlcon.calc); material.CommandType = System.Data.CommandType.StoredProcedure; material.Parameters.AddWithValue("@employee", globalVar.name.ToString());; material.ExecuteNonQuery(); userConnect.dbOut(); }
public void listOfClients() //provide the client list for combobox { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlDataAdapter da = new SqlDataAdapter("exec [clientList]", sqlcon.con); DataTable dt = new DataTable(); da.Fill(dt); metroComboBox1.DataSource = dt; metroComboBox1.DisplayMember = "ClientName"; userConnect.dbOut(); }
private void listOfFormulas() //provide the material list for combobox { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlDataAdapter da = new SqlDataAdapter("exec [listOfFormulas]", sqlcon.calc); DataTable dt = new DataTable(); da.Fill(dt); metroComboBox2.DataSource = dt; metroComboBox2.DisplayMember = "FormulaName"; userConnect.dbOut(); }
private void clientNAme() { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlDataAdapter da = new SqlDataAdapter("exec [clientList]", sqlcon.calc); DataTable dt = new DataTable(); da.Fill(dt); metroComboBox2.DataSource = dt; metroComboBox2.DisplayMember = "ClientName"; userConnect.dbOut(); }