Exemple #1
0
 private void frmTargetKotaUpdate_FormClosing(object sender, FormClosingEventArgs e)
 {
     {
         if (this.DialogResult == DialogResult.OK)
         {
             if (this.Caller is frmTargetKotaBrowse)
             {
                 frmTargetKotaBrowse frmCaller = (frmTargetKotaBrowse)this.Caller;
                 frmCaller.RefreshBrowse1(_rowID.ToString());
                 frmCaller.FindBrowse1("colrowID", _rowID.ToString());
             }
         }
     }
 }
Exemple #2
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (PeriodeClosing.IsPJTClosed(dateTMT.DateValue.Value))
            {
                MessageBox.Show("Periode Tanggal Sudah Closing");
                return;
            }

            try
            {
                string cGudang = GlobalVar.Gudang;
                switch (formMode)
                {
                case enumFormMode.New:

                    using (Database db = new Database())
                    {
                        _rowID = Guid.NewGuid();
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_HistoryTargetKota_INSERT"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@Kota", SqlDbType.VarChar, txtKota.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@TglAktif", SqlDbType.Date, dateTMT.DateValue.Value));
                        db.Commands[0].Parameters.Add(new Parameter("@KodeGudang", SqlDbType.VarChar, cGudang));
                        db.Commands[0].Parameters.Add(new Parameter("@SKUR2", SqlDbType.Int, txtSkuR2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SKUR4", SqlDbType.Int, txtSkuR4.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SKULain", SqlDbType.Int, txtSkuLain.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFE2", SqlDbType.Money, txtNomFE2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFB2", SqlDbType.Money, txtNomFB2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFE4", SqlDbType.Money, txtNomFE4.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFB4", SqlDbType.Money, txtNomFB4.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFA", SqlDbType.Money, txtNomFA.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFLain", SqlDbType.Money, txtNomFLain.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@OrderAktif", SqlDbType.Int, txtOrdAktif.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Kunjungan", SqlDbType.Int, txtKunjHarian.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SyncFlag", SqlDbType.VarChar, 0));
                        db.Commands[0].Parameters.Add(new Parameter("@lastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        dt = db.Commands[0].ExecuteDataTable();
                    }
                    break;

                case enumFormMode.Update:
                    using (Database db = new Database())
                    {
                        DataTable dt = new DataTable();
                        db.Commands.Add(db.CreateCommand("usp_HistoryTargetKota_UPDATE"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@Kota", SqlDbType.VarChar, txtKota.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@TglAktif", SqlDbType.Date, dateTMT.DateValue.Value));
                        db.Commands[0].Parameters.Add(new Parameter("@KodeGudang", SqlDbType.VarChar, cGudang));
                        db.Commands[0].Parameters.Add(new Parameter("@SKUR2", SqlDbType.Int, txtSkuR2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SKUR4", SqlDbType.Int, txtSkuR4.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SKULain", SqlDbType.Int, txtSkuLain.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFE2", SqlDbType.Money, txtNomFE2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFB2", SqlDbType.Money, txtNomFB2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFE4", SqlDbType.Money, txtNomFE4.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFB4", SqlDbType.Money, txtNomFB4.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFA", SqlDbType.Money, txtNomFA.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@NomFLain", SqlDbType.Money, txtNomFLain.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@OrderAktif", SqlDbType.Int, txtOrdAktif.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Kunjungan", SqlDbType.Int, txtKunjHarian.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@SyncFlag", SqlDbType.VarChar, 0));
                        db.Commands[0].Parameters.Add(new Parameter("@lastUpdatedBy", SqlDbType.VarChar, SecurityManager.UserID));
                        db.Commands[0].ExecuteNonQuery();
                    }
                    break;
                }
                frmTargetKotaBrowse frm = new frmTargetKotaBrowse();
                frm = (frmTargetKotaBrowse)Caller;
                frm.BindData();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }