private void cmdSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (IsValid())
         {
             using (Database db = new Database())
             {
                 DataTable dt = new DataTable();
                 db.Commands.Add(db.CreateCommand("usp_NotaPenjualanDetail_UPDATE"));
                 db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowID));
                 db.Commands[0].Parameters.Add(new Parameter("@headerID", SqlDbType.UniqueIdentifier, _headerID));
                 db.Commands[0].Parameters.Add(new Parameter("@doID", SqlDbType.UniqueIdentifier, _dtNotaDetail.Rows[0]["DOID"]));
                 db.Commands[0].Parameters.Add(new Parameter("@doDetailID", SqlDbType.UniqueIdentifier, _dtNotaDetail.Rows[0]["DODetailID"]));
                 db.Commands[0].Parameters.Add(new Parameter("@recID", SqlDbType.VarChar, _dtNotaDetail.Rows[0]["RecordID"]));
                 db.Commands[0].Parameters.Add(new Parameter("@htrID", SqlDbType.VarChar, _dtNotaDetail.Rows[0]["HtrID"]));
                 db.Commands[0].Parameters.Add(new Parameter("@barangID", SqlDbType.VarChar, _dtNotaDetail.Rows[0]["BarangID"]));
                 db.Commands[0].Parameters.Add(new Parameter("@hrgJual", SqlDbType.Money, _dtNotaDetail.Rows[0]["HrgJual"]));
                 db.Commands[0].Parameters.Add(new Parameter("@disc1", SqlDbType.Decimal, _dtNotaDetail.Rows[0]["Disc1"]));
                 db.Commands[0].Parameters.Add(new Parameter("@disc2", SqlDbType.Decimal, _dtNotaDetail.Rows[0]["Disc2"]));
                 db.Commands[0].Parameters.Add(new Parameter("@disc3", SqlDbType.Decimal, _dtNotaDetail.Rows[0]["Disc3"]));
                 db.Commands[0].Parameters.Add(new Parameter("@discFormula", SqlDbType.VarChar, _dtNotaDetail.Rows[0]["DiscFormula"]));
                 db.Commands[0].Parameters.Add(new Parameter("@pot", SqlDbType.Money, _dtNotaDetail.Rows[0]["Pot"]));
                 db.Commands[0].Parameters.Add(new Parameter("@kodeGudang", SqlDbType.VarChar, _dtNotaDetail.Rows[0]["KodeGudang"]));
                 db.Commands[0].Parameters.Add(new Parameter("@qtySJ", SqlDbType.Int, Convert.ToInt32(txtJSJ.Text)));
                 db.Commands[0].Parameters.Add(new Parameter("@qtyNota", SqlDbType.Int, qtyNota));
                 db.Commands[0].Parameters.Add(new Parameter("@qtyKoli", SqlDbType.Int, Convert.ToInt32(txtJKoli.Text)));
                 db.Commands[0].Parameters.Add(new Parameter("@koliAwal", SqlDbType.Int, Convert.ToInt32(txtKoliAwal.Text)));
                 db.Commands[0].Parameters.Add(new Parameter("@koliAkhir", SqlDbType.Int, Convert.ToInt32(txtKoliAkhir.Text)));
                 db.Commands[0].Parameters.Add(new Parameter("@noKoli", SqlDbType.VarChar, txtNoKoli.Text));
                 db.Commands[0].Parameters.Add(new Parameter("@ketKoli", SqlDbType.VarChar, txtKeterangan.Text));
                 db.Commands[0].Parameters.Add(new Parameter("@catatan", SqlDbType.VarChar, _dtNotaDetail.Rows[0]["Catatan"]));
                 db.Commands[0].Parameters.Add(new Parameter("@syncFlag", SqlDbType.Bit, 0));
                 db.Commands[0].Parameters.Add(new Parameter("@lastupdatedby", SqlDbType.VarChar, SecurityManager.UserID));
                 dt = db.Commands[0].ExecuteDataTable();
             }
             this.DialogResult = DialogResult.OK;
             frmPackingListBrowse frmCaller = (frmPackingListBrowse)this.Caller;
             frmCaller.RefreshDataHeader();
             frmCaller.FindHeader("RowID", _headerID.ToString());
             frmCaller.FindDetail("RowIDD", _rowID.ToString());
             this.Close();
             frmCaller.Show();
         }
     }
     catch (Exception ex)
     {
         Error.LogError(ex);
     }
 }
