Exemple #1
0
        public static void Navigation()
        {
            string c         = "C";
            string e         = "E";
            string userInput = null;

            while (userInput != e)
            {
                Console.WriteLine("\nChoose Action: \n(C) Input Student, \n(E) to EXIT");
                userInput = Console.ReadLine();
                if (userInput == c)
                {
                    ListPrinter.PrintListINPUTStudents();
                }
                else if (userInput == e)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("EXIT");
                    Console.ForegroundColor = ConsoleColor.White;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                    Console.WriteLine("Unindentified Input, Please Choose Again");
                    Console.ForegroundColor = ConsoleColor.White;
                }
            }
        }
        /*Printer*/
        public List <PrinterModels> GetSelectListPrinters(string StoreID, List <PrinterOnProductModels> ListPrinter)
        {
            List <PrinterModels> lstData   = _printerFactory.GetListPrinter(StoreID, null, CurrentUser.ListOrganizationId);
            List <PrinterModels> lstResult = new List <PrinterModels>();

            //if (lstData != null)
            //{
            //    foreach (PrinterModels item in lstData)
            //        lstResult.Add(new PrinterModels
            //        {
            //            PrinterName = item.PrinterName,// + " [" + item.StoreName + "]",
            //            Id = item.Id,
            //            Status = 9
            //        });
            //}
            //lstResult.ForEach(x =>
            //{
            //    if (ListPrinter.Count != 0)
            //    {
            //        x.Status = ListPrinter.Where(z => z.PrinterID.Equals(x.Id)).FirstOrDefault() != null ? (byte)Commons.EStatus.Actived : (byte)Commons.EStatus.Deleted;
            //    }
            //});

            if (lstData != null && lstData.Any())
            {
                if (ListPrinter == null)
                {
                    ListPrinter = new List <PrinterOnProductModels>();
                }
                var  printer      = new PrinterOnProductModels();
                bool isMapProduct = false;
                int  status       = (int)Commons.EStatus.Deleted;
                foreach (PrinterModels item in lstData)
                {
                    isMapProduct = false;
                    status       = (int)Commons.EStatus.Deleted;
                    printer      = ListPrinter.Where(w => w.PrinterID == item.Id).FirstOrDefault();
                    if (printer != null)
                    {
                        isMapProduct = true;
                        status       = printer.IsActive ? (int)Commons.EStatus.Actived : (int)Commons.EStatus.Deleted;
                    }
                    lstResult.Add(new PrinterModels()
                    {
                        PrinterName  = item.PrinterName,// + " [" + item.StoreName + "]",
                        Id           = item.Id,
                        Status       = status,
                        IsMapProduct = isMapProduct
                    });
                }
            }
            lstResult = lstResult.OrderBy(o => o.PrinterName).ToList();
            return(lstResult);
        }
Exemple #3
0
        public static void RunTests()
        {
            var nodes     = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            var exercises = new Exercises();
            var printer   = new ListPrinter();
            var builder   = new ListBuilder();
            var list      = builder.BuildList(nodes);

            list.Print(printer.PrintToConsole);
            Utility.WriteLine(string.Empty);
            var temp = exercises.ReverseList(list);

            //var temp = exercises.ReverseKNodesInList(list, 5);
            temp.Print(printer.PrintToConsole);
            Utility.WriteLine(string.Empty);
            for (var i = 1; i <= 10; i++)
            {
                list = builder.BuildList(nodes);
                temp = exercises.ReverseKGroup(list, i);
                temp.Print(printer.PrintToConsole);
                Utility.WriteLine(string.Empty);
            }
            //var temp = exercises.ReverseKNodesInList(list, 5);
            //temp.Print(printer.PrintToConsole);
            Utility.WriteLine(string.Empty);

            /*
             * Stopwatch sw = new Stopwatch();
             * {
             *  var lists = TestableLists.BuildTestLists();
             *  foreach (var list in lists)
             *  {
             *      if (list != null)
             *      {
             *          list.Print(printer.PrintToConsole);
             *          Utility.WriteLine(string.Empty);
             *          sw.Restart();
             *          //var temp = exercises.ReverseList(list);
             *          var temp = exercises.IncrementByOneWithStack(list);
             *          temp.Print(printer.PrintToConsole);
             *          sw.Stop();
             *          Utility.WriteLine(string.Empty);
             *          Utility.WriteLine("With stack, time consumed: {0}ticks", sw.ElapsedTicks);
             *          Utility.WriteLine(string.Empty);
             *      }
             *  }
             * }
             * {
             *  var lists = TestableLists.BuildTestLists();
             *  foreach (var list in lists)
             *  {
             *      if (list != null)
             *      {
             *          list.Print(printer.PrintToConsole);
             *          Utility.WriteLine(string.Empty);
             *          sw.Restart();
             *          var temp = exercises.IncrementByOneInPlace(list);
             *          temp.Print(printer.PrintToConsole);
             *          sw.Stop();
             *          Utility.WriteLine(string.Empty);
             *          Utility.WriteLine("In place, time consumed: {0}ticks", sw.ElapsedTicks);
             *          Utility.WriteLine(string.Empty);
             *      }
             *  }
             * }
             */
        }
