Exemple #1
0
 /// <summary>
 /// Update Field MataUangDasr di semua akun
 /// </summary>
 /// <param name="Dp"></param>
 /// <param name="MataUang"></param>
 public static void SetMataUangDasar(DataPersistance Dp,
                                     string MataUang)
 {
     Dp.ExecuteNonQuery(string.Concat(
                            "UPDATE Akun SET MataUangDasar=",
                            Dp.FormatSqlValue(false, DataType.Boolean),
                            " WHERE MataUangDasar=",
                            Dp.FormatSqlValue(true, DataType.Boolean)));
     Dp.ExecuteNonQuery(string.Concat(
                            "UPDATE Akun SET MataUangDasar=",
                            Dp.FormatSqlValue(true, DataType.Boolean),
                            " WHERE KodeMataUang=@0"),
                        new FieldParam("0", MataUang));
 }
        public static void ClearLog()
        {
            TableDef        td = MetaData.GetTableDef <UserLog>();
            DataPersistance Dp = td.GetDataPersistance(BaseFramework.GetDefaultDp());

            Dp.ValidateTableDef <UserLog>();
            Dp.ExecuteNonQuery("DELETE FROM _System_UserLog");
        }
Exemple #3
0
 /// <summary>
 /// Tambahkan jumlah counter pengunci pada akun
 /// </summary>
 /// <param name="Dp"></param>
 /// <param name="IdAkun"></param>
 public static void TambahJmlPengunci(DataPersistance Dp,
                                      string IdAkun)
 {
     Dp.ExecuteNonQuery(string.Concat(
                            "UPDATE Akun SET Terkunci=",
                            Dp.FormatSqlValue(true, DataType.Boolean),
                            ",JmlPengunci=JmlPengunci+1 WHERE IdAkun=@0"),
                        new FieldParam("0", IdAkun));
 }
        public static void CheckAutoClearLog()
        {
            TableDef        td = MetaData.GetTableDef <UserLog>();
            DataPersistance Dp = td.GetDataPersistance(BaseFramework.GetDefaultDp());

            Dp.ValidateTableDef <UserLog>();
            Dp.ExecuteNonQuery("DELETE FROM _System_UserLog WHERE LogTime<@0",
                               new FieldParam("0", DateTime.Today.AddMonths(-LogAge)));
        }
Exemple #5
0
 /// <summary>
 /// Kurangi jumlah counter pengunci pada akun
 /// </summary>
 /// <param name="Dp"></param>
 /// <param name="IdAkun"></param>
 public static void KurangiJmlPengunci(DataPersistance Dp,
                                       string IdAkun)
 {
     Dp.ExecuteNonQuery(string.Concat(
                            "UPDATE Akun SET JmlPengunci=",
                            Dp.GetSqlIifNoFormat("JmlPengunci<2", "0",
                                                 "JmlPengunci-1"), ",Terkunci=",
                            Dp.GetSqlIif("JmlPengunci>0", true, false),
                            " WHERE IdAkun=@0"),
                        new FieldParam("0", IdAkun));
 }
        public static void Hapus(DataPersistance Dp, string JenisDokSumber,
                                 string NoDokSumber)
        {
            Jurnal Jr = new Jurnal();

            if (Jr.FastLoadEntity(
                    "NoJurnal,TglJurnal,BuatJurnalPembalik,NoJurnalPembalik,TglDibalik",
                    "JenisDokSumber=@jds AND NoDokSumber=@nds",
                    new FieldParam("jds", JenisDokSumber),
                    new FieldParam("nds", NoDokSumber)))
            {
                FieldParam ParamNoJurnal = new FieldParam("0", Jr._NoJurnal);
                using (EntityTransaction tr = new EntityTransaction(Dp))
                {
                    Dp.ExecuteNonQuery(
                        "DELETE FROM Jurnal WHERE NoJurnal=@0",
                        ParamNoJurnal);
                    Dp.ExecuteNonQuery(
                        "DELETE FROM JurnalDetil WHERE NoJurnal=@0",
                        ParamNoJurnal);
                    if (Jr.BuatJurnalPembalik &&
                        Jr._NoJurnalPembalik.Length > 0)
                    {
                        ParamNoJurnal.Value = Jr._NoJurnalPembalik;
                        Dp.ExecuteNonQuery(
                            "DELETE FROM Jurnal WHERE NoJurnal=@0",
                            ParamNoJurnal);
                        Dp.ExecuteNonQuery(
                            "DELETE FROM JurnalDetil WHERE NoJurnal=@0",
                            ParamNoJurnal);
                        if (Jr._TglDibalik < Jr._TglJurnal)
                        {
                            Jr._TglJurnal = Jr._TglDibalik;
                        }
                    }
                    BaseGL.RingkasanAkun.Hapus(Jr._TglJurnal);

                    tr.CommitTransaction();
                }
            }
        }
