Пример #1
0
        protected override void OnStart(string[] args)
        {
            log = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + @"\OperationLog.txt", true);

            WaitList = WaitListOnStop.Load();

            Conection.DesktopServerProcedure();
            Conection.WebOpen();
            //When process starts
            if (WaitList.Count >= 1)
            {
                CheckList();
            }

            this.StartMainFunction           = new Timer(3000); // 3seg
            this.StartMainFunction.AutoReset = true;
            this.StartMainFunction.Elapsed  += new ElapsedEventHandler(this.timer1_Elapsed);
            this.StartMainFunction.Start();

            this.StartWaitList           = new Timer(1800000);// 30min
            this.StartWaitList.AutoReset = true;
            this.StartWaitList.Elapsed  += new ElapsedEventHandler(this.timer2_Elapsed);
            this.StartWaitList.Start();

            LogWriteLine("Service starded");
            log.AutoFlush = true;
        }
 public override void Register()
 {
     Conection.WebOpen();
     command.CommandText = "INSERT INTO `employee`(`name`, `note_avarage`, `issue_sol_avarage`,`V11_code`,`visits`) VALUES('" + name + "' ,0,0, " + id_vip + ", 1)";
     command.Connection  = Conection.WebConection;
     command.ExecuteNonQuery();
     Conection.WebConection.Close();
 }
        public void IncreaseVisits()
        {
            Conection.WebOpen();
            command.CommandText = "SELECT visits from employee where V11_code =" + id_vip;
            command.Connection  = Conection.WebConection;
            int aux = Convert.ToInt32(command.ExecuteScalar());

            aux++;
            command.CommandText = "UPDATE employee set visits = " + aux + " where V11_code = " + id_vip;
            command.Connection  = Conection.WebConection;
            command.ExecuteNonQuery();
        }
        /// <summary>
        /// When the form be sent, increase the number of sent forms
        /// </summary>
        public void IncreaseVisits()
        {
            Conection.WebOpen();
            command.CommandText = "SELECT tecnical_visits from customer where V11_ID =" + id_vip;
            command.Connection  = Conection.WebConection;
            int aux = Convert.ToInt32(command.ExecuteScalar());

            aux++;
            command.CommandText = "UPDATE customer set tecnical_visits = " + aux + " where V11_ID = " + id_vip;
            command.Connection  = Conection.WebConection;
            command.ExecuteNonQuery();
        }
 /// <summary>
 /// Check if the client is registered in Web Database
 /// </summary>
 /// <returns></returns>
 public override bool IsRegistered()
 {
     Conection.WebOpen();
     command.CommandText = "SELECT count(*) from customer where V11_ID = " + id_vip;
     command.Connection  = Conection.WebConection;
     if (Convert.ToInt32(command.ExecuteScalar()) == 1)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }