static void Main(string[] args)
        {
            Developer alek = new Developer("Alek", "Kocevsvski", 1801321, new List<string> { "C#", "JS" }, 50);
            QATester dejan = new QATester();
            DevOps vukashin = new DevOps();
            //Human human = new Human(); // Since Human is an abstract class we cannot instantiate an object, it can only be inherited

            alek.SayHi(); // This SayHi method is from Developer class since we override it
            dejan.SayHi(); // This SayHi method is from Human abstract class and has it's implementation(body)
            vukashin.SayHi(); // Same as above

            // Each Eat method belongs to the corresponding object's(alek, dejan, vukashin) Class, since is overriden method of the abstract method Eat from Human class
            alek.Eat("pizza");
            dejan.Eat("pizza");
            vukashin.Eat("pizza");



            List<int> numbers = new List<int> { 12, 3, 2, 1, 22, 4, 33, 2, 2, 2, 132 };
            var filteredNumbers = numbers.Where(num => num > 10); // Returns IEnumarable, and that means it's not actually returning an interface, but an object that inherits from IEnumerable, still it's not a List, it's something else(class)



            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            // WE CAN'T CREATE A NEW INSTANCE OF AN ABSTRACT CLASS OR INTERFACE
            // Human bob1 = new Human("Bob", 28, 38970707070);
            // IHuman bob2 = new IHuman();

            Developer dev = new Developer("Bob Bobsky", 44, 38970070070,
                                          new List <string>()
            {
                "JavaScript", "C#", "HTML", "CSS"
            }, 6);
            Tester     tester = new Tester("Jill Wayne", 32, 38971071071, 560);
            Operations ops    = new Operations("Greg Gregsky", 28, 38975075075,
                                               new List <string>()
            {
                "Optimus", "ProtoBeat", "PickPro"
            });
            DevOps     devOps = new DevOps("Anne Brown", 24, 38977070070, true, false);
            QAEngineer qa     = new QAEngineer("Mia Wong", 34, 38972072072,
                                               new List <string>()
            {
                "Selenium"
            });

            Console.WriteLine("WELCOME TO THE COMPANY APP");
            Console.WriteLine("--------------------------");
            Console.WriteLine("Developer:");
            Console.WriteLine(dev.GetInfo());
            dev.Greet("Students");
            dev.Code();
            Console.WriteLine("--------------------------");
            Console.WriteLine("Tester:");
            Console.WriteLine(tester.GetInfo());
            tester.Greet("Students");
            tester.TestFeature("Log in");
            Console.WriteLine("--------------------------");
            Console.WriteLine("IT Operations:");
            Console.WriteLine(ops.GetInfo());
            ops.Greet("Students");
            Console.WriteLine($"Infrastructure OK: {ops.CheckInfrastructure(200)}");
            Console.WriteLine("--------------------------");
            Console.WriteLine("QA Engineer:");
            Console.WriteLine(qa.GetInfo());
            qa.Greet("Students");
            qa.TestFeature("Log out");
            qa.Code();
            Console.WriteLine("--------------------------");
            Console.WriteLine("Dev Ops:");
            Console.WriteLine(devOps.GetInfo());
            devOps.Greet("Students");
            Console.WriteLine($"Infrastructure OK: {devOps.CheckInfrastructure(404)}");
            devOps.Code();



            Console.ReadLine();
        }