Exemple #4
0
        public WorkForm(BaseClass BC, int LOTID)
        {
            InitializeComponent();

            BaseC       = BC;                                                               //Приведение к типу
            BaseC.LOTID = LOTID;
            this.Text   = BaseC.GetType().Name;                                             //Заголовок формы называется именем модулем
            GetLoggin();                                                                    //Настройка форма ввода пароля
            Times.Enabled     = true; LBPrintSN.Text = DateTime.Now.ToString("dd.MM.yyyy"); //Настройка времени
            Controllabel.Text = "";
            TestGrid.Rows.Add(12);
            //Реализация загрузки определенного класса

            CloseApp.Click += (a, e) =>
            {
                var Result = MessageBox.Show("Уверены, что хотите выйти?", "Предупреждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Result == DialogResult.Yes)
                {
                    Application.Exit();
                }
            };

            BackButton.Click += (a, e) =>
            {
                var Result = MessageBox.Show("Уверены, что хотите вернуться в меню настройки?", "Предупреждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Result == DialogResult.Yes)
                {
                    Close();
                }
            };

            GETSNCH.Click += (a, e) =>
            {
                if (GETSNCH.Checked)
                {
                    BaseC.CheckGetSN = true;
                }
                if (!GETSNCH.Checked)
                {
                    BaseC.CheckGetSN = false;
                }
            };

            BTPrint.Click += (a, e) =>
            {
                if (ListPrinter.SelectedIndex == -1)
                {
                    MessageBox.Show("Принтер не выбран"); return;
                }

                BaseC.printName  = ListPrinter.SelectedItem.ToString();
                PrintLBName.Text = "Текущий принтер \n" + BaseC.printName;
                ListPrinter.ClearSelected();
            };


            ClearBT.Click += (a, e) =>
            {
                //BaseC.cts.Cancel();
                SerialTextBox.Enabled = true;
                SerialTextBox.Clear();
                SerialTextBox.Select();
            };

            TB_RFIDIn.KeyDown += (a, e) => //Событие при вводе логина
            {
                if (e.KeyCode == Keys.Enter)
                {
                    if (GetLoginData()) //Метод, которы проверяет логин и добавляет в ArrayList данные о пользователе
                    {
                        TB_RFIDIn.Clear(); TB_RFIDIn.Select();
                    }
                }
            };

            SerialTextBox.KeyDown += (a, e) => //Событие скнирование номера
            {
                if (e.KeyCode == Keys.Enter)
                {
                    TestGrid.Rows.Clear();
                    TestGrid.RowCount = 12;
                    BaseC.KeyDownMethod();

                    if (BaseC.GetType() == typeof(UploadStation))
                    {
                        return;
                    }

                    if (BaseC.GetType() == typeof(Desassembly_STB))
                    {
                        return;
                    }

                    SerialTextBox.Clear(); SerialTextBox.Select();
                }
            };

            //Сохранение координат
            BT_SevePrintSettings.Click += (a, e) =>
            {
                //var list = new List<string>() { IDX.Value.ToString(), SNX.Value.ToString(), IDY.Value.ToString(), SNY.Value.ToString()};

                //foreach (var item in pathlist)
                //{
                //    var line = item.Substring(0, 22) + list[pathlist.IndexOf(item)] + ".txt";
                //    File.Move(item,line) ;
                //}

                if (BaseC.CheckPathPrinterSettings())
                {
                    BaseC.CreatePathPrinter();
                }

                if (SNPRINT.Visible == true)
                {
                    SaveSettingPrint(SNPRINT);
                }
                if (IDPrint.Visible == true)
                {
                    SaveSettingPrint(IDPrint);
                }
            };

            BT_PrinterSettings.Click += (a, e) =>
            {
                GB_PrinterSettings.Visible = true; SettingDelay.Visible = true;
                foreach (Control item in SettingDelay.Controls)
                {
                    if (item.Name.Contains("Delay"))
                    {
                        item.Enabled = true;
                    }
                }
            };

            BT_ClosePrintSet.Click += (a, e) =>
            {
                GB_PrinterSettings.Visible = false; SettingDelay.Visible = false; SaveSettingBT.Text = ""; SerialTextBox.Select();
                foreach (Control item in SettingDelay.Controls)
                {
                    if (item.Name.Contains("Delay"))
                    {
                        item.Enabled = false;
                    }
                }
            };

            CB_ErrorCode.TextChanged += (a, e) =>
            {
                CB_ErrorCode.MaxLength = 2;
                if (CB_ErrorCode.Text.Length == 2)
                {
                    BT_Disassebly.Select();
                }
            };

            BT_Disassebly.Click += (a, e) =>
            {
                if (string.IsNullOrEmpty(CB_ErrorCode.Text))
                {
                    MessageBox.Show("Укажите код ошибки"); CB_ErrorCode.Select();  return;
                }

                if (CheckErrocode(CB_ErrorCode.Text))
                {
                    MessageBox.Show("Не корректный код ошибки"); CB_ErrorCode.Select();  return;
                }

                var Dis         = new Desassembly_STB();
                var ErrorCodeID = Dis.GetErrorCodeID(CB_ErrorCode.Text);
                var serial      = int.Parse(SerialTextBox.Text.Substring(15));
                var smID        = GetSmartCardID(serial);
                var fullStbsn   = GetFullSTBSN(serial);
                var casid       = GetCASID(serial);
                BaseC.WriteToDBDesis(serial, SerialTextBox.Text, ErrorCodeID);
                BaseC.UpdateToDBDesis(serial);
                BaseC.DeleteToDBWeight(serial);
                BaseC.DeleteToDBDesis(serial);
                BaseC.DeleteToUpload(serial);
                BaseC.AddLogDesis(serial, Dis.IDApp, smID, fullStbsn, casid);
                BaseC.LabelStatus(Controllabel, $"Серийный номер { SerialTextBox.Text } \n ОТКРЕПЛЁН УСПЕШНО", Color.Green);
                BaseC.ShiftCounter += 1;
                BaseC.LotCounter   += 1;
                BaseC.ShiftCounterUpdate();
                BaseC.LotCounterUpdate();
                Label_ShiftCounter.Text = BaseC.ShiftCounter.ToString();
                LB_LOTCounter.Text      = BaseC.LotCounter.ToString();
                SerialTextBox.Enabled   = true;
                DG_UpLog.Rows.Add(int.Parse(Label_ShiftCounter.Text), SerialTextBox.Text, CB_ErrorCode.Text, DateTime.UtcNow.AddHours(2));
                DG_UpLog.Sort(DG_UpLog.Columns[0], System.ComponentModel.ListSortDirection.Descending);
                SerialTextBox.Clear();
                CB_ErrorCode.Text     = "";
                BT_Disassebly.Enabled = false;
                SerialTextBox.Select();
            };
        }