Пример #1
0
        private void btn_Kaydet_Click(object sender, EventArgs e)
        {
            try
            {
                //by Ali Görkem Gönen Revizeleri tarafından kaldırıldı - 28.04.2015
                //!rbAnhTesMasraf.Checked &&
                //if ( !rbFazla.Checked && !rbKayip.Checked && !rbMasraf.Checked && !rbSarfFire.Checked && !rbSarfFireKayip.Checked) { throw new Exception("İşlem tipi seçiniz!"); }
                if (dtSarfFire.Rows.Count == 0)
                {
                    throw new Exception("Sarf fire tablosu boş ike işlem yapılamaz!");
                }

                Cursor.Current = Cursors.WaitCursor;
                WS_Stok.service SRV = new WS_Stok.service();

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

                WS_Stok.ZktmobilSarfFormCrt Sarf = new WS_Stok.ZktmobilSarfFormCrt();

                WS_Stok.ZktmobilSarf[] items = new WS_Stok.ZktmobilSarf[dtSarfFire.Rows.Count];
                for (int i = 0; i < dtSarfFire.Rows.Count; i++)
                {
                    WS_Stok.ZktmobilSarf item = new WS_Stok.ZktmobilSarf();

                    item.Aciklama = dtSarfFire.Rows[i]["Aciklama"].ToString();
                    item.Lgort    = dtSarfFire.Rows[i]["Lgort"].ToString();
                    item.Matnr    = dtSarfFire.Rows[i]["Matnr"].ToString();
                    item.Menge    = Convert.ToDecimal(dtSarfFire.Rows[i]["Miktar"].ToString());
                    item.Sarf     = dtSarfFire.Rows[i]["rbValue"].ToString();
                    items[i]      = item;
                }
                Sarf.ItSarf = items;
                WS_Stok.ZkmobilReturn[] RET = new WS_Stok.ZkmobilReturn[1];
                Sarf.EReturn = RET;
                WS_Stok.ZktmobilSarfReturn[] fRET = new WS_Stok.ZktmobilSarfReturn[1];
                Sarf.ItReturn = fRET;

                WS_Stok.ZktmobilSarfFormCrtResponse Response = SRV.ZktmobilSarfFormCrt(Sarf);

                if (Response.EReturn.Length > 0)
                {
                    MessageBox.Show(Response.EReturn[0].RcText, "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                }


                StringBuilder sbFormNumbers = new StringBuilder();
                if (Response.ItReturn.Length > 0)
                {
                    foreach (WS_Stok.ZktmobilSarfReturn var in Response.ItReturn)
                    {
                        sbFormNumbers.Append(var.SarfNo + " ,");
                    }
                }

                if (sbFormNumbers.Length > 0)
                {
                    sbFormNumbers.Insert(0, "Oluşan Form Numaraları :\n ");
                    MessageBox.Show(sbFormNumbers.ToString().TrimEnd(','));
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Пример #2
0
        private void btn_Kaydet_Click(object sender, EventArgs e)
        {
            try
            {
                if (grd_SarfFire.VisibleRowCount == 0)
                {
                    return;
                }

                /*
                 * if (!grd_SarfFire.IsSelected(grd_SarfFire.CurrentRowIndex))
                 *  throw new Exception("Lütfen bir kayıt seçiniz!");
                 *
                 * if (txtAciklama.Text.Trim() == string.Empty)
                 *  throw new Exception("Açıklama alanı boş geçilemez!");
                 *
                 * try { int.Parse(txt_FormNo.Text.Trim()); }
                 * catch { throw new Exception("Form no alanına sayısal bir değer giriniz!"); }
                 *
                 * try { decimal.Parse(txtMiktar.Text.Trim()); }
                 * catch { throw new Exception("Miktar alanına sayısal bir değer giriniz!"); }
                 */

                Cursor.Current = Cursors.WaitCursor;
                WS_Stok.service SRV = new WS_Stok.service();

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

                WS_Stok.ZktmobilChngSarf ChangeSarf = new WS_Stok.ZktmobilChngSarf();
                ChangeSarf.ISarfno = txt_FormNo.Text.Trim();

                //int Length = (grd_SarfFire.DataSource as WS_Stok.ZktmobilSarf[]).Length;
                WS_Stok.ZktmobilSarf[] sarf = new KoctasMobil.WS_Stok.ZktmobilSarf[sarf_mal.Rows.Count];

                for (int i = 0; i < sarf_mal.Rows.Count; i++)
                {
                    WS_Stok.ZktmobilSarf item = new WS_Stok.ZktmobilSarf();
                    item.Aciklama = sarf_mal.Rows[i]["Aciklama"].ToString();
                    item.Lgort    = sarf_mal.Rows[i]["Lgort"].ToString();
                    item.Matnr    = sarf_mal.Rows[i]["Matnr"].ToString();
                    item.Meins    = sarf_mal.Rows[i]["Meins"].ToString();
                    item.Menge    = Convert.ToDecimal(sarf_mal.Rows[i]["Menge"].ToString());
                    item.Sarf     = sarf_mal.Rows[i]["Sarf"].ToString();

                    sarf[i] = item;
                }


                ChangeSarf.ItChng = sarf;

                WS_Stok.ZktmobilChngSarfResponse Response = SRV.ZktmobilChngSarf(ChangeSarf);

                if (Response.EReturn.RcCode == "E")
                {
                    throw new Exception(Response.EReturn.RcText);
                }
                else
                {
                    MessageBox.Show("Form Güncellendi.");
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }


                //grd_SarfFire.UnSelect(grd_SarfFire.CurrentRowIndex);
                btn_Getir_Click(null, null);
                txtAciklama.Text = txtAdt.Text = txtMiktar.Text = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }