Example #1
0
 public NewMachinesPermitForm(Form tMainForm, ref NewMachinePermit tNewPermit)
 {
     MainForm  = tMainForm;
     NewPermit = tNewPermit;
     InitializeComponent();
     Initialize();
 }
        private void btnCreatePermit_Click(object sender, EventArgs e)
        {
            NewPermit = new Modules.Permits.NewMachinePermit();
            PhantomForm PhantomForm = new Infinium.PhantomForm();

            PhantomForm.Show();

            NewMachinesPermitForm NewPermitForm = new NewMachinesPermitForm(this, ref NewPermit);

            TopForm = NewPermitForm;
            NewPermitForm.ShowDialog();

            PhantomForm.Close();
            PhantomForm.Dispose();
            NewPermitForm.Dispose();
            TopForm = null;

            if (!NewPermit.bCreatePermit)
            {
                return;
            }
            Thread T = new Thread(delegate() { SplashWindow.CreateSmallSplash(ref TopForm, "Загрузка данных с сервера.\r\nПодождите..."); });

            T.Start();

            while (!SplashWindow.bSmallCreated)
            {
                ;
            }
            NeedSplash = false;

            PermitsManager.NewPermit(NewPermit.VisitorName, NewPermit.VisitMission, NewPermit.Validity);

            PermitsManager.SendApproveNotifications(iApprovedRole);
            PermitsManager.SavePermits();
            UpdatePermitDates();

            NeedSplash = true;
            while (SplashWindow.bSmallCreated)
            {
                SmallWaitForm.CloseS = true;
            }
            InfiniumTips.ShowTip(this, 50, 85, "Пропуск создан", 1700);
        }