示例#1
0
        public bool DoesUserExist(SlackCommandPayload payload)
        {
            try
            {
                var returnVal = new object();
                using (MySqlConnection conn = GetConnection())
                {
                    MySqlCommand cmd = new MySqlCommand("DoesUserExist", conn);
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("slack_user_id", payload.user_id);
                    conn.Open();
                    returnVal = cmd.ExecuteScalar();
                    conn.Close();
                }

                if (returnVal != null)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                var that = ex.Data;
            }

            return(false);
        }
示例#2
0
 public void UpdateUser(SlackCommandPayload payload)
 {
     try
     {
         using (MySqlConnection conn = GetConnection())
         {
             MySqlCommand cmd = new MySqlCommand("UpdateUser", conn);
             cmd.CommandType = System.Data.CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("opt_in_time", payload.opt_in_time);;
             cmd.Parameters.AddWithValue("slack_user_id", payload.user_id);
             cmd.Parameters.AddWithValue("webhook_url", payload.response_url);
             conn.Open();
             cmd.ExecuteNonQuery();
             conn.Close();
         }
     }
     catch (Exception ex)
     {
         var that = ex.Data;
     }
 }