private void setupArea()
        {
            select_machine.Text = MachineController.getinfor(oldid).name;
            panel1.Controls.Clear();
            Models.Machines[] save = new Models.Machines[100];

            foreach (Models.Machines mch in MachineController.getAllDtbMachine())
            {
                if (mch.status != 3)
                {
                    Label lb = createLabel(mch.machineid, mch.name, mch.status, Convert.ToInt32(mch.locationx / scalew), Convert.ToInt32(mch.locationy / scaleh));
                    panel1.Controls.Add(lb);
                }
            }
            foreach (Models.CustomerMachine cm in ServiceController.getlistworking())
            {
                foreach (Label lb in panel1.Controls)
                {
                    if (Convert.ToInt32(lb.Name) == cm.Machines.machineid && Convert.ToInt32(lb.Name) != oldid)
                    {
                        lb.BackColor = Color.Red;
                        workinglist.Add(lb);
                    }
                    if (Convert.ToInt32(lb.Name) == oldid)
                    {
                        lb.BackColor = Color.Yellow;
                        workinglist.Add(lb);
                    }
                }
            }
        }
Beispiel #2
0
        private void Item_Click1(object sender, EventArgs e)
        {
            NameMachine nm = new NameMachine();
            int         id;

            try
            {
                id = MachineController.tempmachine.Min(mc => mc.machineid);
            }
            catch (Exception ex)
            {
                id = 0;
            }
            if (nm.ShowDialog() == DialogResult.OK)
            {
                Label lb = createLabel(id - 1, nm.nameofmachine, 1, PanelMouseLocation.X, PanelMouseLocation.Y);
                panel1.Controls.Add(lb);
                var machine = new Models.Machines
                {
                    machineid = id - 1,
                    name      = nm.nameofmachine,
                    locationx = Convert.ToInt32(PanelMouseLocation.X * scalew),
                    locationy = Convert.ToInt32(PanelMouseLocation.Y * scaleh),
                    status    = 1
                };
                MachineController.tempmachine.Add(machine);
            }
        }
Beispiel #3
0
        private void setupArea()
        {
            panel1.Controls.Clear();
            Models.Machines[] save = new Models.Machines[100];
            MachineController.tempmachine.CopyTo(save);
            saveList = save.ToList();
            foreach (Models.Machines mch in MachineController.tempmachine)
            {
                if (mch.status != 3)
                {
                    Label lb = createLabel(mch.machineid, mch.name, mch.status, Convert.ToInt32(mch.locationx / scalew), Convert.ToInt32(mch.locationy / scaleh));
                    panel1.Controls.Add(lb);
                }
            }
            listcustomermachine = ServiceController.getlistworking();
            foreach (Models.CustomerMachine cusmachine in listcustomermachine)
            {
                foreach (Label lb in panel1.Controls)
                {
                    if (Convert.ToInt16(lb.Name) == cusmachine.machineid)
                    {
                        lb.BackColor = Color.Yellow;
                    }
                }
            }
            ContextMenu cm   = new ContextMenu();
            MenuItem    item = cm.MenuItems.Add("Thêm ghế tại đây");

            item.Click        += Item_Click1;
            panel1.ContextMenu = cm;

            panel1.MouseMove += Panel1_MouseMove;
        }
Beispiel #4
0
        private void FinishForm_Load(object sender, EventArgs e)
        {
            mch = MachineController.getinfor(Convert.ToInt32(idghe));
            cus = ServiceController.getcustomerinfbymachine(Convert.ToInt32(idghe));
            machinename.Text  = mch.name;
            customername.Text = cus.name;
            cm = ServiceController.getInformation(mch.machineid, cus.localid);
            DateTime now   = DateTime.Now;
            DateTime start = cm.dayadd;

            int active    = time;
            int subactive = FileConfig.config.workingtime - active;

            if (subactive <= 0)
            {
                active = FileConfig.config.workingtime;
            }

            saveactive = active;
            int hour = active / 3600;

            active = active - hour * 3600;
            int minute = active / 60;

            active = active - minute * 60;
            int second = active;

            activetime.Text = addZero(hour) + ":" + addZero(minute) + ":" + addZero(second);
            starttime.Text  = cm.dayadd.ToString();
        }
 private void MachineInformation_Load(object sender, EventArgs e)
 {
     Models.Machines mach = MachineController.getinfor(idmachine);
     textBox1.Text        = mach.name;
     numericUpDown1.Value = mach.locationx;
     numericUpDown2.Value = mach.locationy;
     loadComboBox();
     comboBox1.SelectedValue = mach.status;
     label8.Text             = mach.dayadd.Hour.ToString() + ":" + mach.dayadd.Minute.ToString() + "  " + mach.dayadd.Day + "/" + mach.dayadd.Month + "/" + mach.dayadd.Year;
     label9.Text             = mach.dayupdate.Hour.ToString() + ":" + mach.dayupdate.Minute.ToString() + "  " + mach.dayupdate.Day + "/" + mach.dayupdate.Month + "/" + mach.dayupdate.Year;
 }
Beispiel #6
0
        private void Lb_MouseDown(object sender, MouseEventArgs e)
        {
            Label lb = sender as Label;

            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                MouseDownLocation = e.Location;
            }
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                var listworking = listcustomermachine.Select(o => o.machineid).ToList();

                if (!listworking.Contains(int.Parse(lb.Name)))
                {
                    ContextMenu cm = new ContextMenu();
                    idmachine = Convert.ToInt16(lb.Name);
                    machineob = MachineController.getinfor(idmachine);
                    MenuItem item = cm.MenuItems.Add("Xóa ghế");
                    item.Click += Item_Click;

                    if (machineob.status == 1)
                    {
                        MenuItem item1 = cm.MenuItems.Add("Bảo trì");
                        item1.Click += Item1_Click;
                    }
                    else
                    {
                        MenuItem item2 = cm.MenuItems.Add("Hoạt động");
                        item2.Click += Item2_Click;
                    }
                    lb.ContextMenu = cm;
                }
                else
                {
                    ContextMenu cm = new ContextMenu();
                    lb.ContextMenu = cm;
                }
            }
        }