Esempio n. 1
0
        // вставить запись что пользователь авторизировался
        public void insert_datbase_session_connection(string user_id, database Database)
        {
            bool start      = false;
            bool finish     = false;
            bool connection = true;

            try
            {
                string sql = string.Format("Insert Into user_session " + "(user_id, start_status, finish_status, connection_status)Values('{0}', '{1}','{2}','{3}')",
                                           user_id, start, finish, connection);
                using (SqlCommand cmd = new SqlCommand(sql, this.connect))
                {
                    cmd.ExecuteNonQuery();
                }
            }
            catch (SqlException ex)
            { }
        }
Esempio n. 2
0
        // вставить запись сессии после нажатия кнопки старт
        public void insert_datbase_session_start(current_user CurrentUser, user_time time, database Database)
        {
            bool start       = true;
            bool finish      = false;
            bool connection  = true;
            int  finish_time = 0;

            try
            {
                List <string> list;
                list = Database.get_from_datebase("data_start_Day, data_start_Month, data_start_Year, data_start_Hour, data_start_Min, data_start_Sec", "user_session", "where user_id='" + CurrentUser.Get_user_id() + "' and start_status='1'");
                if (list == null || list.LongCount() == 0)
                {
                    string sql = string.Format("Insert Into user_session " + "(user_id, start_status, finish_status, connection_status, data_start_Day, data_start_Month, data_start_Year, data_start_Hour, data_start_Min, data_start_Sec, data_finish_Day, data_finish_Month, data_finish_Year, data_finish_Sec, data_finish_Min, data_finish_Hour)Values('{0}', '{1}','{2}','{3}','{4}','{5}','{6}','{7}', '{8}','{9}','{10}','{11}','{12}','{13}', '{14}', '{15}')",
                                               CurrentUser.Get_user_id(), start, finish, connection, time.Get_day(), time.Get_month(), time.Get_year(), time.Get_hour(), time.Get_min(), time.Get_sec(), finish_time, finish_time, finish_time, finish_time, finish_time, finish_time);
                    using (SqlCommand cmd = new SqlCommand(sql, this.connect))
                    {
                        cmd.ExecuteNonQuery();
                    }
                    insert_datebase_session_on_file(CurrentUser, time, Database);
                }
            }
            catch (SqlException ex)
            { }
        }
Esempio n. 3
0
        // вставить записи в табличку записей
        public void insert_datebase_session_on_file(current_user CurrentUser, user_time time, database Database)
        {
            int    finish_time         = 0;
            int    count_hours_all     = 0;
            int    count_hours_for_day = 0;
            string type_created        = "button";

            try
            {
                string sql = string.Format("Insert Into user_recording " + "(user_id, data_start_Day, data_start_Month, data_start_Year, data_start_Hour, data_start_Min, data_start_Sec, data_finish_Day, data_finish_Month, data_finish_Year, data_finish_Sec, data_finish_Min, data_finish_Hour, type_created, count_hours_all, count_hours_for_day)Values('{0}', '{1}','{2}','{3}','{4}','{5}','{6}','{7}', '{8}','{9}','{10}','{11}','{12}', '{13}', '{14}', '{15}')",
                                           CurrentUser.Get_user_id(), time.Get_day(), time.Get_month(), time.Get_year(), time.Get_hour(), time.Get_min(), time.Get_sec(), finish_time, finish_time, finish_time, finish_time, finish_time, finish_time, type_created, count_hours_all, count_hours_for_day);
                using (SqlCommand cmd = new SqlCommand(sql, this.connect))
                {
                    cmd.ExecuteNonQuery();
                }
            }
            catch (SqlException ex)
            { }
        }