public void UpdateDocumentVariable(string RoleName,
                                           string ModuleName, string VariableName,
                                           string DocumentName, List <string> ListDocKey)
        {
            RoleModuleDocument rmd = new RoleModuleDocument();

            rmd.Dp           = _LoginObj.Dp;
            rmd.ProductName  = BaseFramework.ProductName;
            rmd.RoleName     = RoleName;
            rmd.ModuleName   = ModuleName;
            rmd.VariableName = VariableName;
            rmd.DocumentName = DocumentName;

            using (EntityTransaction tr = new EntityTransaction(rmd.Dp))
            {
                _LoginObj.Dp.ExecuteNonQuery(@"DELETE FROM 
                    _System_RoleModuleDocument WHERE RoleName=@0 AND ModuleName=@1 AND 
                    VariableName=@2 AND ProductName=@3",
                                             new FieldParam("0", RoleName),
                                             new FieldParam("1", ModuleName),
                                             new FieldParam("2", VariableName),
                                             new FieldParam("3", BaseFramework.ProductName));
                foreach (string DocumentKey in ListDocKey)
                {
                    rmd.DocumentKey = DocumentKey;
                    rmd.SaveNew();
                }
                tr.CommitTransaction();
            }
        }
        public bool TransferData()
        {
            TableVersion tv = new TableVersion();

            using (EntityTransaction Tr = 
                new EntityTransaction(DpDestination)) 
            {
                foreach (TableTransfer tbl in ListTable) 
                {
                    tv.TableName= tbl.TableName;
                    DpSource.LoadEntity(tv, false);

                    TransferTable(new TableDef(tbl.TableName, tv.CreateStr),
                        tbl.Condition);
                }
                foreach (TypeTransfer typ in ListObjectType)
                {
                    TableDef td = MetaData.GetTableDef(typ.ObjectType);
                    TransferTable(td, typ.Condition);
                    foreach (EntityCollDef ecd in td.ChildEntities)
                        TransferTable(MetaData.GetTableDef(ecd.ChildType), 
                            typ.Condition);
                }
                Tr.CommitTransaction();
            }
            return true;
        }
Example #3
0
        static void CurrentLogin_onLogon()
        {
            RingkasanAkun = new RingkasanAkun();

            using (EntityTransaction tr = new EntityTransaction(
                       BaseFramework.DefaultDp))
            {
                if (!BaseFramework.DefaultDp.Find
                    .IsExists <MataUang>(string.Empty))
                {
                    MataUang mu = new MataUang();
                    mu.KodeMataUang = "IDR";
                    mu.NamaMataUang = "Rupiah";
                    mu.Aktif        = true;
                    mu.SaveNew();
                }
                if (!BaseFramework.DefaultDp.Find
                    .IsExists <JenisDokSumberJurnal>("Otomatis=@0",
                                                     new FieldParam("0", false)))
                {
                    JenisDokSumberJurnal jds = new JenisDokSumberJurnal();
                    jds.JenisDokSumber = "Umum";
                    jds.Aktif          = true;
                    jds.SaveNew();
                }

                if (!BaseFramework.DefaultDp.Find
                    .IsExists <SetingPerusahaan>(string.Empty))
                {
                    SetingPerusahaan sp = new SetingPerusahaan();
                    sp.SetDefaultValue();
                    sp.TglMulaiSistemBaru = BaseFramework
                                            .TransDate.StartDate;
                    sp.SaveNew();
                }

                tr.CommitTransaction();
            }
            SetingPerusahaan.LoadEntity();
            RegisterAsPostedDocument("Penerimaan Kas Umum");
            RegisterAsPostedDocument("Pengeluaran Kas Umum");
            RegisterAsPostedDocument("Transfer Antar Kas");
        }
Example #4
0
        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();
                }
            }
        }