示例#3
0
        static void Main(string[] args)
        {
            Developer developer = new Developer("Bob Bobsky", 44, 38970123123,
                                                new List <string> {
                "Javascript", "C#", "Html", "css"
            }, 6);
            Tester     tester     = new Tester("Jill Wayne", 32, 38970123123, 540);
            Operations operations = new Operations("Greg Gregsky", 28, 38970123123,
                                                   new List <string> {
                "Optimus", "ProtoBeat", "PickPro"
            });
            DevOps     devOps     = new DevOps("Anne Brown", 23, 38970123321, true, false);
            QAEngineer qAEngineer = new QAEngineer("Mia Wong", 32, 38970321123,
                                                   new List <string> {
                "Selenium"
            });

            Console.WriteLine("The Developer:");
            Console.WriteLine(developer.GetInfo());
            developer.Greet("Students");
            developer.Code();

            Console.WriteLine("==========================");

            Console.WriteLine("The Tester: ");
            Console.WriteLine(tester.GetInfo());
            tester.Greet("Students");
            tester.TestFeature("Log in");

            Console.WriteLine("=========================");

            Console.WriteLine("The IT Operations specialist: ");
            Console.WriteLine(operations.GetInfo());
            operations.Greet("Students");
            Console.WriteLine($"Infrastructure OK: {operations.CheckInfrastructure(200)}");

            Console.WriteLine("=========================");

            Console.WriteLine("The DevOps");
            Console.WriteLine(devOps.GetInfo());
            devOps.Greet("Students");
            devOps.Code();
            Console.WriteLine($"Infrastructure OK: {devOps.CheckInfrastructure(200)}");

            Console.WriteLine("=========================");

            Console.WriteLine("The QA engineer");
            Console.WriteLine(qAEngineer.GetInfo());
            qAEngineer.Greet("Students");
            qAEngineer.Code();
            qAEngineer.TestFeature("Order");

            Console.WriteLine("=========================");

            Console.ReadLine();
        }
 static void Main(string[] args)
 {
     // Can't create an instance of an abstract class
     // Human person = new Human();
     #region Instances
     Developer dev = new Developer("Bob Bobsky", 44, 38970070070,
                                   new List <string>()
     {
         "JavaScript", "C#", "HTML", "CSS"
     }, 6);
     Tester     tester = new Tester("Jill Wayne", 32, 38971071071, 560);
     Operations ops    = new Operations("Greg Gregsky", 28, 38975075075,
                                        new List <string>()
     {
         "Optimus", "ProtoBeat", "PickPro"
     });
     DevOps     devOps = new DevOps("Anne Brown", 24, 38977070070, true, false);
     QAEngineer qa     = new QAEngineer("Mia Wong", 34, 38972072072,
                                        new List <string>()
     {
         "Selenium"
     });
     #endregion
     #region Testing all methods
     Console.WriteLine("The Developer:");
     Console.WriteLine(dev.GetInfo());
     dev.Greet("Students");
     dev.Code();
     Console.WriteLine("----------------");
     Console.WriteLine("The Tester:");
     Console.WriteLine(tester.GetInfo());
     tester.Greet("Students");
     tester.TestFeature("Log In");
     Console.WriteLine("----------------");
     Console.WriteLine("The IT Operations Specialist:");
     Console.WriteLine(ops.GetInfo());
     ops.Greet("Students");
     Console.WriteLine($"Infrastructure OK: {ops.CheckInfrastructure(200)}");
     Console.WriteLine("----------------");
     Console.WriteLine("The DevOps:");
     Console.WriteLine(devOps.GetInfo());
     devOps.Greet("Students");
     devOps.Code();
     Console.WriteLine($"Infrastructure OK: {ops.CheckInfrastructure(200)}");
     Console.WriteLine("----------------");
     Console.WriteLine("The QA Engineer:");
     Console.WriteLine(qa.GetInfo());
     qa.Greet("Students");
     qa.Code();
     qa.TestFeature("Order");
     Console.WriteLine("----------------");
     Console.ReadLine();
     #endregion
 }
