private void btnLok_Click(object sender, EventArgs e) { txtLokacija.Text = txtLokacija.Text.Trim().ToUpper(); MTrenisClient c = new MTrenisClient(); try { if ("potvrda" == btnLok.Tag.ToString()) { txtLokacija.Text = txtLokacija.Text.ToUpper(); if (!c.LokacijaPostoji(inventura.skladiste, txtLokacija.Text)) { MessageBox.Show(P.LOK_NE_POSTOJI, P.MSGBOX_ERR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } txtLokacija.Enabled = false; btnLok.Text = P.INVUPISNIK_BTNLOK_IZMJENA; btnLok.Tag = "izmjena"; pnlRoba.Enabled = true; btnUpiši.Enabled = true; this.AcceptButton = btnUpiši; txtBarkod.Focus(); } else { FormInvUpisnik form = new FormInvUpisnik(this.terminal, this.katalog, this.Location, this.Width, this.Height, this.WindowState, this.inventura); form.Show(); this.Close(); return; } } catch (FaultException<MTrenisKvar> ex) { MessageBox.Show(ex.Detail.opis, ex.Detail.oznaka.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, P.MSGBOX_ERR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (c != null && c.State != CommunicationState.Closed) { c.Close(); } } }
private void btnOK_Click(object sender, EventArgs e) { txtIzLok.Text = txtIzLok.Text.Trim().ToUpper(); if (String.IsNullOrEmpty(txtIzLok.Text)) { MessageBox.Show(P.LOK_OBAVEZNA, P.MSGBOX_ERR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MTrenisClient c = new MTrenisClient(); try { if (c.LokacijaPostoji(nalog.sklaOznaka, txtIzLok.Text)) { c.StaviNaIzlaznuLokaciju(nalog.sklaOznaka, nalog.dokVrsta, nalog.dokBr, txtIzLok.Text, terminal.skladištar.mBr, terminal.skladištar.lozinka, terminal.macAdrese[0]); MessageBox.Show(P.IZLOK_SMJEŠTAJ_OK, String.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show(P.LOK_NE_POSTOJI, P.MSGBOX_ERR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (FaultException<MTrenisKvar> ex) { MessageBox.Show(ex.Detail.opis, ex.Detail.oznaka.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, P.MSGBOX_ERR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (c != null && c.State != CommunicationState.Closed) { c.Close(); } } }