Exemple #7
0
        public static void Hapus(DataPersistance Dp, string NoPengeluaranKas)
        {
            FieldParam ParamNoPengeluaranKas = new FieldParam("0", NoPengeluaranKas);
            string     NoJurnal = Jurnal.CariNoJurnal(Dp, ModuleName, NoPengeluaranKas);

            using (EntityTransaction tr = new EntityTransaction(Dp))
            {
                if (NoJurnal.Length > 0)
                {
                    Jurnal.Hapus(Dp, NoJurnal);
                }

                Dp.ExecuteNonQuery(
                    "DELETE FROM PengeluaranKasUmum WHERE NoPengeluaranKas=@0",
                    ParamNoPengeluaranKas);
                Dp.ExecuteNonQuery(
                    "DELETE FROM PengeluaranKasUmumDetil WHERE NoPengeluaranKas=@0",
                    ParamNoPengeluaranKas);

                tr.CommitTransaction();
            }
        }
Exemple #8
0
        public void DoAfterSendToPrinter()
        {
            TableDef td = MetaData.GetTableDef(_DataSource.GetType());

            if (td.fldPrintCounter != null)
            {
                DataPersistance Dp      = _DataSource.Dp;
                string          strTemp = string.Empty;
                FieldParam[]    fps     = new FieldParam[td.KeyFields.Count];
                int             Ctr     = 0;
                foreach (FieldDef fld in td.KeyFields.Values)
                {
                    strTemp  = string.Concat(strTemp, " AND ", fld.FieldName, "=@", Ctr);
                    fps[Ctr] = new FieldParam(Ctr.ToString(), fld, fld.GetValue(_DataSource));
                }
                strTemp = strTemp.Substring(5);
                Dp.ExecuteNonQuery(string.Concat("UPDATE ",
                                                 td.TableName, " SET ", td.fldPrintCounter.FieldName,
                                                 "=", td.fldPrintCounter.FieldName, "+1 WHERE ", strTemp), fps);
            }
            ((IBaseEntity)_DataSource).DoAfterSendToPrinter();
        }
        //Backup
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();
            string LastBackupFolder = CurrDp.GetVariable <string>("System",
                                                                  "LastBackupFolder", string.Empty);

            fbd.SelectedPath = LastBackupFolder;
            fbd.Description  = "Pilih Folder yang digunakan untuk membackup Database :";
            if (fbd.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            CurrDp.SetVariable("System", "LastBackupFolder", fbd.SelectedPath);

            Type EngineType = BaseFramework.DpEngine.DictEngine[comboBoxEdit1.Text];

            if (EngineType.Equals(typeof(SqlServerPersistance)))
            {
                string FileName = string.Concat(fbd.SelectedPath, "\\",
                                                ((SqlServerPersistance)CurrDp).DatabaseName,
                                                "_", DateTime.Today.ToString("yyyy_MM_dd"), ".bak");

                if (File.Exists(FileName))
                {
                    XtraMessageBox.Show(string.Concat(
                                            "File Tujuan Backup '", FileName,
                                            "' sudah ada. Hapus File tersebut untuk melanjutkan !"),
                                        "Error Backup Database",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    return;
                }

                try
                {
                    using (new FormWaitCursor())
                    {
                        CurrDp.ExecuteNonQuery(string.Concat(
                                                   "BACKUP DATABASE [",
                                                   ((SqlServerPersistance)CurrDp).DatabaseName,
                                                   "] TO DISK = '", FileName, "'"));
                    }
                    XtraMessageBox.Show(string.Concat(
                                            "Backup Database ",
                                            ((SqlServerPersistance)CurrDp).DatabaseName,
                                            " telah sukses dilakukan di File '", FileName,
                                            "' !"), "Konfirmasi Backup Database",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show(ex.Message, "Error Backup Database",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                XtraMessageBox.Show("Backup untuk database " + comboBoxEdit1.Text + "belum didukung !",
                                    "Konfirmasi Backup Database", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
            }
        }