示例#5
0
        static void Main(string[] args)
        {
            // you cannot instantiate an object from an abstract class
            //Human myFavHuman = new Human();

            #region Instances
            Developer dev = new Developer("Bob Bobsky", 25, 38970111222, 3, new List <string>()
            {
                "C#", "PhP", "HTML"
            });
            Tester     tester = new Tester("John Snow", 22, 38977123123, 120);
            DevOps     devOps = new DevOps("Roki Balboa", 35, 38978321321, true, false);
            QAEngineer qa     = new QAEngineer("Fidancho FIdanovski", 43, 38975123123, 1876, new List <string>()
            {
                "Chai", "Selenium"
            });
            #endregion


            #region Testing methods
            Console.WriteLine("The Developer");
            Console.WriteLine(dev.GetInfo());
            dev.Greet("Marija");
            dev.Code();
            Console.WriteLine("------------------------------");

            Console.WriteLine("The Tester");
            Console.WriteLine(tester.GetInfo());
            tester.Greet("Sanja");
            tester.TestFeature("Sending transaction to Blockchain");
            Console.WriteLine("------------------------------");

            Console.WriteLine("The DevOps");
            Console.WriteLine(devOps.GetInfo());
            devOps.Greet("Pane");
            devOps.CheckInfrastructure(404);
            devOps.Code();
            Console.WriteLine("------------------------------");

            Console.WriteLine("The QA");
            Console.WriteLine(qa.GetInfo());
            qa.Greet("Kiki");
            qa.TestFeature("Buy item from products");
            Console.WriteLine("------------------------------");
            #endregion
            Console.ReadLine();
        }
示例#6
0
        private static DevOps FuncionPrueba2(int pRid, string SdwEnrollNumber)
        {
            RelojesIngresos objFichada          = new RelojesIngresos();
            DevOps          devolucionOperacion = objFichada.SetFichada(pRid, SdwEnrollNumber, "2018-07-10 15:13:14", "CLOCK");

            Logger.GetInstance().AddLog(true, "FuncionPrueba2()", "SetFichada CacheDebug: " + devolucionOperacion.CacheDebug);

            if (devolucionOperacion.Resultado)
            {
                Logger.GetInstance().AddLog(true, "FuncionPrueba2()", "SetFichada OK");
            }
            else
            {
                Logger.GetInstance().AddLog(false, "FuncionPrueba2()", "SetFichada Error: " + devolucionOperacion.DescripcionError);
            }
            return(devolucionOperacion);
        }
示例#7
0
        static void Main(string[] args)
        {
            //Human h = new Human("Risto", "Pan", 1013123);

            Developer dev = new Developer("Bob", "Bobsky", 1234567, new List <string> {
                "C#", "JS", "Java"
            }, 5);
            Tester     tester     = new Tester("Tester", "Tester", 23423423, 10);
            QaEngineer qaEngineer = new QaEngineer("QA", "Engineer", 34234242, new List <string> {
                "Selenium", "Junit"
            });
            DevOps     devOps     = new DevOps("Cloud", "DevOps", 123123123, true, false);
            Operations operations = new Operations("Local", "Operations", 123123123, 50);

            Console.WriteLine("Developer:");
            Console.WriteLine(dev.GetInfo());
            Console.WriteLine(dev.Greetings("Risto"));
            Console.WriteLine(dev.Codeing());


            Console.WriteLine("Tester:");
            Console.WriteLine(tester.GetInfo());
            Console.WriteLine(tester.Greetings("Risto"));
            Console.WriteLine(tester.Testing());

            Console.WriteLine("QaEngineer:");
            Console.WriteLine(qaEngineer.GetInfo());
            Console.WriteLine(qaEngineer.Greetings("Risto"));
            Console.WriteLine(qaEngineer.Testing());
            Console.WriteLine(qaEngineer.Codeing());

            Console.WriteLine("DevOps:");
            Console.WriteLine(devOps.GetInfo());
            Console.WriteLine(devOps.Greetings("Risto"));
            Console.WriteLine(devOps.CheckInfrastructure("Failed"));
            Console.WriteLine(devOps.Codeing());

            Console.WriteLine("Operations:");
            Console.WriteLine(operations.GetInfo());
            Console.WriteLine(operations.Greetings("Risto"));
            Console.WriteLine(operations.CheckInfrastructure("Ok"));
        }
