Exemplo n.º 1
0
        public int[] GetTotalCallsToday()
        {
            string          com          = "SELECT * FROM IncomingCalls WHERE Date = '" + DateTime.Now.ToShortDateString() + "'";
            MySqlCommand    command      = new MySqlCommand(com, con);
            MySqlDataReader reader       = command.ExecuteReader();
            int             counter      = 0;
            int             wrongCounter = 0;

            while (reader.Read())
            {
                counter++;
                if (reader["State"].ToString() == CallRecord.StatusToString(ApplicationStatus.WrongCall))
                {
                    wrongCounter++;
                }
            }
            reader.Close();

            int[] ar = new int[2];
            ar[0] = counter;
            ar[1] = wrongCounter;
            return(ar);
        }
Exemplo n.º 2
0
        public bool UpdateRecord(CallRecord record)
        {
            string com = " ";

            try
            {
                com = new StringBuilder().AppendFormat("" +
                                                       "UPDATE" +
                                                       " IncomingCalls" +
                                                       " SET" +
                                                       " Date = '{0}'," +
                                                       " Time = '{1}'," +
                                                       " Name = '{2}'," +
                                                       " PhoneNumber = '{3}'," +
                                                       " TechType = '{4}'," +
                                                       " Brand = '{5}'," +
                                                       " Reason = '{6}'," +
                                                       " State =  '{7}'," +
                                                       " DiagnosticDate = '{8}'," +
                                                       " RecallDate = '{9}'" +
                                                       " WHERE ID= {10}"
                                                       , record.Date, record.Time, record.Name, record.Phone, record.Type,
                                                       record.Brand, record.Reason,
                                                       CallRecord.StatusToString(record.Status),
                                                       record.DiagnosticDate, record.RecallDate, record.ID.ToString()).ToString();

                MySqlCommand command = new MySqlCommand(com, con);
                command.ExecuteNonQuery();
                RecordReceived();
                return(true);
            }
            catch (MySqlException e)
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        public string WriteRecord(CallRecord record, bool diagnostic)
        {
            string com = "";

            if (diagnostic)
            {
                com = (new StringBuilder()).AppendFormat("INSERT INTO IncomingCalls (Date,Time,Name,PhoneNumber,TechType,Brand,Reason,DiagnosticDate,State) VALUES ('{0}','{1}','{2}','+7{3}','{4}','{5}','{6}', '{7}' ,'{8}')", record.Date, record.Time, record.Name, record.Phone, record.Type, record.Brand, record.Reason, record.DiagnosticDate, CallRecord.StatusToString(record.Status)).ToString();
            }
            if (!diagnostic)
            {
                com = (new StringBuilder()).AppendFormat("INSERT INTO IncomingCalls (Date,Time,Name,PhoneNumber,TechType,Brand,Reason,RecallDate,State) VALUES ('{0}','{1}','{2}','+7{3}','{4}','{5}','{6}', '{7}' ,'{8}')", record.Date, record.Time, record.Name, record.Phone, record.Type, record.Brand, record.Reason, record.RecallDate, CallRecord.StatusToString(record.Status)).ToString();
            }
            MySqlCommand comm = new MySqlCommand(com, con);

            comm.ExecuteNonQuery();
            RecordReceived();
            return(com);
        }