private void TrovaCommessaFrm_Load(object sender, EventArgs e) { using (CreaEtichetteBusiness bEtichetta = new CreaEtichetteBusiness()) { bEtichetta.FillTEMP_COMMESSA(ds, _IDMAGAZZ); dgvCommessa.AutoGenerateColumns = true; dgvCommessa.DataSource = ds; dgvCommessa.DataMember = ds.TEMP_COMMESSA.TableName; dgvCommessa.Columns[0].Width = 400; } }
private void btnTrova_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtModelloRicerca.Text)) { return; } string modelloDaTrovare = txtModelloRicerca.Text.Trim().ToUpper(); _ds = new EtichetteDS(); if (chkBC.Checked) { using (CreaEtichetteBusinesSQL bEtichetta = new CreaEtichetteBusinesSQL()) { bEtichetta.TrovaArticolo(_ds, modelloDaTrovare); } } else { using (CreaEtichetteBusiness bEtichetta = new CreaEtichetteBusiness()) { bEtichetta.TrovaArticolo(_ds, modelloDaTrovare); } } dgvArticoli.AutoGenerateColumns = true; dgvArticoli.DataSource = _ds; dgvArticoli.DataMember = _ds.MAGAZZ.TableName; for (int i = 0; i < dgvArticoli.Columns.Count; i++) { dgvArticoli.Columns[i].Visible = false; } dgvArticoli.Columns[1].Visible = true; dgvArticoli.Columns[1].Width = 180; dgvArticoli.Columns[2].Visible = true; dgvArticoli.Columns[2].Width = 400; System.Drawing.Font font = new System.Drawing.Font(dgvArticoli.Font.FontFamily, 8); dgvArticoli.Font = font; }
private void btnSalva_Click(object sender, EventArgs e) { lblMessaggio.Text = string.Empty; string SKU = txtSKU.Text; string codiceModello = txtCodiceModelloCliente.Text; string modello = txtModelloCliente.Text; string codicecolore = txtCodiceColoreCliente.Text; string colore = txtColoreCliente.Text; string parziale = txtParziale.Text; string RTT = txtRTT.Text; if (string.IsNullOrEmpty(SKU) || string.IsNullOrEmpty(codiceModello) || string.IsNullOrEmpty(modello) || string.IsNullOrEmpty(codicecolore) || string.IsNullOrEmpty(colore) || string.IsNullOrEmpty(parziale) ) { lblMessaggio.Text = "I campi CLIENTE non possono essere vuoti"; return; } if (string.IsNullOrEmpty(txtIDMAGAZZ.Text)) { lblMessaggio.Text = "IDMAGAZZ non può essere vuoto. Selezionare un articolo."; return; } string IDMAGAZZ = txtIDMAGAZZ.Text; EtichetteDS.ETI_ARTICOLIRow eti = _ds.ETI_ARTICOLI.Where(x => x.IDMAGAZZ == IDMAGAZZ).FirstOrDefault(); if (eti == null) { eti = _ds.ETI_ARTICOLI.NewETI_ARTICOLIRow(); eti.IDMAGAZZ = IDMAGAZZ; eti.SKU = SKU; eti.CODICEMODELLO = codiceModello; eti.CODICECOLORE = codicecolore; eti.MODELLO = modello; eti.COLORE = colore; eti.PARZIALE = parziale; if (!string.IsNullOrEmpty(RTT)) { eti.RTT = RTT; } _ds.ETI_ARTICOLI.AddETI_ARTICOLIRow(eti); } else { eti.SKU = SKU; eti.CODICEMODELLO = codiceModello; eti.CODICECOLORE = codicecolore; eti.MODELLO = modello; eti.COLORE = colore; eti.PARZIALE = parziale; if (!string.IsNullOrEmpty(RTT)) { eti.RTT = RTT; } } if (chkBC.Checked) { using (CreaEtichetteBusinesSQL bEtichetta = new CreaEtichetteBusinesSQL()) { bEtichetta.UpdateETI_ARTICOLI(_ds); lblMessaggio.Text = "Articolo salvato"; _ds.AcceptChanges(); } } else { using (CreaEtichetteBusiness bEtichetta = new CreaEtichetteBusiness()) { bEtichetta.UpdateETI_ARTICOLI(_ds); lblMessaggio.Text = "Articolo salvato"; _ds.AcceptChanges(); } } }
private void dgvArticoli_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } DataRow r = _ds.MAGAZZ.Rows[e.RowIndex]; string IDMAGAZZ = (String)r[0]; string modello = (String)r[1]; string descrizione = (String)r[2]; if (chkBC.Checked) { using (CreaEtichetteBusinesSQL bEtichetta = new CreaEtichetteBusinesSQL()) { _ds.USR_IMPORT_MAGAZZ.Clear(); _ds.ETI_ARTICOLI.Clear(); bEtichetta.FillETI_ARTICOLI(_ds, IDMAGAZZ); } } else { using (CreaEtichetteBusiness bEtichetta = new CreaEtichetteBusiness()) { _ds.USR_IMPORT_MAGAZZ.Clear(); _ds.ETI_ARTICOLI.Clear(); bEtichetta.FillETI_ARTICOLI(_ds, IDMAGAZZ); bEtichetta.FillUSR_IMPORT_MAGAZZ(_ds, IDMAGAZZ); } } txtIDMAGAZZ.Text = IDMAGAZZ; txtModelloMetalplus.Text = modello; txtModelloMetalplusDescrizione.Text = descrizione; EtichetteDS.ETI_ARTICOLIRow eti = _ds.ETI_ARTICOLI.Where(x => x.IDMAGAZZ == IDMAGAZZ).FirstOrDefault(); EtichetteDS.USR_IMPORT_MAGAZZRow import = _ds.USR_IMPORT_MAGAZZ.Where(x => x.IDMAGAZZ == IDMAGAZZ).FirstOrDefault(); if (eti != null) { txtSKU.Text = eti.SKU; txtCodiceModelloCliente.Text = eti.CODICEMODELLO; txtModelloCliente.Text = eti.MODELLO; txtCodiceColoreCliente.Text = eti.CODICECOLORE; txtColoreCliente.Text = eti.COLORE; txtParziale.Text = eti.IsPARZIALENull() ? string.Empty : eti.PARZIALE; txtRTT.Text = eti.IsRTTNull() ? string.Empty : eti.RTT; } else if (import != null) { txtSKU.Text = string.Empty; string modelloImp = import.IsMODELLOIMPNull() ? string.Empty : import.MODELLOIMP; if (!string.IsNullOrEmpty(modelloImp)) { if (modelloImp[0] == 'R' && modelloImp.Contains('-')) { string sku = modelloImp.Split('-')[0]; if (sku.Length < 12) { txtSKU.Text = sku; modelloImp = modelloImp.Split('-')[1]; } } } txtCodiceModelloCliente.Text = modelloImp; txtModelloCliente.Text = import.IsDESMAGAZZIMPNull() ? string.Empty : import.DESMAGAZZIMP; txtCodiceColoreCliente.Text = string.Empty; txtColoreCliente.Text = string.Empty; txtParziale.Text = string.Empty; txtRTT.Text = string.Empty; } else { txtSKU.Text = string.Empty; txtCodiceModelloCliente.Text = string.Empty; txtModelloCliente.Text = string.Empty; txtCodiceColoreCliente.Text = string.Empty; txtColoreCliente.Text = string.Empty; txtParziale.Text = string.Empty; txtRTT.Text = string.Empty; } }