Ejemplo n.º 2
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (!ValidateInput())
            {
                return;
            }

            try
            {
                using (Database db = new Database())
                {
                    DataTable dt = new DataTable();
                    db.Commands.Add(db.CreateCommand("usp_NotaPenjualan_UPDATE"));
                    db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowID));
                    db.Commands[0].Parameters.Add(new Parameter("@htrID", SqlDbType.VarChar, dtNota.Rows[0]["HtrID"]));
                    db.Commands[0].Parameters.Add(new Parameter("@recID", SqlDbType.VarChar, dtNota.Rows[0]["RecordID"]));
                    db.Commands[0].Parameters.Add(new Parameter("@DOID", SqlDbType.UniqueIdentifier, dtNota.Rows[0]["DOID"]));
                    db.Commands[0].Parameters.Add(new Parameter("@noNota", SqlDbType.VarChar, dtNota.Rows[0]["NoNota"]));
                    db.Commands[0].Parameters.Add(new Parameter("@tglNota", SqlDbType.DateTime, dtNota.Rows[0]["TglNota"]));
                    db.Commands[0].Parameters.Add(new Parameter("@noSJ", SqlDbType.VarChar, dtNota.Rows[0]["NoSuratJalan"]));
                    db.Commands[0].Parameters.Add(new Parameter("@tglSJ", SqlDbType.DateTime, dtNota.Rows[0]["TglSuratJalan"]));
                    db.Commands[0].Parameters.Add(new Parameter("@tglTerima", SqlDbType.DateTime, dtNota.Rows[0]["TglTerima"]));
                    db.Commands[0].Parameters.Add(new Parameter("@tglSerahTerimaChecker", SqlDbType.DateTime, txtTglSerahTerima.DateValue));
                    db.Commands[0].Parameters.Add(new Parameter("@cabang1", SqlDbType.VarChar, dtNota.Rows[0]["Cabang1"]));
                    db.Commands[0].Parameters.Add(new Parameter("@cabang2", SqlDbType.VarChar, dtNota.Rows[0]["Cabang2"]));
                    db.Commands[0].Parameters.Add(new Parameter("@cabang3", SqlDbType.VarChar, dtNota.Rows[0]["Cabang3"]));
                    db.Commands[0].Parameters.Add(new Parameter("@kodeSales", SqlDbType.VarChar, dtNota.Rows[0]["KodeSales"]));
                    db.Commands[0].Parameters.Add(new Parameter("@kodeToko", SqlDbType.VarChar, dtNota.Rows[0]["KodeToko"]));
                    db.Commands[0].Parameters.Add(new Parameter("@alamatKirim", SqlDbType.VarChar, dtNota.Rows[0]["alamatKirim"]));
                    //db.Commands[0].Parameters.Add(new Parameter("@alamatKirim", SqlDbType.VarChar, dtNota.Rows[0]["alamatKirim"]));
                    db.Commands[0].Parameters.Add(new Parameter("@kota", SqlDbType.VarChar, dtNota.Rows[0]["Kota"]));
                    db.Commands[0].Parameters.Add(new Parameter("@isClosed", SqlDbType.Bit, dtNota.Rows[0]["isClosed"]));
                    db.Commands[0].Parameters.Add(new Parameter("@catatan1", SqlDbType.VarChar, dtNota.Rows[0]["Cat1"]));
                    db.Commands[0].Parameters.Add(new Parameter("@catatan2", SqlDbType.VarChar, dtNota.Rows[0]["Cat2"]));
                    db.Commands[0].Parameters.Add(new Parameter("@catatan3", SqlDbType.VarChar, dtNota.Rows[0]["Cat3"]));
                    db.Commands[0].Parameters.Add(new Parameter("@catatan4", SqlDbType.VarChar, dtNota.Rows[0]["Cat4"]));
                    db.Commands[0].Parameters.Add(new Parameter("@catatan5", SqlDbType.VarChar, dtNota.Rows[0]["Cat5"]));
                    db.Commands[0].Parameters.Add(new Parameter("@syncFlag", SqlDbType.Bit, 0));
                    db.Commands[0].Parameters.Add(new Parameter("@linkID", SqlDbType.VarChar, dtNota.Rows[0]["LinkID"]));
                    db.Commands[0].Parameters.Add(new Parameter("@nPrint", SqlDbType.Int, dtNota.Rows[0]["NPrint"]));
                    db.Commands[0].Parameters.Add(new Parameter("@checker1", SqlDbType.VarChar, cboChecker1.SelectedValue));
                    db.Commands[0].Parameters.Add(new Parameter("@checker2", SqlDbType.VarChar, cboChecker2.SelectedValue));
                    db.Commands[0].Parameters.Add(new Parameter("@transactionType", SqlDbType.VarChar, dtNota.Rows[0]["TransactionType"]));
                    db.Commands[0].Parameters.Add(new Parameter("@hariKredit", SqlDbType.Int, dtNota.Rows[0]["HariKredit"]));
                    db.Commands[0].Parameters.Add(new Parameter("@hariKirim", SqlDbType.Int, dtNota.Rows[0]["HariKirim"]));
                    db.Commands[0].Parameters.Add(new Parameter("@hariSales", SqlDbType.Int, dtNota.Rows[0]["HariSales"]));
                    db.Commands[0].Parameters.Add(new Parameter("@lastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));


                    //db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowID));
                    //db.Commands[0].Parameters.Add(new Parameter("@tglSerahTerimaChecker", SqlDbType.DateTime, txtTglSerahTerima.DateValue));
                    //db.Commands[0].Parameters.Add(new Parameter("@checker1", SqlDbType.VarChar, cboChecker1.SelectedValue));
                    //db.Commands[0].Parameters.Add(new Parameter("@checker2", SqlDbType.VarChar, cboChecker2.SelectedValue));
                    //db.Commands[0].Parameters.Add(new Parameter("@lastupdatedby", SqlDbType.VarChar, SecurityManager.UserID));
                    dt = db.Commands[0].ExecuteDataTable();
                }

                this.DialogResult = DialogResult.OK;
                frmPackingListBrowse frmCaller = (frmPackingListBrowse)this.Caller;
                frmCaller.RefreshDataHeader();
                frmCaller.FindHeader("RowID", _rowID.ToString());
                this.Close();
                frmCaller.Show();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }