private void HeaderSave_Click(object sender, EventArgs e)
        {
            switch (formMode)
            {
            case enumFormMode.New:
                if (InsertHeader())
                {
                    if (this.Caller is frm_kirim)
                    {
                        frm_kirim frmCaller = (frm_kirim)this.Caller;
                        frmCaller.RefreshDataXpdc();
                    }
                    this.Close();
                }
                break;

            case enumFormMode.Update:
                if (UpdateHeader())
                {
                    if (this.Caller is frm_kirim)
                    {
                        frm_kirim frmCaller = (frm_kirim)this.Caller;
                        frmCaller.RefreshDataXpdc();
                    }
                    this.Close();
                }
                break;

                //xpdc.frm_kirim frmCaller = new xpdc.frm_kirim(this,rID);
                //frmCaller.RefreshDataXpdc();
                //frmCaller.FindHeader("RowID", _rowID.ToString());
                //this.Close();
                //frmCaller.Show();
            }
        }
Beispiel #2
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            using (Database db = new Database())
            {
                DataTable dt = new DataTable();
                try
                {
                    db.Commands.Add(db.CreateCommand("usp_PengirimanXpdc_PenyelesaianKirim_UPDATE"));
                    db.Commands[0].Parameters.Add(new Parameter("@rowID", SqlDbType.UniqueIdentifier, _rowID));
                    db.Commands[0].Parameters.Add(new Parameter("@TglKembali", SqlDbType.DateTime, TglKembali.DateValue));
                    db.Commands[0].Parameters.Add(new Parameter("@KMKirim", SqlDbType.Money, KmKembali.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@JamKembali", SqlDbType.VarChar, JamKembali.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@Tarikan", SqlDbType.Money, Tarikan.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@KasBon", SqlDbType.Money, KasBon.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@BBMLtr", SqlDbType.Money, BBMLtr.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@BBMRp", SqlDbType.Money, BBMRp.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@UMSopir", SqlDbType.Money, UMSopir.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@UMKernet", SqlDbType.Money, UMKernet.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@Parkir", SqlDbType.Money, Parkir.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@Tol", SqlDbType.Money, Tol.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@Kuli", SqlDbType.Money, PlusMinus.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@IzinMasuk", SqlDbType.Money, IzinMasuk.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@Timbangan", SqlDbType.Money, Timbangan.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@InTepatWaktu", SqlDbType.Money, InTepatWaktu.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@InPengiriman", SqlDbType.Money, InPengiriman.Text));
                    db.Commands[0].Parameters.Add(new Parameter("@Lain", SqlDbType.Money, Lain.Text));

                    db.Commands[0].ExecuteNonQuery();
                    MessageBox.Show(Messages.Confirm.UpdateSuccess);

                    if (this.Caller is frm_kirim)
                    {
                        frm_kirim frmCaller = (frm_kirim)this.Caller;
                        frmCaller.RefreshDataXpdc();
                    }
                    this.Close();
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    db.RollbackTransaction();
                    MessageBox.Show("Gagal Menyimpan Data");
                }
            }
        }