Exemplo n.º 1
0
        private bool CheckValue()
        {
            string x = rIUtxt.Text.Trim();
            string y = IUtxt.Text.Trim();

            if ((((x == y) && (x.Length == 10))) && (ToolsUtility.CheckValue(plate.Text.Trim(), rplate.Text.Trim())))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        private void ThreadDelete(string user)
        {
            BtnDelegate    btn    = new BtnDelegate(BtnTxt);
            LabelDelegate  label  = new LabelDelegate(LabelTxt);
            PrograDelegate Progra = new PrograDelegate(PrograStepup);

            int i = 1;

            foreach (KeyValuePair <string, string> kv in carpark)
            {
                if (ToolsUtility.Ping(kv.Value))
                {
                    this.Invoke(label, kv.Key, 1);
                    this.Invoke(label, i.ToString() + "/" + carpark.Count.ToString(), 2);
                    DBUtility.DeleteUser(user, kv.Key, kv.Value);
                }
                this.Invoke(Progra);
                i++;
            }
            this.Invoke(btn);
        }
Exemplo n.º 3
0
        private void ThreadAdd(PmsVehicleClass pvc)
        {
            BtnDelegate    btn    = new BtnDelegate(BtnTxt);
            LabelDelegate  label  = new LabelDelegate(LabelTxt);
            PrograDelegate Progra = new PrograDelegate(PrograStepup);

            int i = 1;

            foreach (KeyValuePair <string, string> kv in carpark)
            {
                if (ToolsUtility.Ping(kv.Value))
                {
                    this.Invoke(label, kv.Key, 1);
                    this.Invoke(label, i.ToString() + "/" + carpark.Count.ToString(), 2);
                    DBUtility.AddStaffIU(pvc, kv.Key, kv.Value);
                }
                this.Invoke(Progra);
                i++;
            }
            this.Invoke(btn);
        }
Exemplo n.º 4
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            pBar1.Minimum = 1;
            pBar1.Maximum = carpark.Count;
            pBar1.Value   = 1;
            pBar1.Step    = 1;

            if (button1.Text == "Start")
            {
                PmsUserClass user = new PmsUserClass();

                if (ToolsUtility.CheckValue(nameTxt.Text.Trim(), rnameTxt.Text.Trim()) && ToolsUtility.CheckValue(pwdTxt.Text.Trim(), rpwdTxt.Text.Trim()))
                {
                    user.Name        = nameTxt.Text.Trim();
                    user.Password    = pwdTxt.Text.Trim();
                    user.Level       = levelCombox.Text.Trim();
                    user.ExpiredDate = dateTimePicker1.Value.ToString("yyyy-MM-dd ") + "00:00:00";
                }
                else
                {
                    MessageBox.Show("Please check your username,password");
                    return;
                }
                //      MessageBox.Show(user.Name);
                thr = new Thread(() => ThreadAdd(user));
                thr.Start();
                button1.Text = "Stop";
            }
            else if (button1.Text == "Stop")
            {
                if (thr != null)
                {
                    if (thr.IsAlive)
                    {
                        thr.Abort();
                    }
                }
                button1.Text = "Start";
            }
        }
Exemplo n.º 5
0
        private void ThreadAdd(PmsUserClass user)
        {
            BtnDelegate    btn    = new BtnDelegate(BtnTxt);
            LabelDelegate  label  = new LabelDelegate(LabelTxt);
            PrograDelegate Progra = new PrograDelegate(PrograStepup);

            int i = 1;

            foreach (KeyValuePair <string, string> kv in carpark)
            {
                this.Invoke(label, kv.Key, 1);
                this.Invoke(label, i.ToString() + "/" + carpark.Count.ToString(), 2);
                //  LogClass.wirteLine("Carpark"+kv.Key+",IP:"+kv.Value);
                if (ToolsUtility.Ping(kv.Value.ToString()))
                {
                    DBUtility.AddUser(user, kv.Key, kv.Value);
                }
                this.Invoke(Progra);
                i++;
            }
            this.Invoke(btn);
        }
Exemplo n.º 6
0
 private void button1_Click(object sender, EventArgs e)
 {
     pBar1.Minimum = 1;
     pBar1.Maximum = carpark.Count;
     pBar1.Step    = 1;
     if (button1.Text == "Start")
     {
         string user = name.Text.Trim();
         if (ToolsUtility.CheckValue(IUtxt.Text.Trim(), rIUtxt.Text.Trim()) && ToolsUtility.CheckValue(plate.Text.Trim(), rplate.Text.Trim()) &&
             ToolsUtility.CheckValue(name.Text.Trim(), rname.Text.Trim()))
         {
             PmsVehicleClass pvc = new PmsVehicleClass();
             pvc.IU          = IUtxt.Text.Trim();
             pvc.Plate       = plate.Text.Trim();
             pvc.Name        = name.Text.Trim();
             pvc.ExpiredDate = dateTimePicker1.Value.ToString("yyyy-MM-dd ") + "00:00:00";
             thr             = new Thread(() => ThreadAdd(pvc));
             thr.Start();
             button1.Text = "Stop";
         }
         else
         {
             MessageBox.Show("IU or vehicle or name Format Incorrect");
         }
     }
     else if (button1.Text == "Stop")
     {
         if (thr != null)
         {
             if (thr.IsAlive)
             {
                 thr.Abort();
             }
         }
         button1.Text = "Start";
     }
 }