Ejemplo n.º 1
0
        // обновить что-то в базе
        public void update_datebase_user_session_finish_on_file(current_user user, user_time time)
        {
            string sql = string.Format("UPDATE user_recording" + " " +
                                       "set data_finish_Day=" + time.Get_day() + ", data_finish_Month=" + time.Get_month() +
                                       ", data_finish_Year=" + time.Get_year() + ", data_finish_Sec=" + time.Get_sec() +
                                       ", data_finish_Min=" + time.Get_min() + ", data_finish_Hour=" + time.Get_hour() + " "
                                       + "where user_id='" + user.Get_user_id() + "'" + " and data_finish_Hour=0;");

            using (SqlCommand cmd = new SqlCommand(sql, this.connect))
            {
                cmd.ExecuteNonQuery();
            }
        }
Ejemplo n.º 2
0
 // обновить запись сессии после нажатия кнопки стоп
 public void update_datebase_user_session_finish(current_user user, user_time time)
 {
     try
     {
         string sql = string.Format("UPDATE user_session" + " " +
                                    "set data_finish_Day=" + time.Get_day() + ", data_finish_Month=" + time.Get_month() +
                                    ", data_finish_Year=" + time.Get_year() + ", data_finish_Sec=" + time.Get_sec() +
                                    ", data_finish_Min=" + time.Get_min() + ", data_finish_Hour=" + time.Get_hour() + ", finish_status='true'" + ", "
                                    + "start_status='false'" + " " + "where user_id='" + user.Get_user_id() + "'" + ";");
         using (SqlCommand cmd = new SqlCommand(sql, this.connect))
         {
             cmd.ExecuteNonQuery();
         }
         update_datebase_user_session_finish_on_file(user, time);
     }
     catch (SqlException ex)
     { }
 }
Ejemplo n.º 3
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)
            { }
        }
Ejemplo n.º 4
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)
            { }
        }