示例#8
0
        static void Main(string[] args)
        {
            //Person person = new Person("Martin", "Stojanovski", 20, 3647474); - ERROR - abstract class, can not instantiate

            Developer  developer         = new Developer("Ivana", "Petrevska", 24, 5345435, "ECommerce", 2);
            DevOps     devOps            = new DevOps("MArko", "Markovski", 30, 767467324, true, false);
            Operations operationsManager = new Operations("Vasil", "Markovski", 28, 767467324,
                                                          new List <string> {
                "BetProject", "DentalSystem"
            });
            QAEngineer qA = new QAEngineer("Ana", "Martinovska", 34, 453454, null);

            Console.WriteLine("Dev:");
            Console.WriteLine(developer.GetInfo());
            Console.WriteLine("DevOps:");
            Console.WriteLine(devOps.GetInfo());
            Console.WriteLine("Ops:");
            Console.WriteLine(operationsManager.GetInfo());
            Console.WriteLine("QA:");
            Console.WriteLine(qA.GetInfo());

            Console.WriteLine("Dev:");
            //from Person
            developer.Goodbye();
            //from IDeveloper
            developer.Code();

            Console.WriteLine("DevOps:");
            //from Person
            devOps.Greet("SEDC");
            //from Person
            devOps.Goodbye();
            //from IDeveloper
            devOps.Code();
            //from IOperations
            Console.WriteLine(devOps.CheckInfrastructure(200));

            HappyBirthday(developer);
            HappyBirthday(qA);

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            // Cannot instantiate an abstract class. It gives you a compile time error.

            //Human h1 = new Human();


            Developer martin = new Developer("Martin Panovski", 26, 070222444, new List <string> {
                "C#", "JS"
            }, 2);
            Developer dejan = new Developer("Dejan Jovanov", 28, 070222333, new List <string> {
                "HTML", "JS", "SQL"
            }, 2);


            Console.WriteLine("=================== Developers ==================");
            martin.Greet(dejan.FullName);
            dejan.Greet(martin.FullName);


            Console.WriteLine(martin.GetInfo());
            Console.WriteLine(dejan.GetInfo());

            dejan.Code();
            martin.Code();


            Console.WriteLine("================== QA ====================");

            QAEngineer qa = new QAEngineer("Ivo", 30, 070444333, new List <string> {
                "Cypress", "Selenium"
            });

            Console.WriteLine(qa.GetInfo());
            qa.TestFeature("LogIn");

            Console.WriteLine("================== Operations ====================");

            Operations operations = new Operations("Dragan", 30, 070444333, new List <string> {
                "SEDC", "Seavus"
            });

            Console.WriteLine(operations.GetInfo());
            bool status = operations.CheckInfrastructure(404);

            Console.WriteLine(status ? "Status: Ok" : "Status: Failed");


            Console.WriteLine("================= DevOps =======================");
            DevOps devops = new DevOps("Petar", 30, 070444333, true, false);

            Console.WriteLine(devops.GetInfo());
            devops.Code();
            bool statusDevOps = devops.CheckInfrastructure(200);

            Console.WriteLine(statusDevOps ? "Status: Ok" : "Status: Failed");



            Console.WriteLine("================= Interface as a type =======================");
            HappyBirthday(dejan);
            Console.WriteLine();

            HappyBirthday(martin);
            Console.WriteLine();

            HappyBirthday(qa);
            Console.WriteLine();

            HappyBirthday(operations);
            Console.WriteLine();

            HappyBirthday(devops);
            Console.WriteLine();



            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            // var numan = new Human(); // we cannot instanciate object from abstract class

            Developer dev = new Developer("Tosho Todorovski", 30, 999999999,
                                          new List <string>()
            {
                "Javascript", "Css", "Less", "Scss"
            }, 6);
            Tester     test = new Tester("Jill Wayne", 32, 45678943443, 560);
            Operations op   = new Operations("Bob Bobsky", 28, 123123123,
                                             new List <string>()
            {
                "Optimus", "ProtoBeat", "PickPro"
            });
            DevOps     devOps = new DevOps("Anne Brown", 22, 123456789, true, false);
            QAEngineer qa     = new QAEngineer("Mia Wong", 34, 78932222312,
                                               new List <string>()
            {
                "Selenium"
            });

            Console.WriteLine("Testing Developer");
            Console.WriteLine(dev.GetInfo());
            dev.Greet("Students");
            Console.WriteLine("-----------------");

            dev.Code();

            Console.WriteLine("Testing Tester");
            Console.WriteLine(test.GetInfo());
            test.Greet("Students");
            Console.WriteLine("-----------------");

            Console.WriteLine("Operation Specialist");
            Console.WriteLine(op.GetInfo());
            op.Greet("Students");
            Console.WriteLine("-----------------");

            Console.WriteLine("DevOps Specialist");
            Console.WriteLine(devOps.GetInfo());
            devOps.Greet("Students");
            Console.WriteLine("-----------------");

            Console.WriteLine("QA engineer Specialist");
            Console.WriteLine(qa.GetInfo());
            qa.Greet("Students");
            Console.WriteLine("-----------------");

            IHuman qa1 = new QAEngineer("Mia Wong ITester", 34, 78932222312,
                                        new List <string>()
            {
                "Selenium"
            });

            int    number = 9000;
            object obj    = number;

            Console.WriteLine(obj);

            int number1 = (int)obj;

            Console.WriteLine(number1);
            Console.ReadLine();
        }
