Esempio n. 1
0
 private void frmTargetSalesUpdate_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (this.DialogResult == DialogResult.OK)
     {
         if (this.Caller is frmTargetSales)
         {
             frmTargetSales frmCaller = (frmTargetSales)this.Caller;
             frmCaller.RefreshBrowse1(_rowID.ToString());
             frmCaller.FindBrowse1("colrowID", _rowID.ToString());
         }
     }
 }
Esempio n. 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_HistoryTargetSales_INSERT"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@SalesID", SqlDbType.VarChar, lookupSales1.SalesID));
                        db.Commands[0].Parameters.Add(new Parameter("@TglAktif", SqlDbType.Date, dateTMT.DateValue.Value));
                        db.Commands[0].Parameters.Add(new Parameter("@SKU", SqlDbType.Int, txtSkuR2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@OmsetNetto", SqlDbType.Int, txtOmsetNetto.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@OrderAktif", SqlDbType.Int, txtOrdAktif.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_HistoryTargetSales_UPDATE"));
                        db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, _rowID));
                        db.Commands[0].Parameters.Add(new Parameter("@SalesID", SqlDbType.VarChar, lookupSales1.SalesID));
                        db.Commands[0].Parameters.Add(new Parameter("@TglAktif", SqlDbType.Date, dateTMT.DateValue.Value));
                        db.Commands[0].Parameters.Add(new Parameter("@SKU", SqlDbType.Int, txtSkuR2.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@OmsetNetto", SqlDbType.Int, txtOmsetNetto.GetIntValue));
                        db.Commands[0].Parameters.Add(new Parameter("@OrderAktif", SqlDbType.Int, txtOrdAktif.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;
                }
                frmTargetSales frm = new frmTargetSales();
                frm = (frmTargetSales)Caller;
                frm.BindData();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }