示例#1
0
 private void интерфейсМедикаToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (UserStatus == "medic")
     {
         Medic medic = new Medic();      //Окрытие интерфейса медика
         ShowChildForm(medic, this);
     }
 }
示例#2
0
        private void Main_Load(object sender, EventArgs e)
        {
            Autorizate autorizate = new Autorizate();

            autorizate.ShowDialog();

            FbConnectionStringBuilder sb = new FbConnectionStringBuilder(Properties.Settings.Default.TaxiConnectionString);

            sb.UserID   = autorizate.UserID;
            sb.Password = autorizate.Password;
            sb.Role     = Convert.ToString(autorizate.Role);
            Properties.Settings.Default["TaxiConnectionString"] = sb.ConnectionString;          //Замена параметров в connectionstring
            FbConnection test = new FbConnection(sb.ToString());

            try
            {
                //string role = "operator";       //UTF8 -> win1251
                if (sb.Role == "admins")        ///-----
                {
                    test.Open();
                    test.Close();
                    Admin medic = new Admin();      //Окрытие интерфейса admin
                    ShowChildForm(medic, this);
                    AutorizateStatus = true;
                    UserStatus       = "admin";
                }
                else if (sb.Role == "operator")        ///-----
                {
                    test.Open();
                    test.Close();
                    newMdiChild = new Operator();      //Окрытие интерфейса оператора
                    ShowChildForm(newMdiChild, this);
                    AutorizateStatus = true;
                    UserStatus       = "operator";
                }
                else if (sb.Role == "medic")
                {
                    test.Open();
                    test.Close();
                    Medic newMdiChild = new Medic();      //Окрытие интерфейса медика
                    ShowChildForm(newMdiChild, this);
                    AutorizateStatus = true;
                    UserStatus       = "medic";
                }
                else if (sb.Role == "technic")
                {
                    test.Open();
                    test.Close();
                    Technic newMdiChild = new Technic();
                    ShowChildForm(newMdiChild, this);
                    AutorizateStatus = true;
                    UserStatus       = "technic";
                }
            }
            catch (Exception ex)
            {
                SpVoiceClass voice = new SpVoiceClass();
                string       str   = "Перелогиньтесь";
                voice.Speak(str, SpeechVoiceSpeakFlags.SVSFlagsAsync);
                MessageBox.Show(str + ". " + ex.Message);
            }
        }