Пример #1
0
        private void mnuOpenCompany_Click(object sender, EventArgs e)
        {
            frmOpenCmp frm = new frmOpenCmp();

            //frm.MdiParent = this;
            MenuDefault(false);
            DialogResult resultopen = frm.ShowDialog();

            if (resultopen == DialogResult.OK)
            {
                frmLogin     frmlogin = new frmLogin(mnuMain);
                DialogResult result   = frmlogin.ShowDialog();
                if (result == DialogResult.OK)
                {
                    MenuDefault(true);
                    flowTransaction.Controls.Clear();
                    if (clsuserroles.UId != 1 && clsuserroles.UId != 0)
                    {
                        clsuserroles role = new clsuserroles();
                        role.userid = clsuserroles.UId;
                        role.SetMenus(role.userid, mnuMain);

                        role.AddSideMenu(flowTransaction, CallEvent, mnuMain, null, role.userid);
                        mnulogout.Visible   = true;
                        btnhide.Location    = new Point(sidebarmenu.Width, mnuMain.Height);
                        btnhide.Visible     = true;
                        sidebarmenu.Visible = true;
                    }
                    else
                    {
                        clsuserroles role = new clsuserroles();
                        role.AddSideMenu(flowTransaction, CallEvent, mnuMain, null);
                        mnulogout.Visible   = true;
                        btnhide.Location    = new Point(sidebarmenu.Width, mnuMain.Height);
                        btnhide.Visible     = true;
                        sidebarmenu.Visible = true;
                    }
                    SetCompanyInfo();
                    synchronizedata.RunWorkerAsync();
                    synchronizeitemwise.RunWorkerAsync();
                }
                else
                {
                    dboperation.ClearConnection();
                }
            }
            else
            {
                dboperation.ClearConnection();
                SetCompanyInfo(false);
            }
        }
Пример #2
0
        private void mnuRestore_Click(object sender, EventArgs e)
        {
            frmOpenCmp open = new frmOpenCmp();

            open.dlgOpen.Filter = "Back Up(*.bak)|*.bak";
            DialogResult dlg = open.dlgOpen.ShowDialog();

            if (dlg == DialogResult.OK)
            {
                synchronizedata.CancelAsync();
                synchronizeitemwise.CancelAsync();
                clsDBCreator.Restore(open.dlgOpen);
            }
        }