Example #1
0
 public AdminForm(User S)
 {
     SesUs = S;
     Buffer = new List<Item>();
     InitializeComponent();
     if(S.UserRule == Rule.Moder)
     {
         button2.Enabled = false;
         comboBox1.Enabled = false;
     }
 }
Example #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     var SesUs = new User(){Login = textBox1.Text, Pass = textBox2.Text};
     var LU = new List<User>();
     var file = File.OpenRead("Logs");
     var sz = new XmlSerializer(typeof(List<User>));
     if (file.Length != 0)
     {
         LU = (List<User>)sz.Deserialize(file);
     }
     file.Close();
     bool SC = false;
     foreach (var item in LU)
     {
         if(item.Login == SesUs.Login && item.Pass == SesUs.Pass)
         {
             SesUs.UserRule = item.UserRule;
             SC = true;
             break;
         }
     }
     if (!SC) { textBox2.SelectAll(); textBox2.Focus() ; return; }
     switch (SesUs.UserRule)
     {
         case Rule.Admin: { var a = new AdminForm(SesUs); Program.SessionLog.Add(string.Format("{0};Пользователь-{1} зашел как {2}!", DateTime.Now.ToString(), SesUs.UserRule, SesUs.Login)); a.ShowDialog(); }
             break;
         case Rule.User: { var FoulderForm = new Foulder(SesUs); Program.SessionLog.Add(string.Format("{0};Пользователь-{1} зашел как {2}!", DateTime.Now.ToString(), SesUs.UserRule, SesUs.Login)); FoulderForm.ShowDialog(); }
             break;
         case Rule.Banned: { var ErrForm = new BannForm(); Program.SessionLog.Add(string.Format("{0};Пользователь-{1} пытался зайти как {2}!", DateTime.Now.ToString(), SesUs.UserRule, SesUs.Login)); ErrForm.ShowDialog(); }
             break;
         case Rule.Moder: { var a = new AdminForm(SesUs); Program.SessionLog.Add(string.Format("{0};Пользователь-{1} зашел как {2}!", DateTime.Now.ToString(), SesUs.UserRule, SesUs.Login)); a.ShowDialog(); }
             break;
         case Rule.New: { var ErrForm = new BannForm(); Program.SessionLog.Add(string.Format("{0};Пользователь-{1} пытался зайти как {2}!", DateTime.Now.ToString(), SesUs.UserRule, SesUs.Login)); ErrForm.ShowDialog(); }
             break;
         default:
             break;
     }
     textBox1.Text = string.Empty;
     textBox2.Text = string.Empty;
 }
Example #3
0
 public Foulder(User S)
 {
     SesUs = S;
     InitializeComponent();
 }