Beispiel #1
0
        private void btn_Sayim_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                WS_Sayim.service SRV = new WS_Sayim.service();

                SRV.Url         = Utility.getWsUrl("zktmobil_sayim");
                SRV.Credentials = ProgramGlobalData.g_credential;

                WS_Sayim.ZktmobilCheckAdr Adr = new KoctasMobil.WS_Sayim.ZktmobilCheckAdr();
                Adr.IType    = SayimTipi.ToString();
                Adr.IAddress = txtRafAdresi.Text.ToUpper().Trim();
                Adr.TeReturn = new KoctasMobil.WS_Sayim.ZkmobilReturn[1];

                WS_Sayim.ZktmobilCheckAdrResponse Response = new KoctasMobil.WS_Sayim.ZktmobilCheckAdrResponse();
                Response = SRV.ZktmobilCheckAdr(Adr);

                if (Response.TeReturn.Length > 0)
                {
                    if (Response.TeReturn[0].RcCode == "E")
                    {
                        MessageBox.Show(Response.TeReturn[0].RcText, "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
                        Cursor.Current = Cursors.Default;
                        return;
                    }
                }
                else
                {
                    Cursor.Current = Cursors.Default;
                    frm_SayimRaf2 raf2 = new frm_SayimRaf2();
                    raf2.RafNo   = Adr.IAddress;
                    raf2.SayimNo = Response.EDocument;
                    raf2.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
        private void btn_kaydet_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                WS_Sayim.service SRV = new WS_Sayim.service();

                SRV.Url         = Utility.getWsUrl("zktmobil_sayim");
                SRV.Credentials = ProgramGlobalData.g_credential;

                WS_Sayim.ZktmobilSayimSave SaVe = new WS_Sayim.ZktmobilSayimSave();

                WS_Sayim.ZkmobilItems[] items = new WS_Sayim.ZkmobilItems[dtgrd_Sayim.Rows.Count];
                for (int i = 0; i < dtgrd_Sayim.Rows.Count; i++)
                {
                    WS_Sayim.ZkmobilItems item = new WS_Sayim.ZkmobilItems();

                    item.Ean11    = dtgrd_Sayim.Rows[i]["EAN11"].ToString();
                    item.Iblnr    = txtSayimNo.Text.Trim();
                    item.Matnr    = dtgrd_Sayim.Rows[i]["MATNR"].ToString();
                    item.Meins    = dtgrd_Sayim.Rows[i]["MEINS"].ToString();
                    item.Miktar   = Convert.ToDecimal(dtgrd_Sayim.Rows[i]["MENGE"]);
                    item.Personel = ProgramGlobalData.username;
                    item.Raf      = txtRafNo.Text.Trim();
                    item.Saat     = DateTime.Now.ToString("HH:mm:ss");
                    item.Tarih    = DateTime.Now.ToString("yyyy-MM-dd");

                    items[i] = item;
                }
                SaVe.ItItems  = items;
                SaVe.TeReturn = new KoctasMobil.WS_Sayim.ZkmobilReturn[1];

                WS_Sayim.ZktmobilSayimSaveResponse //Response = new WS_Sayim.ZktmobilSayimSaveResponse();
                    Response = SRV.ZktmobilSayimSave(SaVe);

                if (Response.TeReturn.Length > 0)
                {
                    if (Response.TeReturn[0].RcCode == "S")
                    {
                        MessageBox.Show(Response.TeReturn[0].RcText, "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                        Cursor.Current = Cursors.Default;
                        DialogResult   = DialogResult.OK;
                    }
                    else
                    {
                        MessageBox.Show("İşlem Tamamlanamadı.", "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
                        Cursor.Current = Cursors.Default;
                        return;
                    }
                }
                else
                {
                    Cursor.Current = Cursors.Default;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }