Esempio n. 1
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (PeriodeClosing.IsPJTClosed(dTxtTMT.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_HistoryTargetCollector_INSERT"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@CollID", SqlDbType.VarChar, txtKdColl.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@TglAktif", SqlDbType.Date, dTxtTMT.DateValue.Value));
                        db.Commands[0].Parameters.Add(new Parameter("@Tagih", SqlDbType.Int, nTxtTagih.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Kunjungan", SqlDbType.Int, nTxtKunj.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Nominal", SqlDbType.Int, nTxtNominal.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_HistoryTargetCollector_UPDATE"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@CollID", SqlDbType.VarChar, txtKdColl.Text));
                        db.Commands[0].Parameters.Add(new Parameter("@TglAktif", SqlDbType.Date, dTxtTMT.DateValue.Value));
                        db.Commands[0].Parameters.Add(new Parameter("@Tagih", SqlDbType.Int, nTxtTagih.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Kunjungan", SqlDbType.Int, nTxtKunj.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@Nominal", SqlDbType.Int, nTxtNominal.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;
                }
                frmTargetCollector frm = new frmTargetCollector();
                frm = (frmTargetCollector)Caller;
                frm.BindData();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
Esempio n. 2
0
 private void frmTargetCollectorUpdate_FormClosing(object sender, FormClosingEventArgs e)
 {
     {
         if (this.DialogResult == DialogResult.OK)
         {
             if (this.Caller is frmTargetCollector)
             {
                 frmTargetCollector frmCaller = (frmTargetCollector)this.Caller;
                 frmCaller.RefreshBrowse1(_rowID.ToString());
                 frmCaller.FindBrowse1("colrowID", _rowID.ToString());
             }
         }
     }
 }