示例#1
0
 private void mnubtnNalog_Click(object sender, EventArgs e)
 {
     FormNalog form = new FormNalog(this.terminal, this.katalog, new Point(this.Location.X, this.Location.Y), this.Width, this.Height, this.WindowState, null);
     form.Show();
     this.Close();
 }
示例#2
0
 private void btnNatrag_Click(object sender, EventArgs e)
 {
     FormNalog form = new FormNalog(this.terminal, this.katalog, this.Location, this.Width, this.Height, this.WindowState, this.nalog);
     form.Show();
     this.Close();
 }
示例#3
0
 private void btnUpiši_Click(object sender, EventArgs e)
 {
     txtLok.Text = txtLok.Text.ToUpper();
     txtKol.Text = txtKol.Text.Trim().Replace(",", ".");
     string msg;
     if (!IcOK(out msg))
     {
         MessageBox.Show(msg, P.MSGBOX_ERR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     MTrenisClient c = new MTrenisClient();
     try
     {
         if (nalog.dokVrsta != "PSS")
         {
             int sta = c.UpisiRobniPromet(
                 nalog.sklaOznaka,
                 nalog.dokVrsta,
                 nalog.dokBr,
                 txtLok.Text,
                 null,
                 stavka.roba.sifra,
                 Convert.ToDecimal(txtKol.Text),
                 0,
                 nalog.smjer,
                 terminal.skladištar.mBr,
                 terminal.skladištar.lozinka,
                 terminal.macAdrese[0]);
         }
         else if (nalog.dokVrsta == "PSS")
         {
             int sta = c.UpisiPSSPromet(
                 nalog.sklaOznaka,
                 nalog.sklaOznakaPSS,
                 nalog.dokVrsta,
                 nalog.dokBr,
                 txtLok.Text,
                 null,
                 stavka.roba.sifra,
                 Convert.ToDecimal(txtKol.Text),
                 terminal.skladištar.mBr,
                 terminal.skladištar.lozinka,
                 terminal.macAdrese[0]);
         }
     }
     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();
         }
     }
     FormNalog form = new FormNalog(this.terminal, this.katalog, this.Location, this.Width, this.Height, this.WindowState, this.nalog);
     form.Show();
     this.Close();
 }
示例#4
0
 private void btnTraži_Click(object sender, EventArgs e)
 {
     MTrenisClient c = null;
     if (btnTraži.Tag.ToString() == "potvrda")
     {
         txtDok.Text = txtDok.Text.ToUpper();
         if (txtDok.Text.Length != 15 && txtDok.Text.Length != 19)
         {
             MessageBox.Show(String.Format(P.DOKBARKOD_KRIVA_DULJINA, txtDok.Text.Length), P.MSGBOX_ERR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         DokBarkod skladok = F.RazriješiDokBarkod(txtDok.Text);
         string msg;
         if (!F.DokBarkodOK(skladok, this.katalog, out msg))
         {
             MessageBox.Show(msg, P.MSGBOX_ERR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         try
         {
             c = new MTrenisClient();
             if (skladok.dokVrsta == "PSS")
             {
                 CoreScannerProxy.Instance.BarcodeEvent -= new BarcodeEventHandler(OnBarcode);
                 ModalPSS modal = new ModalPSS();
                 modal.ShowDialog(this);
                 modal.Dispose();
                 CoreScannerProxy.Instance.BarcodeEvent += new BarcodeEventHandler(OnBarcode);
                 if (String.IsNullOrEmpty(smjerPSS))
                 {
                     MessageBox.Show(P.NALOGPSS_KAJ_SE_DELA, P.MSGBOX_ERR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                     return;
                 }
                 if (smjerPSS == "U" && !c.MozeUlazPSS(skladok.sklaOznaka, skladok.dokBr))
                 {
                     MessageBox.Show(P.NALOGPSS_NEMRE_ULAZ, P.MSGBOX_ERR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                     return;
                 }
             }
             PrikažiNalog(
                 skladok.sklaOznaka,
                 skladok.sklaOznakaPSS,
                 skladok.dokVrsta,
                 skladok.dokBr,
                 skladok.dokVrsta == "PSS" ? smjerPSS : (from r in this.katalog.dokumenti where r.vrsta == skladok.dokVrsta select r).Single().smjer.ToUpper());
         }
         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();
             }
         }
     }
     else if (btnTraži.Tag.ToString() == "izmjena")
     {
         FormNalog form = new FormNalog(this.terminal, this.katalog, this.Location, this.Width, this.Height, this.WindowState, null);
         form.Show();
         this.Close();
     }
 }