private void ShowDesigners()
 {
     try
     {
         //showDummy();
         MdiChild designers = new MdiChild();
         designers.Title = ApplicationTitle + " - Reports Designer";
         ProcessDesigner.frmflxReports flxReports = new ProcessDesigner.frmflxReports(_userInformation, designers, StartDate, EndDate);
         designers.Content     = flxReports;
         designers.Height      = flxReports.Height + 40;
         designers.Width       = flxReports.Width + 20;
         designers.MinimizeBox = true;
         designers.MaximizeBox = true;
         designers.Resizable   = false;
         if (MainMDI.IsFormAlreadyOpen("Reports Designer") == false)
         {
             MainMDI.Container.Children.Add(designers);
         }
         else
         {
             designers = new MdiChild();
             designers = (MdiChild)MainMDI.GetFormAlreadyOpened("Reports Designer");
             MainMDI.SetMDI(designers);
         }
     }
     catch (Exception ex)
     {
         throw ex.LogException();
     }
 }
示例#2
0
文件: Login.cs 项目: zep2zep/Compas
        /// <summary>
        /// При успішній перевірці логіна і пароля створюється КОНТЕКСТ БЕЗПЕКИ
        /// КОНТЕКСТ БЕЗПЕКИ зберігається в AppDomain.CurrentDomain в змінну "SecurityContext",
        /// до якого мають доступ всі внутрішні проекти
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveBt_Click(object sender, EventArgs e)
        {
            string hash  = "";
            string login = LoginTB.Text;

            CompasLogger.Add(String.Format("Try to login: {0}", login), CompasLogger.Level.Info);
            hash = Helpers.Crypto.sha512encrypt(PasswordTB.Text + login);
            CompasLogger.Add(String.Format("Generated HASH"), CompasLogger.Level.Info);
            Compas.Logic.Security.CompasIdentity identity = new Compas.Logic.Security.CompasIdentity(login, hash);
            CompasLogger.Add(String.Format("Identity class created"), CompasLogger.Level.Info);
            CompasPrincipal principal = new CompasPrincipal(identity);

            AppDomain.CurrentDomain.SetData("Mode", ((Helpers.Item)(ModeCB.SelectedItem)).ID);
            CompasLogger.Add(String.Format("Mode saved: {0}", ((Helpers.Item)(ModeCB.SelectedItem)).Name), CompasLogger.Level.Info);
            if (login != "romin")
            {
                if (identity.IsAuthenticated == true)
                {
                    CompasLogger.Add(String.Format("Success login: {0}", login), CompasLogger.Level.Info);
                    CompasSecurityContext context = new CompasSecurityContext(identity, principal);
                    AppDomain.CurrentDomain.SetData("SecurityContext", context);
                    AppDomain.CurrentDomain.SetData("Mode", ((Helpers.Item)(ModeCB.SelectedItem)).ID);

                    //символьне значення
                    AppDomain.CurrentDomain.SetData("InstallationID", Compas.Logic.Config.InstallationIdentifyLogic.GenerateInstallationID());
                    //числове значення
                    AppDomain.CurrentDomain.SetData("InstallationIDInt", Compas.Logic.Config.InstallationIdentifyLogic.InstallationIDInt);
                    MainMDI form = new MainMDI();
                    this.Visible    = false;
                    PasswordTB.Text = "";
                    LoginTB.Text    = "";
                    this.Visible    = false;
                    form.ShowDialog();
                    this.Close();
                }
                else
                {
                    CompasLogger.Add(String.Format("Fail login: {0}", login), CompasLogger.Level.Warn);
                    MessageBox.Show("Не знайдено користувача з вказаним логіном і паролем");
                }
            }
            else
            {
                CompasSecurityContext context = new CompasSecurityContext(identity, principal);
                AppDomain.CurrentDomain.SetData("SecurityContext", context);



                //installationLogic.ClearInstallationID();
                CompasLogger.Add("Генерація ідентифікатора", CompasLogger.Level.Info);
                //Compas.Logic.Configuration.InstallationIdentifyLogic.ClearInstallationID();
                //символьне значення
                AppDomain.CurrentDomain.SetData("InstallationID", Compas.Logic.Config.InstallationIdentifyLogic.GenerateInstallationID());
                //числове значення
                AppDomain.CurrentDomain.SetData("InstallationIDInt", Compas.Logic.Config.InstallationIdentifyLogic.InstallationIDInt);
                MainMDI form = new MainMDI();
                this.Visible    = false;
                PasswordTB.Text = "";
                LoginTB.Text    = "";
                this.Visible    = false;

                form.ShowDialog();
                this.Close();
            }
        }
示例#3
0
        public void ModifyUsers(DataRowView selecteditem)
        {
            try
            {
                //if (selecteditem != null && calledfromparentform.IsNotNullOrEmpty() && calledfromparentform == "MainWindow")
                //{
                //    Window win = new Window();
                //    IconBitmapDecoder ibd = new IconBitmapDecoder(new Uri(@"pack://application:,,/Images/logo.ico", UriKind.RelativeOrAbsolute), BitmapCreateOptions.None, BitmapCacheOption.Default);
                //    win.Title = ApplicationTitle + " - " + "Cost Sheet Preparation";
                //    win.Icon = ibd.Frames[0];
                //    win.ResizeMode = ResizeMode.NoResize;
                //    CI_INFO_PK = selecteditem["CI_INFO_PK"].ToValueAsString().ToIntValue();
                //    System.Windows.Controls.UserControl userControl = new ProcessDesigner.frmFRCS(_userInformation, win, CI_INFO_PK, OperationMode.Edit);
                //    win.Content = userControl;
                //    win.Height = userControl.Height + 50;
                //    win.Width = userControl.Width + 10;
                //    win.ShowInTaskbar = false;
                //    win.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                //    win.ShowDialog();
                //}
                //else if (selecteditem != null && calledfromparentform.IsNotNullOrEmpty() && calledfromparentform == "frmFRCS")
                //{
                //    CI_INFO_PK = selecteditem["CI_INFO_PK"].ToValueAsString().ToIntValue();
                //    CloseAction();
                //}

                if (selecteditem == null)
                {
                    return;
                }

                MdiChild mdiCostSheet = new MdiChild();
                if (MainMDI.IsFormAlreadyOpen("Cost Sheet Preparation") == true)
                {
                    mdiCostSheet = (MdiChild)MainMDI.GetFormAlreadyOpened("Cost Sheet Preparation");
                    mdiCostSheet.Close();
                }
                CI_INFO_PK = selecteditem["CI_INFO_PK"].ToValueAsString().ToIntValue();
                ProcessDesigner.frmFRCS userControl = new ProcessDesigner.frmFRCS(_userInformation, mdiCostSheet, CI_INFO_PK, OperationMode.Edit);
                //frmCostSheetSearch frmCostSheetSearch = new frmCostSheetSearch(_userInformation, mdiCostSheetSearch, ActiveEntity.IDPK, OperationMode.View, "frmFRCS");
                mdiCostSheet.Title       = ApplicationTitle + " - Cost Sheet Preparation";
                mdiCostSheet.Content     = userControl;
                mdiCostSheet.Height      = userControl.Height + 40;
                mdiCostSheet.Width       = userControl.Width + 20;
                mdiCostSheet.MinimizeBox = true;
                mdiCostSheet.MaximizeBox = true;
                mdiCostSheet.Resizable   = false;
                MainMDI.Container.Children.Add(mdiCostSheet);
                //}
                //else
                //{
                //    mdiCostSheet = (MdiChild)MainMDI.GetFormAlreadyOpened("Cost Sheet Preparation");
                //    //toolschedule = (frmToolSchedule_new)mdiCostSheetSearch.Content;
                //    MainMDI.SetMDI(mdiCostSheet);
                //}
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }
        }