Ejemplo n.º 1
0
        private void DBC_Tick(object sender, EventArgs e)
        {
            DBC.Stop();
            Operations.GetCustomers();


            List <Users> userlist;


            try
            {
                userlist = Operations.GetCustomers();
                if (userlist.Count > 0)
                {
                    Users mbl;
                    for (int i = 0; i < userlist.Count; i++)
                    {
                        mbl           = userlist[i];
                        Nametext      = mbl.Name;
                        Usernametext  = mbl.User;
                        Phonetext     = mbl.Phone.ToString();
                        Twtext        = mbl.Twuser;
                        Dateregtext   = mbl.Dateofreg.ToShortDateString();
                        dateofendtext = mbl.Dateofend.ToShortDateString();
                        Actives       = mbl.Active;
                        Readys        = mbl.Ready;
                        pricetext     = mbl.Price.ToString();
                        Mcod          = mbl.Mcod.ToString();
                        dateofend     = (DateTime)mbl.Dateofend;
                    }
                }
                else
                {
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); }


            Operations.GetState();


            List <SystemOP> userlist1;


            try
            {
                userlist1 = Operations.GetState();
                if (userlist1.Count > 0)
                {
                    SystemOP mbl;
                    for (int i = 0; i < userlist1.Count; i++)
                    {
                        mbl         = userlist1[i];
                        ReadySystem = mbl.Ready;
                        Prioud_end  = mbl.Prioud_end;
                        Noti        = mbl.Noti.ToString();
                    }
                }
                else
                {
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); }
            if (Actives == 1)
            {
            }
            else
            {
                var exists = System.Diagnostics.Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location)).Count() > 1;
                if (exists == true)
                {
                    MessageBox.Show("RetweetSwap مشغل بالفعل"); Environment.Exit(0);
                }
            }
            if (dateofend >= GetNistTime())
            {
                if (Mcod == Value())
                {
                    Home home = new Home(); home.Show(); this.Close();
                }
                else
                {
                    //Go to form told you u can't work in this pc
                    NotSubPC uc = new NotSubPC();
                    if (!pictureBox1.Contains(uc))
                    {
                        this.Controls.Add(uc);

                        uc.Dock = DockStyle.Fill;
                        uc.BringToFront();
                    }
                    else
                    {
                        uc.BringToFront();
                    }
                }
            }
            else
            {
                if (Mcod == Value())
                {
                    //Go to sub month offer
                    SubsControl uc = new SubsControl();
                    if (!pictureBox1.Contains(uc))
                    {
                        this.Controls.Add(uc);

                        uc.Dock = DockStyle.Fill;
                        uc.BringToFront();
                    }
                    else
                    {
                        uc.BringToFront();
                    }
                }
                else
                {
                    SubsControl uc = new SubsControl();
                    if (!pictureBox1.Contains(uc))
                    {
                        this.Controls.Add(uc);

                        uc.Dock = DockStyle.Fill;
                        uc.BringToFront();
                    }
                    else
                    {
                        uc.BringToFront();
                    }
                }
            }
        }