private void btnPartner_Click(object sender, EventArgs e) { try { if (rbNaPartnera.Checked) { partnerExists = false; frmPartnerTrazi partnerTrazi = new frmPartnerTrazi(); partnerTrazi.ShowDialog(); if (Properties.Settings.Default.id_partner != "") { DataSet partner = new DataSet(); partner = classSQL.select("SELECT id_partner,ime_tvrtke FROM partners WHERE id_partner ='" + Properties.Settings.Default.id_partner + "'", "partners"); if (partner.Tables[0].Rows.Count > 0) { txtSifraPatner.Text = partner.Tables[0].Rows[0]["id_partner"].ToString(); txtNazivPartner.Text = partner.Tables[0].Rows[0]["ime_tvrtke"].ToString(); partnerExists = true; } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); } } } else { dgvSobeVisible(!dgvSobe.Visible); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSrchPartner_Click(object sender, EventArgs e) { frmPartnerTrazi partner = new frmPartnerTrazi(); partner.ShowDialog(); if (Properties.Settings.Default.id_partner != "") { FillPartner(Properties.Settings.Default.id_partner); } }
private void txtSifraPartnera_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; if (txtSifraPartnera.Text == "") { frmPartnerTrazi partnerTrazi = new frmPartnerTrazi(); partnerTrazi.ShowDialog(); if (Properties.Settings.Default.id_partner != "") { DataSet partner = new DataSet(); partner = classSQL.select("SELECT id_partner,ime_tvrtke FROM partners WHERE id_partner ='" + Properties.Settings.Default.id_partner + "'", "partners"); if (partner.Tables[0].Rows.Count > 0) { txtSifraPartnera.Text = partner.Tables[0].Rows[0]["id_partner"].ToString(); txtNazivPartnera.Text = partner.Tables[0].Rows[0]["ime_tvrtke"].ToString(); txtSifraPartnera.Select(); } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); txtSifraPartnera.Select(); } } else { txtSifraPartnera.Select(); return; } } string Str = txtSifraPartnera.Text.Trim(); double Num; bool isNum = double.TryParse(Str, out Num); if (!isNum) { txtSifraPartnera.Text = "0"; } DataTable DSpar = classSQL.select("SELECT ime_tvrtke FROM partners WHERE id_partner='" + txtSifraPartnera.Text + "'", "partners").Tables[0]; if (DSpar.Rows.Count > 0) { txtNazivPartnera.Text = DSpar.Rows[0][0].ToString(); } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); } } }
private void btnDobavljac_Click(object sender, EventArgs e) { frmPartnerTrazi djelatnost_trazi = new frmPartnerTrazi(); djelatnost_trazi.ShowDialog(); //dobiva odabranog partnera if (Properties.Settings.Default.id_partner != "") { Fill(Properties.Settings.Default.id_partner); //NoviUnos = false; } }
private void btnTrazi_Click(object sender, EventArgs e) { frmPartnerTrazi partner = new frmPartnerTrazi(); partner.ShowDialog(); if (Properties.Settings.Default.id_partner != "") { enable(true); cbFill(); FillPartner(Properties.Settings.Default.id_partner); button1.Enabled = true; edit = true; } }
private void cbDobavljac_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; if (txtSifraDob.Text == "") { frmPartnerTrazi partnerTrazi = new frmPartnerTrazi(); partnerTrazi.ShowDialog(); if (Properties.Settings.Default.id_partner != "") { DataSet partner = new DataSet(); partner = classSQL.select("SELECT id_partner,ime_tvrtke FROM partners WHERE id_partner ='" + Properties.Settings.Default.id_partner + "'", "partners"); if (partner.Tables[0].Rows.Count > 0) { txtSifraDob.Text = partner.Tables[0].Rows[0]["id_partner"].ToString(); bcUzmiSaSkladista.Select(); } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); txtSifraDob.Select(); } } else { txtSifraDob.Select(); return; } } DataTable DT = classSQL.select("SELECT ime_tvrtke FROM partners WHERE id_partner='" + txtSifraDob.Text + "'", "partners").Tables[0]; if (DT.Rows.Count > 0) { txtNazivDob.Text = DT.Rows[0][0].ToString(); bcUzmiSaSkladista.Select(); } else { MessageBox.Show("Krivi unos.", "Greška"); txtSifraDob.Text = ""; } } }
private void pictureBox1_Click(object sender, EventArgs e) { try { frmPartnerTrazi partner = new frmPartnerTrazi(); partner.ShowDialog(); if (Properties.Settings.Default.id_partner != null && Properties.Settings.Default.id_partner.ToString().Length > 0) { SetPartner(Convert.ToInt32(Properties.Settings.Default.id_partner)); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnPartner_Click(object sender, EventArgs e) { frmPartnerTrazi partnerTrazi = new frmPartnerTrazi(); partnerTrazi.ShowDialog(); if (Properties.Settings.Default.id_partner != "") { DataSet partner = new DataSet(); partner = classSQL.select("SELECT id_partner,ime_tvrtke FROM partners WHERE id_partner ='" + Properties.Settings.Default.id_partner + "'", "partners"); if (partner.Tables[0].Rows.Count > 0) { txtSifraOdrediste.Text = partner.Tables[0].Rows[0]["id_partner"].ToString(); txtPartnerNaziv.Text = partner.Tables[0].Rows[0]["ime_tvrtke"].ToString(); } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); } } }
private void btnSrchPartner_Click(object sender, EventArgs e) { try { frmPartnerTrazi partnerTrazi = new frmPartnerTrazi(); partnerTrazi.ShowDialog(); if (Properties.Settings.Default.id_partner != "") { txtPartner.Text = Properties.Settings.Default.id_partner; } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void pictureBox2_Click(object sender, EventArgs e) { frmPartnerTrazi partnerTrazi = new frmPartnerTrazi(); partnerTrazi.ShowDialog(); if (Properties.Settings.Default.id_partner != "") { DataSet partner = new DataSet(); partner = classSQL.select("SELECT id_partner,ime_tvrtke FROM partners WHERE id_partner = '" + Properties.Settings.Default.id_partner + "'", "partners"); if (partner.Tables[0].Rows.Count > 0) { txtPartner.Text = partner.Tables[0].Rows[0]["ime_tvrtke"].ToString(); //SendKeys.Send("{TAB}"); SelectNextControl((sender as Control), true, true, true, true); } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); } } }
private void pictureBox2_Click(object sender, EventArgs e) { frmPartnerTrazi partnerTrazi = new frmPartnerTrazi(); partnerTrazi.ShowDialog(); if (Properties.Settings.Default.id_partner != "") { DataSet partner = new DataSet(); partner = classSQL.select("SELECT id_partner,ime_tvrtke FROM partners WHERE id_partner ='" + Properties.Settings.Default.id_partner + "'", "partners"); if (partner.Tables[0].Rows.Count > 0) { //txtSifraOdrediste.Text = partner.Tables[0].Rows[0]["id_partner"].ToString(); txtPartner.Text = partner.Tables[0].Rows[0]["ime_tvrtke"].ToString(); //txtSifraFakturirati.Text = partner.Tables[0].Rows[0]["id_partner"].ToString(); //txtPartnerNaziv1.Text = partner.Tables[0].Rows[0]["ime_tvrtke"].ToString(); cbVD.Select(); System.Windows.Forms.SendKeys.Send("{TAB}"); } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); } } }
private void txtPartner_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; if (txtPartner.Text == "") { frmPartnerTrazi partnerTrazi = new frmPartnerTrazi(); partnerTrazi.ShowDialog(); if (Properties.Settings.Default.id_partner != "") { DataSet partner = new DataSet(); partner = classSQL.select("SELECT id_partner,ime_tvrtke FROM partners WHERE id_partner ='" + Properties.Settings.Default.id_partner + "'", "partners"); if (partner.Tables[0].Rows.Count > 0) { //txtSifraOdrediste.Text = partner.Tables[0].Rows[0]["id_partner"].ToString(); txtPartner.Text = partner.Tables[0].Rows[0]["ime_tvrtke"].ToString(); //txtSifraFakturirati.Text = partner.Tables[0].Rows[0]["id_partner"].ToString(); //txtPartnerNaziv1.Text = partner.Tables[0].Rows[0]["ime_tvrtke"].ToString(); cbVD.Select(); //txtSifraFakturirati.Select(); System.Windows.Forms.SendKeys.Send("{TAB}"); } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); txtPartner.Select(); txtPartner.SelectAll(); return; } } else { txtPartner.Select(); txtPartner.SelectAll(); return; } } string Str = txtPartner.Text.Trim().ToLower(); double Num; bool isNum = double.TryParse(Str, out Num); if (isNum) { DataTable DSpar = classSQL.select("SELECT ime_tvrtke FROM partners WHERE id_partner='" + Str + "'", "partners").Tables[0]; if (DSpar.Rows.Count > 0) { Properties.Settings.Default.id_partner = Str; txtPartner.Text = DSpar.Rows[0][0].ToString(); //txtSifraFakturirati.Text = txtSifraOdrediste.Text; //txtSifraFakturirati_KeyDown(txtSifraOdrediste, e); System.Windows.Forms.SendKeys.Send("{TAB}"); } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); txtPartner.Select(); txtPartner.SelectAll(); } } else { DataTable DSpar = classSQL.select("SELECT ime_tvrtke FROM partners WHERE LOWER(ime_tvrtke) = '" + Str + "'", "partners").Tables[0]; if (DSpar.Rows.Count > 0) { txtPartner.Text = DSpar.Rows[0][0].ToString(); System.Windows.Forms.SendKeys.Send("{TAB}"); } else { DSpar = classSQL.select("SELECT ime_tvrtke FROM partners WHERE LOWER(ime_tvrtke) like '%" + Str + "%'", "partners").Tables[0]; if (DSpar.Rows.Count > 0) { txtPartner.Text = DSpar.Rows[0][0].ToString(); System.Windows.Forms.SendKeys.Send("{TAB}"); } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); txtPartner.Select(); txtPartner.SelectAll(); } } } } }
private void ttxBrojFakture_KeyDown_1(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Insert) { dgw.Rows.Add(dgw.Rows.Count, "", "", "1", "25", "0", "0", "0", "0", "0", "0"); RedniBroj(); } else if (e.KeyData == Keys.Enter) { if (sender is TextBox) { TextBox txt = ((TextBox)sender); if (txt.Name == "rtbNapomena") { if (rtbNapomena.Text == "") { dgw.Rows.Add("", "", "", "1", "25", "0", "0", "0", "0", "0", "0"); dgw.Select(); int br = dgw.Rows.Count - 1; dgw.CurrentCell = dgw.Rows[br].Cells[1]; dgw.BeginEdit(true); RedniBroj(); return; } else { return; } } } e.SuppressKeyPress = true; if (sender is TextBox) { TextBox txt = ((TextBox)sender); if (txt.Name == "txtSifraOdrediste") { if (txtSifraOdrediste.Text == "") { frmPartnerTrazi partnerTrazi = new frmPartnerTrazi(); partnerTrazi.ShowDialog(); if (Properties.Settings.Default.id_partner != "") { DataSet partner = new DataSet(); partner = classSQL.select("SELECT id_partner,ime_tvrtke FROM partners WHERE id_partner ='" + Properties.Settings.Default.id_partner + "'", "partners"); if (partner.Tables[0].Rows.Count > 0) { txtSifraOdrediste.Text = partner.Tables[0].Rows[0]["id_partner"].ToString(); txtPartnerNaziv.Text = partner.Tables[0].Rows[0]["ime_tvrtke"].ToString(); } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); txtSifraOdrediste.Select(); return; } } else { txtSifraOdrediste.Select(); return; } } string Str = txtSifraOdrediste.Text.Trim(); double Num; bool isNum = double.TryParse(Str, out Num); if (!isNum) { txtSifraOdrediste.Text = "0"; } DataTable DSpar = classSQL.select("SELECT ime_tvrtke FROM partners WHERE id_partner='" + txtSifraOdrediste.Text + "'", "partners").Tables[0]; if (DSpar.Rows.Count > 0) { txtPartnerNaziv.Text = DSpar.Rows[0][0].ToString(); } else { MessageBox.Show("Upisana šifra ne postoji.", "Greška"); } } } System.Windows.Forms.SendKeys.Send("{TAB}"); } }