示例#11
0
        private bool clkZKSoft(int pRid, int pNro, string pDes, string pDir, int pPor, long pPsw)
        {
            bool clkZKSoft = false;

            try
            {
                string sdwEnrollNumber = "";
                int    idwVerifyMode;
                int    idwInOutMode;
                int    idwYear;
                int    idwMonth;
                int    idwDay;
                int    idwHour;
                int    idwMinute;
                int    idwSecond;
                int    idwWorkcode = 0;
                string vFic;
                bool   vClean = false;
                CZKEM  Reloj  = new CZKEM();
                DevOps devolucionOperacion = new DevOps();

                RelojesIngresos      objFichada    = new RelojesIngresos();
                List <RelojResponse> relojResponse = new List <RelojResponse>();
                //DevOps devolucionOperacion = new DevOps();

                //if (pDir == "192.168.0.241")
                //    pDir = "192.168.5.111"; // Reloj Pilar
                // If pDir = "192.168.0.241" Then pDir = "200.49.156.125"
                // If pDir = "200.85.127.22" Then pDir = "192.168.5.125"
                // If pDir = "192.168.4.240" Then
                // pDir = "661705e2a569.sn.mynetname.net"
                // pPor = 64370
                // End If
                //FuncionPrueba(pRid);
                Logger.GetInstance().AddLog(true, "clkZKSoft()", "Conectandose " + pDir + ":" + pPor);
                if (Reloj.Connect_Net(pDir, pPor))/* && false)*/
                {
                    Logger.GetInstance().AddLog(true, "clkZKSoft()", "Conectado a " + pDir + ":" + pPor);
                    Reloj.EnableDevice(pNro, false);

                    // ----> Leo Datos
                    if (Reloj.ReadGeneralLogData(pNro))
                    {
                        // SSR_GetGeneralLogData
                        // ----> Leo Datos
                        while (Reloj.SSR_GetGeneralLogData(pNro, out sdwEnrollNumber, out idwVerifyMode, out idwInOutMode, out idwYear, out idwMonth, out idwDay, out idwHour, out idwMinute, out idwSecond, ref idwWorkcode))
                        {
                            if (!vClean)
                            {
                                Logger.GetInstance().AddLog(true, "clkZKSoft()", "Procesando registros de " + pDir + ":" + pPor);
                            }

                            vClean = true;
                            //Logger.GetInstance().AddLog(true, "clkZKSoft()", "Revisando Legajo: " + sdwEnrollNumber);

                            if (idwYear == DateTime.Now.Year)
                            {
                                RelojResponse relojResponseItem = new RelojResponse();
                                vFic = string.Format(idwYear.ToString("0000")) + "-" + string.Format(idwMonth.ToString("00")) + "-" + string.Format(idwDay.ToString("00")) + " " + String.Format(idwHour.ToString("00")) + ":" + String.Format(idwMinute.ToString("00")) + ":" + String.Format(idwSecond.ToString("00"));
                                //Logger.GetInstance().AddLog(true, "clkZKSoft()", "Fecha del Registro: " + vFic);
                                relojResponseItem.Fich            = vFic;
                                relojResponseItem.Nro             = pNro;
                                relojResponseItem.SdwEnrollNumber = sdwEnrollNumber;
                                relojResponseItem.IdwVerifyMode   = idwVerifyMode;
                                relojResponseItem.IdwInOutMode    = idwInOutMode;
                                relojResponseItem.IdwWorkcode     = idwWorkcode;

                                relojResponse.Add(relojResponseItem);
                            }
                        }

                        if (relojResponse.Count > 0)
                        {
                            if (ConnectServer(dBServer1))
                            {
                                Logger.GetInstance().AddLog(true, "clkZKSoft()", "Envios a Server1: " + dBServer1);
                                Logger.GetInstance().AddLog(true, "clkZKSoft()", "Cantidad de Registros: " + relojResponse.Count);

                                foreach (RelojResponse item in relojResponse)
                                {
                                    Logger.GetInstance().AddLog(true, "clkZKSoft()", "Revisando Legajo: " + item.SdwEnrollNumber);
                                    Logger.GetInstance().AddLog(true, "clkZKSoft()", "Fecha del Registro: " + item.Fich);
                                    try
                                    {
                                        devolucionOperacion = objFichada.SetFichada(pRid, item.SdwEnrollNumber, item.Fich, "CLOCK");

                                        Logger.GetInstance().AddLog(true, "clkZKSoft()", "SetFichada CacheDebug: " + devolucionOperacion.CacheDebug);

                                        if (devolucionOperacion.Resultado)
                                        {
                                            Logger.GetInstance().AddLog(true, "clkZKSoft()", "SetFichada OK");
                                        }
                                        else
                                        {
                                            Logger.GetInstance().AddLog(false, "clkZKSoft()", "SetFichada Error: " + devolucionOperacion.DescripcionError);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Logger.GetInstance().AddLog(false, "clkZKSoft()", "Excepción en SetFichada: " + ex.Message);
                                    }
                                }
                                modDeclares.ShamanSession.Cerrar(modDeclares.ShamanSession.PID);
                            }

                            if (ConnectServer(dBServer2))
                            {
                                Logger.GetInstance().AddLog(true, "clkZKSoft()", "Envios a Server2: " + dBServer2);
                                Logger.GetInstance().AddLog(true, "clkZKSoft()", "Cantidad de Registros: " + relojResponse.Count);
                                foreach (RelojResponse item in relojResponse)
                                {
                                    Logger.GetInstance().AddLog(true, "clkZKSoft()", "Revisando Legajo: " + item.SdwEnrollNumber);
                                    Logger.GetInstance().AddLog(true, "clkZKSoft()", "Fecha del Registro: " + item.Fich);
                                    try
                                    {
                                        devolucionOperacion = objFichada.SetFichada(pRid, item.SdwEnrollNumber, item.Fich, "CLOCK");
                                        Logger.GetInstance().AddLog(true, "clkZKSoft()", "SetFichada CacheDebug: " + devolucionOperacion.CacheDebug);

                                        if (devolucionOperacion.Resultado)
                                        {
                                            Logger.GetInstance().AddLog(true, "clkZKSoft()", "SetFichada OK");
                                        }
                                        else
                                        {
                                            Logger.GetInstance().AddLog(false, "clkZKSoft()", "SetFichada Error: " + devolucionOperacion.DescripcionError);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Logger.GetInstance().AddLog(false, "clkZKSoft()", "Excepción en SetFichada: " + ex.Message);
                                    }
                                }
                                modDeclares.ShamanSession.Cerrar(modDeclares.ShamanSession.PID);
                            }

                            if (ConnectServer(dBServer3))
                            {
                                Logger.GetInstance().AddLog(true, "clkZKSoft()", "Envios a Server3: " + dBServer3);
                                Logger.GetInstance().AddLog(true, "clkZKSoft()", "Cantidad de Registros: " + relojResponse.Count);
                                foreach (RelojResponse item in relojResponse)
                                {
                                    Logger.GetInstance().AddLog(true, "clkZKSoft()", "Revisando Legajo: " + item.SdwEnrollNumber);
                                    Logger.GetInstance().AddLog(true, "clkZKSoft()", "Fecha del Registro: " + item.Fich);
                                    try
                                    {
                                        devolucionOperacion = objFichada.SetFichada(pRid, item.SdwEnrollNumber, item.Fich, "CLOCK");
                                        Logger.GetInstance().AddLog(true, "clkZKSoft()", "SetFichada CacheDebug: " + devolucionOperacion.CacheDebug);

                                        if (devolucionOperacion.Resultado)
                                        {
                                            Logger.GetInstance().AddLog(true, "clkZKSoft()", "SetFichada OK");
                                        }
                                        else
                                        {
                                            Logger.GetInstance().AddLog(false, "clkZKSoft()", "SetFichada Error: " + devolucionOperacion.DescripcionError);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Logger.GetInstance().AddLog(false, "clkZKSoft()", "Excepción en SetFichada: " + ex.Message);
                                    }
                                }
                                modDeclares.ShamanSession.Cerrar(modDeclares.ShamanSession.PID);
                            }
                        }

                        if (vClean)
                        {
                            Logger.GetInstance().AddLog(true, "clkZKSoft()", "Vaciar Reloj " + pNro + " Ip: " + pDir + ":" + pPor);
                            if (Reloj.ClearGLog(pNro))
                            {
                                Reloj.RefreshData(pNro);
                                Logger.GetInstance().AddLog(true, "clkZKSoft()", "Se vació RelojId " + pNro + " Ip: " + pDir + ":" + pPor);
                            }
                            else
                            {
                                int idwErrorCode = 0;
                                Reloj.GetLastError(idwErrorCode);
                                Logger.GetInstance().AddLog(false, "clkZKSoft()", "Error al vaciar " + pDir + ":" + pPor + " " + idwErrorCode);
                            }

                            vClean = false;
                        }
                        else
                        {
                            Logger.GetInstance().AddLog(true, "clkZKSoft()", "No hay fichadas en " + pDir + ":" + pPor);
                        }
                    }
                    else
                    {
                        Logger.GetInstance().AddLog(true, "clkZKSoft()", "No hay fichadas en " + pDir + ":" + pPor);
                    }

                    Logger.GetInstance().AddLog(true, "clkZKSoft()", "Desconectar Reloj " + pDir + ":" + pPor);
                    Reloj.Disconnect();

                    clkZKSoft = true;
                }
                else
                {
                    Logger.GetInstance().AddLog(true, "clkZKSoft()", "Sin conexión a " + pDir + ":" + pPor);
                }
            }
            catch (Exception ex)
            {
                Logger.GetInstance().AddLog(false, "clkZKSoft()", ex.Message);
            }
            return(clkZKSoft);
        }
示例#12
0
        private bool clkZKSoft(int pRid, int pNro, string pDes, string pDir, int pPor, long pPsw, bool vClean = false, int pCommPassword = 0)
        {
            bool clkZKSoft = false;

            try
            {
                string sdwEnrollNumber = "";
                int    idwVerifyMode;
                int    idwInOutMode;
                int    idwYear;
                int    idwMonth;
                int    idwDay;
                int    idwHour;
                int    idwMinute;
                int    idwSecond;
                int    idwWorkcode = 0;
                string vFic;

                CZKEM  Reloj = new CZKEM();
                DevOps devolucionOperacion = new DevOps();

                RelojesIngresos      objFichada    = new RelojesIngresos();
                List <RelojResponse> relojResponse = new List <RelojResponse>();

                Logger.GetInstance().AddLog(true, "clkZKSoft()", "Conectandose " + pDir + ":" + pPor);

                if (pCommPassword > 0)
                {
                    Reloj.SetCommPassword(pCommPassword);
                }

                if (Reloj.Connect_Net(pDir, pPor))
                {
                    Logger.GetInstance().AddLog(true, "clkZKSoft()", "Conectado a " + pDir + ":" + pPor);
                    Reloj.EnableDevice(pNro, false);

                    // ----> Leo Datos
                    if (Reloj.ReadGeneralLogData(pNro))
                    {
                        // SSR_GetGeneralLogData
                        // ----> Leo Datos
                        while (Reloj.SSR_GetGeneralLogData(pNro, out sdwEnrollNumber, out idwVerifyMode, out idwInOutMode, out idwYear, out idwMonth, out idwDay, out idwHour, out idwMinute, out idwSecond, ref idwWorkcode))
                        {
                            if (idwYear == DateTime.Now.Year)
                            {
                                RelojResponse relojResponseItem = new RelojResponse();
                                vFic = string.Format(idwYear.ToString("0000")) + "-" + string.Format(idwMonth.ToString("00")) + "-" + string.Format(idwDay.ToString("00")) + " " + String.Format(idwHour.ToString("00")) + ":" + String.Format(idwMinute.ToString("00")) + ":" + String.Format(idwSecond.ToString("00"));
                                //Logger.GetInstance().AddLog(true, "clkZKSoft()", "Fecha del Registro: " + vFic);
                                relojResponseItem.Fich            = vFic;
                                relojResponseItem.Nro             = pNro;
                                relojResponseItem.SdwEnrollNumber = sdwEnrollNumber;
                                relojResponseItem.IdwVerifyMode   = idwVerifyMode;
                                relojResponseItem.IdwInOutMode    = idwInOutMode;
                                relojResponseItem.IdwWorkcode     = idwWorkcode;

                                relojResponse.Add(relojResponseItem);
                            }
                        }

                        //SAVE IN DATABASE.
                        SaveInDataBase(pRid, relojResponse);

                        if (vClean)
                        {
                            //Logger.GetInstance().AddLog(true, "clkZKSoft()", "BLOQUE COMENTADO: Vaciar Reloj " + pNro + " Ip: " + pDir + ":" + pPor);

                            Logger.GetInstance().AddLog(true, "clkZKSoft()", "Vaciar Reloj " + pNro + " Ip: " + pDir + ":" + pPor);
                            if (Reloj.ClearGLog(pNro))
                            {
                                Reloj.RefreshData(pNro);
                                Logger.GetInstance().AddLog(true, "clkZKSoft()", "Se vació RelojId " + pNro + " Ip: " + pDir + ":" + pPor);
                            }
                            else
                            {
                                int idwErrorCode = 0;
                                Reloj.GetLastError(idwErrorCode);
                                Logger.GetInstance().AddLog(false, "clkZKSoft()", "Error al vaciar " + pDir + ":" + pPor + " " + idwErrorCode);
                            }
                        }
                    }
                    else
                    {
                        Logger.GetInstance().AddLog(true, "clkZKSoft()", "No hay fichadas en " + pDir + ":" + pPor);
                    }

                    Logger.GetInstance().AddLog(true, "clkZKSoft()", "Desconectar Reloj " + pDir + ":" + pPor);

                    Reloj.Disconnect();

                    clkZKSoft = true;
                }
                else
                {
                    Logger.GetInstance().AddLog(true, "clkZKSoft()", "Sin conexión a " + pDir + ":" + pPor);
                }
            }
            catch (Exception ex)
            {
                Logger.GetInstance().AddLog(false, "clkZKSoft()", ex.Message);
            }
            return(clkZKSoft);
        }