Example #5
0
 internal static void SetVariables(DataPersistance dp,
                                   AppVariables Vars)
 {
     using (EntityTransaction tr = new EntityTransaction(dp))
     {
         foreach (AppVariable Var in Vars.ListVar)
         {
             if (Var.BinValue == null)
             {
                 SetVariable(dp, Var.ModuleName,
                             Var.VarName, Var.VarValue);
             }
             else
             {
                 SetVariable(dp, Var.ModuleName,
                             Var.VarName, Var.BinValue);
             }
         }
         tr.CommitTransaction();
     }
 }
Example #6
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();
            }
        }
        private void simpleButton6_Click(object sender, EventArgs e)
        {
            if (sender != null)
            {
                textEdit4.Focus();
            }
            try
            {
                using (EntityTransaction tr =
                           new EntityTransaction(BaseWinSecurity.DataPersistance))
                {
                    if (simpleButton3.Enabled == false) // Peran Baru
                    {
                        string RoleName = textEdit4.Text;
                        BaseSecurity.CurrentLogin.Admin.Role.Add(RoleName,
                                                                 checkEdit4.Checked, checkEdit5.Checked,
                                                                 dateEdit4.DateTime, dateEdit3.DateTime);

                        string SelUser    = listBoxControl1.Text;
                        bool   AddSelUser = false;

                        BaseSecurity.CurrentLogin.Admin.RoleUser.DeleteRole(RoleName);
                        foreach (UserSelection us in ListUser)
                        {
                            if (us.Select)
                            {
                                if (us.UserName == SelUser)
                                {
                                    AddSelUser = true;
                                }
                                BaseSecurity.CurrentLogin.Admin.RoleUser.Add(
                                    RoleName, us.UserName);
                            }
                        }
                        foreach (clsModule mdl in ListModule.Values)
                        {
                            BaseSecurity.CurrentLogin.Admin
                            .RoleModule.Add(RoleName,
                                            mdl.Ma.ModuleName,
                                            BaseUtility.Dictionary2String(
                                                mdl.Ma.Variables), mdl.AllDocumentData);
                            foreach (ModuleDataField mdf in mdl.Ma.ListDataField)
                            {
                                BaseSecurity.CurrentLogin.Admin
                                .RoleModule.UpdateDocumentVariable(
                                    RoleName, mdl.Ma.ModuleName,
                                    mdf.DataFieldName, mdf.DocumentName,
                                    mdl.ListKey[mdf.DataFieldName]);
                            }
                        }

                        RoleSelection rs = new RoleSelection(RoleName);
                        if (AddSelUser)
                        {
                            rs.Select = true;
                        }
                        ListRole.Add(rs);
                        PeranGrid.RefreshDataSource();
                        OnAddRole = true;
                        try
                        {
                            listBoxControl2.Items.Add(RoleName);
                        }
                        finally
                        {
                            OnAddRole = false;
                        }
                        //Peran Baru...
                        if (sender != null)
                        {
                            simpleButton4_Click(null, null);
                        }
                    }
                    else // Peran Lama
                    {
                        string RoleName = textEdit4.Text;
                        BaseSecurity.CurrentLogin.Admin.RoleUser.DeleteRole(CurrentRole);

                        BaseSecurity.CurrentLogin.Admin.Role.Update(CurrentRole,
                                                                    RoleName, checkEdit4.Checked, checkEdit5.Checked,
                                                                    dateEdit4.DateTime, dateEdit3.DateTime);

                        string SelUser       = listBoxControl1.Text;
                        bool   UpdateSelUser = false;

                        foreach (UserSelection us in ListUser)
                        {
                            if (us.Select)
                            {
                                if (us.UserName == SelUser)
                                {
                                    UpdateSelUser = true;
                                }
                                BaseSecurity.CurrentLogin.Admin.RoleUser.Add(
                                    RoleName, us.UserName);
                            }
                        }

                        foreach (RoleSelection rs in ListRole)
                        {
                            if (rs.RoleName == CurrentRole)
                            {
                                rs.Select   = UpdateSelUser;
                                rs.RoleName = RoleName;
                                break;
                            }
                        }
                        foreach (clsModule mdl in ListModule.Values)
                        {
                            string newSecurityData = BaseUtility.Dictionary2String(
                                mdl.Ma.Variables);

                            BaseSecurity.CurrentLogin.Admin
                            .RoleModule.Update(RoleName,
                                               mdl.Ma.ModuleName, newSecurityData, mdl.AllDocumentData);

                            foreach (ModuleDataField mdf in mdl.Ma.ListDataField)
                            {
                                BaseSecurity.CurrentLogin.Admin
                                .RoleModule.UpdateDocumentVariable(
                                    RoleName, mdl.Ma.ModuleName,
                                    mdf.DataFieldName, mdf.DocumentName,
                                    mdl.ListKey[mdf.DataFieldName]);
                            }
                        }

                        PeranGrid.RefreshDataSource();

                        if (CurrentRole != RoleName)
                        {
                            listBoxControl2.Items[listBoxControl2.SelectedIndex] = RoleName;
                        }

                        CurrentRole = RoleName;
                        textEdit4.Focus();
                    }
                    tr.CommitTransaction();
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Error Simpan Peran",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void simpleButton5_Click(object sender, EventArgs e)
        {
            textEdit1.Focus();
            try
            {
                using (EntityTransaction tr =
                           new EntityTransaction(BaseWinSecurity.DataPersistance))
                {
                    if (simpleButton2.Enabled == false) // User Baru
                    {
                        string UserName = textEdit1.Text;
                        BaseSecurity.CurrentLogin.Admin.User.Add(UserName,
                                                                 buttonEdit1.Text, checkEdit1.Checked, checkEdit2.Checked,
                                                                 checkEdit3.Checked, dateEdit1.DateTime, dateEdit2.DateTime);

                        string SelRole    = listBoxControl2.Text;
                        bool   AddSelRole = false;

                        BaseSecurity.CurrentLogin.Admin.RoleUser.DeleteUser(UserName);
                        foreach (RoleSelection r in ListRole)
                        {
                            if (r.Select)
                            {
                                if (r.RoleName == SelRole)
                                {
                                    AddSelRole = true;
                                }
                                BaseSecurity.CurrentLogin.Admin.RoleUser.Add(
                                    r.RoleName, UserName);
                            }
                        }

                        UserSelection s = new UserSelection(UserName);
                        if (AddSelRole)
                        {
                            s.Select = true;
                        }
                        ListUser.Add(s);
                        UserGrid.RefreshDataSource();
                        OnAddUser = true;
                        listBoxControl1.Items.Add(UserName);
                        OnAddUser = false;
                        simpleButton1_Click(null, null);
                    }
                    else // User Lama
                    {
                        string UserName = textEdit1.Text;
                        BaseSecurity.CurrentLogin.Admin.RoleUser.DeleteUser(CurrentUser);

                        BaseSecurity.CurrentLogin.Admin.User.Update(CurrentUser,
                                                                    UserName, checkEdit1.Checked, checkEdit2.Checked,
                                                                    checkEdit3.Checked, dateEdit1.DateTime, dateEdit2.DateTime);

                        string SelRole       = listBoxControl2.Text;
                        bool   UpdateSelRole = false;

                        foreach (RoleSelection r in ListRole)
                        {
                            if (r.Select)
                            {
                                if (r.RoleName == SelRole)
                                {
                                    UpdateSelRole = true;
                                }
                                BaseSecurity.CurrentLogin.Admin.RoleUser.Add(
                                    r.RoleName, UserName);
                            }
                        }

                        foreach (UserSelection s in ListUser)
                        {
                            if (s.UserName == CurrentUser)
                            {
                                s.Select   = UpdateSelRole;
                                s.UserName = UserName;
                                break;
                            }
                        }
                        UserGrid.RefreshDataSource();

                        if (CurrentUser != UserName)
                        {
                            listBoxControl1.Items[listBoxControl1.SelectedIndex] = UserName;
                        }

                        CurrentUser = UserName;
                        textEdit1.Focus();
                    }
                    tr.CommitTransaction();
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Error Simpan User",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }